Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1115 | Rev 1123 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1115 Rev 1116
Line 105... Line 105...
105
 
105
 
106
	public function getInfosImagesGalerieMobile($nn) {
106
	public function getInfosImagesGalerieMobile($nn) {
107
		$url = $this->getUrlImagesGalerieMobile($nn);
107
		$url = $this->getUrlImagesGalerieMobile($nn);
108
		$donnees = $this->chargerDonnees($url);
108
		$donnees = $this->chargerDonnees($url);
109
		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
-
 
110
		$this->formaterResultatImagesDel($images);
109
		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
111
		return $images;
110
		return $images;
Line -... Line 111...
-
 
111
	}
-
 
112
 
-
 
113
	/**
-
 
114
	 * Retourne les $limite images ayant le plus de votes pour le protocole $protocole et le(s) tag(s) $tags
-
 
115
	 * 
-
 
116
	 * @param number $nn
-
 
117
	 * @param mixed $tags
-
 
118
	 * @param number $protocole
-
 
119
	 * @param number $limite
-
 
120
	 * @return array
-
 
121
	 */
-
 
122
	public function getInfosMeilleuresImagesParTag($nn, $tags, $protocole = Eflore::PROTOCOLE_CAPITALISATION, $limite = 10) {
-
 
123
		if (! is_array($tags)) {
-
 
124
			$tags = array($tags);
-
 
125
		}
-
 
126
		$images_tag = array();
-
 
127
		foreach ($tags as $tag) {
-
 
128
			$url = $this->getUrlMeilleuresImagesParTag($nn, $tag, $protocole, $limite);
-
 
129
			$donnees = $this->chargerDonnees($url);
-
 
130
			$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
-
 
131
			$images_tag[$tag] = $images;
-
 
132
		}
-
 
133
		return $images_tag;
112
	}
134
	}
113
 
135
 
114
	private function getUrlImagesParIdsNoms($idsNoms) {
136
	private function getUrlImagesParIdsNoms($idsNoms) {
115
		$tpl = $this->obtenirSqueletteSelonApi('imagesResultatsDetermination');
137
		$tpl = $this->obtenirSqueletteSelonApi('imagesResultatsDetermination');
116
		$params = array('idsNoms' => implode(',', $idsNoms), 'referentiel' => Registre::get('parametres.referentiel'));
138
		$params = array('idsNoms' => implode(',', $idsNoms), 'referentiel' => Registre::get('parametres.referentiel'));
Line 145... Line 167...
145
		$params = array('nn' => $nn);
167
		$params = array('nn' => $nn);
146
		$url = $this->formaterUrl($tpl, $params);
168
		$url = $this->formaterUrl($tpl, $params);
147
		return $url;
169
		return $url;
148
	}
170
	}
Line -... Line 171...
-
 
171
 
-
 
172
	private function getUrlMeilleuresImagesParTag($nn, $tag, $protocole = Eflore::PROTOCOLE_CAPITALISATION, $limite = 10) {
-
 
173
		$tpl = Config::get('delMeilleuresImagesParTagTpl');
-
 
174
		$params = array('nn'=> $nn,
-
 
175
						'tag'=> $tag,
-
 
176
						'protocole' => $protocole,
-
 
177
						'referentiel' => Registre::get('parametres.referentiel'),
-
 
178
						'limite' => $limite);
-
 
179
		$url = $this->formaterUrl($tpl, $params);
-
 
180
		return $url;
-
 
181
	}
149
 
182
 
150
	/**
183
	/**
151
	 * Transforme les résultats issus des Webservices autres que eflore/cel afin de conserver un format homogène
184
	 * Transforme les résultats issus des Webservices autres que eflore/cel afin de conserver un format homogène
152
	 * @param mixed $images
185
	 * @param mixed $images
153
	 */
186
	 */
Line 177... Line 210...
177
	 * Convertit un array venant d'un Webservice del vers le format retourné par eflore/cel
210
	 * Convertit un array venant d'un Webservice del vers le format retourné par eflore/cel
178
	 * @param array $image
211
	 * @param array $image
179
	 * @return array
212
	 * @return array
180
	 */
213
	 */
181
	private function formaterUnResultatImagesDel(array $image) {
214
	private function formaterUnResultatImagesDel(array $image) {
182
		//echo "FORMAT DEL: <pre>"; print_r($image); echo "</pre>";
-
 
183
		$libelleAuteur = $image['observation']['auteur.prenom'].' '.$image['observation']['auteur.nom'];
215
		$libelleAuteur = $image['observation']['auteur.prenom'].' '.$image['observation']['auteur.nom'];
184
		$codeReferentiel = substr($image['observation']['determination.referentiel'], 0, strpos($image['observation']['determination.referentiel'], ':'));
216
		$codeReferentiel = substr($image['observation']['determination.referentiel'], 0, strpos($image['observation']['determination.referentiel'], ':'));
185
		$localiteLibelle = array($image['observation']['zone_geo'],
217
		$localiteLibelle = array($image['observation']['zone_geo'],
186
				$image['observation']['lieudit'],
218
				$image['observation']['lieudit'],
187
				$image['observation']['station'],
219
				$image['observation']['station'],
Line 200... Line 232...
200
				'station.lieudit' => $image['observation']['lieudit'],
232
				'station.lieudit' => $image['observation']['lieudit'],
201
				'station.station' => $image['observation']['station'],
233
				'station.station' => $image['observation']['station'],
202
				'station.milieu' => $image['observation']['milieu'],
234
				'station.milieu' => $image['observation']['milieu'],
203
				'station.libelle' => $this->formaterLocalite($localiteLibelle)
235
				'station.libelle' => $this->formaterLocalite($localiteLibelle)
204
		);
236
		);
205
		//echo "FORMAT CEL: <pre>"; print_r($retourImage); echo "</pre>";
-
 
206
		return $retourImage;
237
		return $retourImage;
207
	}
238
	}
Line 208... Line 239...
208
	
239
	
209
	private function formaterLocalite($infosLocalite) {
240
	private function formaterLocalite($infosLocalite) {