| 130 | jpm | 1 | <?php
 | 
        
           |  |  | 2 | // declare(encoding='UTF-8');
 | 
        
           |  |  | 3 | /**
 | 
        
           |  |  | 4 |  * Classe gérant les images.
 | 
        
           |  |  | 5 |  *
 | 
        
           |  |  | 6 |  * @category	PHP 5.2
 | 
        
           |  |  | 7 |  * @package		eflore-consultation
 | 
        
           |  |  | 8 |  * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
 | 
        
           |  |  | 9 |  * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
 | 
        
           |  |  | 10 |  * @copyright	2011 Tela-Botanica
 | 
        
           |  |  | 11 |  * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
 | 
        
           |  |  | 12 |  * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
 | 
        
           |  |  | 13 |  * @version		$Id$
 | 
        
           |  |  | 14 |  */
 | 
        
           |  |  | 15 | class Images extends Eflore {
 | 
        
           | 624 | mathilde | 16 |   | 
        
           |  |  | 17 | 	private $nntaxon;
 | 
        
           |  |  | 18 | 	private $limite;
 | 
        
           |  |  | 19 | 	private $depart;
 | 
        
           | 495 | jpm | 20 |   | 
        
           | 624 | mathilde | 21 | 	public function setNnTaxon($nntax) {
 | 
        
           |  |  | 22 | 		$this->nntaxon = $nntax;
 | 
        
           |  |  | 23 | 	}
 | 
        
           |  |  | 24 |   | 
        
           |  |  | 25 | 	public function setLimite($limite) {
 | 
        
           |  |  | 26 | 		$this->limite = $limite;
 | 
        
           |  |  | 27 | 	}
 | 
        
           |  |  | 28 |   | 
        
           |  |  | 29 | 	public function setDepart($depart) {
 | 
        
           |  |  | 30 | 		$this->depart = $depart;
 | 
        
           |  |  | 31 | 	}
 | 
        
           |  |  | 32 |   | 
        
           | 339 | aurelien | 33 | 	//TODO: créer des fonctions spécifiques cel et photoflora pour plus de clarté ?
 | 
        
           | 130 | jpm | 34 | 	public function getUrlsImagesParIdsNoms(Array $idsNoms) {
 | 
        
           |  |  | 35 | 		$infosImages = $this->getInfosImagesParIdsNoms($idsNoms);
 | 
        
           |  |  | 36 | 		$urls = array();
 | 
        
           | 509 | jpm | 37 | 		if (count($infosImages) > 0) {
 | 
        
           |  |  | 38 | 			foreach ($infosImages as $img) {
 | 
        
           |  |  | 39 | 				$id = $img['determination.nom_sci.code'];
 | 
        
           |  |  | 40 | 				$urls[$id][] = $img['binaire.href'];
 | 
        
           |  |  | 41 | 			}
 | 
        
           | 130 | jpm | 42 | 		}
 | 
        
           |  |  | 43 | 		return $urls;
 | 
        
           |  |  | 44 | 	}
 | 
        
           |  |  | 45 |   | 
        
           | 1136 | mathias | 46 | 	// retourne les urls d'une série d'images tirées de del, avec en premier les
 | 
        
           |  |  | 47 | 	// images d'organes les mieux votées, et ensuite toute les autres images disponibles
 | 
        
           |  |  | 48 | 	public function getUrlsImagesOrganesParIdsNom($idNom) {
 | 
        
           |  |  | 49 | 		$infosImages0 = $this->getInfosMeilleuresImagesParTag($idNom, array('fleur', 'feuille', 'fruit', 'ecorce', 'port', 'rameau'), Eflore::PROTOCOLE_CAPITALISATION, 6);
 | 
        
           |  |  | 50 | 		$infosImages1 = $this->getInfosImagesParIdsNoms(array($idNom));
 | 
        
           |  |  | 51 | 		$urls = array();
 | 
        
           |  |  | 52 | 		foreach ($infosImages0 as $imgs) {
 | 
        
           |  |  | 53 | 			foreach ($imgs as $img) {
 | 
        
           |  |  | 54 | 				$id = $img['determination.nom_sci.code'];
 | 
        
           |  |  | 55 | 				$urls[$id][] = $img['binaire.href'];
 | 
        
           |  |  | 56 | 			}
 | 
        
           |  |  | 57 | 		}
 | 
        
           |  |  | 58 | 		foreach ($infosImages1 as $img) {
 | 
        
           |  |  | 59 | 			$id = $img['determination.nom_sci.code'];
 | 
        
           |  |  | 60 | 			if (! in_array($img['binaire.href'], $urls[$id])) {
 | 
        
           |  |  | 61 | 				$urls[$id][] = $img['binaire.href'];
 | 
        
           |  |  | 62 | 			}
 | 
        
           |  |  | 63 | 		}
 | 
        
           |  |  | 64 | 		return $urls;
 | 
        
           |  |  | 65 | 	}
 | 
        
           |  |  | 66 |   | 
        
           | 130 | jpm | 67 | 	public function getInfosImagesParIdsNoms(Array $idsNoms) {
 | 
        
           | 898 | aurelien | 68 | 		$pas = 800;
 | 
        
           |  |  | 69 | 		if(count($idsNoms) >= $pas) {
 | 
        
           |  |  | 70 | 			$images = array();
 | 
        
           |  |  | 71 | 			$idsPartages = array_chunk($idsNoms, $pas);
 | 
        
           |  |  | 72 | 			foreach ($idsPartages as $sousEnsembleIdsNoms) {
 | 
        
           |  |  | 73 | 				$url = $this->getUrlImagesParIdsNoms($sousEnsembleIdsNoms);
 | 
        
           |  |  | 74 | 				$donnees = $this->chargerDonnees($url);
 | 
        
           |  |  | 75 | 				$resultats = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
 | 
        
           |  |  | 76 | 				$images += $resultats;
 | 
        
           |  |  | 77 | 			}
 | 
        
           |  |  | 78 | 		} else {
 | 
        
           |  |  | 79 | 			$url = $this->getUrlImagesParIdsNoms($idsNoms);
 | 
        
           |  |  | 80 | 			$donnees = $this->chargerDonnees($url);
 | 
        
           |  |  | 81 | 			$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
 | 
        
           |  |  | 82 | 		}
 | 
        
           | 1115 | mathias | 83 | 		return $this->formaterResultatImages($images);
 | 
        
           | 130 | jpm | 84 | 	}
 | 
        
           | 1382 | aurelien | 85 |   | 
        
           | 1383 | aurelien | 86 | 	public function getInfosTrancheImagesParIdsNoms($idNom, $limite = 12) {
 | 
        
           | 1467 | mathias | 87 | 		// 12 fait 4 lignes de 3 images donc bien pour l'affichage
 | 
        
           |  |  | 88 | 		$url = $this->getUrlImagesParIdsNoms($idNom, $limite);
 | 
        
           |  |  | 89 | 		$donnees = $this->chargerDonnees($url);
 | 
        
           |  |  | 90 | 		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
 | 
        
           |  |  | 91 | 		return $this->formaterResultatImages($images);
 | 
        
           | 1382 | aurelien | 92 | 	}
 | 
        
           | 495 | jpm | 93 |   | 
        
           | 475 | delphine | 94 | 	public function getInfosImageParIdImage($id_image) {
 | 
        
           | 1115 | mathias | 95 | 		$tpl = $this->obtenirSqueletteSelonApi('imagesPopup');
 | 
        
           | 947 | aurelien | 96 | 		$url = $this->formaterUrl($tpl, array('id' => $id_image, 'referentiel' => Registre::get('parametres.referentiel')));
 | 
        
           | 1115 | mathias | 97 | 		$image = $this->chargerDonnees($url);
 | 
        
           |  |  | 98 | 		return $this->formaterResultatImages($image, true);
 | 
        
           | 475 | delphine | 99 | 	}
 | 
        
           | 624 | mathilde | 100 |   | 
        
           |  |  | 101 | 	public function getInfosImages() {
 | 
        
           |  |  | 102 | 		$url = $this->getUrlImages();
 | 
        
           | 1115 | mathias | 103 | 		$donnees = $this->chargerDonnees($url);
 | 
        
           | 624 | mathilde | 104 | 		$images = (empty($donnees['resultats']) == false) ? $donnees['resultats'] : array();
 | 
        
           | 1115 | mathias | 105 | 		return $this->formaterResultatImages($images);
 | 
        
           | 624 | mathilde | 106 | 	}
 | 
        
           | 898 | aurelien | 107 |   | 
        
           | 624 | mathilde | 108 | 	public function getInfosImagesTaxons() {
 | 
        
           | 898 | aurelien | 109 | 		$pas = 800;
 | 
        
           |  |  | 110 | 		$idsTaxons = explode(',', $this->nntaxon);
 | 
        
           |  |  | 111 | 		if(count($idsTaxons) >= $pas) {
 | 
        
           |  |  | 112 | 			$images = array();
 | 
        
           |  |  | 113 | 			$idsPartages = array_chunk($idsTaxons, $pas);
 | 
        
           |  |  | 114 | 			foreach ($idsPartages as $sousEnsembleIdsTaxons) {
 | 
        
           |  |  | 115 | 				$url = $this->getUrlImagesTaxons(implode(',',$sousEnsembleIdsTaxons));
 | 
        
           |  |  | 116 | 				$donnees = $this->chargerDonnees($url);
 | 
        
           |  |  | 117 | 				$resultats = (empty($donnees['resultats']) == false) ? $donnees['resultats'] : array();
 | 
        
           |  |  | 118 | 				$images += $resultats;
 | 
        
           |  |  | 119 | 			}
 | 
        
           |  |  | 120 | 		} else {
 | 
        
           |  |  | 121 | 			$url = $this->getUrlImagesTaxons($idsTaxons);
 | 
        
           |  |  | 122 | 			$donnees = $this->chargerDonnees($url);
 | 
        
           |  |  | 123 | 			$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
 | 
        
           |  |  | 124 | 		}
 | 
        
           | 1115 | mathias | 125 | 		return $this->formaterResultatImages($images);
 | 
        
           |  |  | 126 | 	}
 | 
        
           |  |  | 127 |   | 
        
           |  |  | 128 | 	public function getInfosPremiereImageParIdsNoms($idsNoms) {
 | 
        
           |  |  | 129 | 		$url = $this->getUrlPremiereImageParIdsNoms($idsNoms);
 | 
        
           |  |  | 130 | 		$donnees = $this->chargerDonnees($url);
 | 
        
           |  |  | 131 | 		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
 | 
        
           |  |  | 132 | 		return $this->formaterResultatImages($images);
 | 
        
           |  |  | 133 | 	}
 | 
        
           |  |  | 134 |   | 
        
           |  |  | 135 | 	public function getInfosImagesGalerieMobile($nn) {
 | 
        
           |  |  | 136 | 		$url = $this->getUrlImagesGalerieMobile($nn);
 | 
        
           |  |  | 137 | 		$donnees = $this->chargerDonnees($url);
 | 
        
           |  |  | 138 | 		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
 | 
        
           | 624 | mathilde | 139 | 		return $images;
 | 
        
           |  |  | 140 | 	}
 | 
        
           | 1115 | mathias | 141 |   | 
        
           | 1116 | mathias | 142 | 	/**
 | 
        
           | 1136 | mathias | 143 | 	 * Retourne les $limite images ayant le plus de votes pour CHAQUE tag de $tags pour le protocole $protocole
 | 
        
           | 1116 | mathias | 144 | 	 */
 | 
        
           | 1123 | mathias | 145 | 	public function getInfosMeilleuresImagesParTag($nn, $tags, $protocole = Eflore::PROTOCOLE_CAPITALISATION, $limite = 10, $format = 'CRS') {
 | 
        
           | 1116 | mathias | 146 | 		if (! is_array($tags)) {
 | 
        
           |  |  | 147 | 			$tags = array($tags);
 | 
        
           |  |  | 148 | 		}
 | 
        
           |  |  | 149 | 		$images_tag = array();
 | 
        
           |  |  | 150 | 		foreach ($tags as $tag) {
 | 
        
           | 1123 | mathias | 151 | 			$url = $this->getUrlMeilleuresImagesParTag($nn, $tag, $protocole, $limite, $format);
 | 
        
           | 1116 | mathias | 152 | 			$donnees = $this->chargerDonnees($url);
 | 
        
           |  |  | 153 | 			$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
 | 
        
           | 1123 | mathias | 154 | 			$images_tag[$tag] = $this->formaterResultatImagesDel($images);
 | 
        
           | 1116 | mathias | 155 | 		}
 | 
        
           |  |  | 156 | 		return $images_tag;
 | 
        
           |  |  | 157 | 	}
 | 
        
           |  |  | 158 |   | 
        
           | 1136 | mathias | 159 | 	/**
 | 
        
           |  |  | 160 | 	 * Retourne l'image ayant le plus de votes pour le pour capitalisation d'images, pour le premier tags de $tags. S'il
 | 
        
           |  |  | 161 | 	 * n'y a aucune image pour le premier tag, parcourt les autres tags jusqu'à en trouver une.
 | 
        
           |  |  | 162 | 	 */
 | 
        
           |  |  | 163 | 	public function getInfosMeilleureImageParPrioriteTags($nn, $tags, $format = 'CRS') {
 | 
        
           |  |  | 164 | 		if (! is_array($tags)) {
 | 
        
           |  |  | 165 | 			$tags = array($tags);
 | 
        
           |  |  | 166 | 		}
 | 
        
           |  |  | 167 | 		$image = null;
 | 
        
           |  |  | 168 | 		foreach ($tags as $tag) {
 | 
        
           |  |  | 169 | 			$url = $this->getUrlMeilleuresImagesParTag($nn, $tag, Eflore::PROTOCOLE_CAPITALISATION, 1, $format);
 | 
        
           |  |  | 170 | 			$donnees = $this->chargerDonnees($url);
 | 
        
           |  |  | 171 | 			$image = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
 | 
        
           |  |  | 172 | 			$image = $this->formaterResultatImagesDel($image);
 | 
        
           |  |  | 173 | 			if (empty($image) == false) {
 | 
        
           |  |  | 174 | 				break;
 | 
        
           |  |  | 175 | 			}
 | 
        
           |  |  | 176 | 		}
 | 
        
           |  |  | 177 | 		//echo "<pre>" . print_r($image, true) . "</pre>";
 | 
        
           |  |  | 178 | 		if (is_array($image)) {
 | 
        
           |  |  | 179 | 			$image = array_pop($image);
 | 
        
           |  |  | 180 | 		}
 | 
        
           |  |  | 181 | 		return $image;
 | 
        
           |  |  | 182 | 	}
 | 
        
           |  |  | 183 |   | 
        
           | 1382 | aurelien | 184 | 	private function getUrlImagesParIdsNoms($idsNoms, $limite = 801) {
 | 
        
           | 1115 | mathias | 185 | 		$tpl = $this->obtenirSqueletteSelonApi('imagesResultatsDetermination');
 | 
        
           | 1382 | aurelien | 186 | 		$params = array('idsNoms' => implode(',', $idsNoms), 'referentiel' => Registre::get('parametres.referentiel'), 'limite' => $limite);
 | 
        
           | 130 | jpm | 187 | 		$url = $this->formaterUrl($tpl, $params);
 | 
        
           |  |  | 188 | 		return $url;
 | 
        
           |  |  | 189 | 	}
 | 
        
           | 495 | jpm | 190 |   | 
        
           | 1127 | mathias | 191 | 	public function getUrlPremiereImageParIdsNoms($idsNoms) {
 | 
        
           | 1115 | mathias | 192 | 		$tpl = $this->obtenirSqueletteSelonApi('imagesPremiere');
 | 
        
           | 947 | aurelien | 193 | 		$params = array('idsNoms' => implode(',', $idsNoms), 'referentiel' => Registre::get('parametres.referentiel'));
 | 
        
           | 1403 | mathias | 194 | 		$url = $this->formaterUrl($tpl, $params);
 | 
        
           |  |  | 195 | 		return $url;
 | 
        
           | 414 | delphine | 196 | 	}
 | 
        
           | 1115 | mathias | 197 |   | 
        
           |  |  | 198 | 	private function getUrlImages($nn = false) {
 | 
        
           |  |  | 199 | 		$tpl = $this->obtenirSqueletteSelonApi('images');
 | 
        
           |  |  | 200 | 		if ($this->getApi() == Eflore::API_EFLORE) {
 | 
        
           |  |  | 201 | 			$params = array('projet' => $this->getProjet(), 'limite' => $this->limite, 'depart' => $this->depart, 'referentiel' => Registre::get('parametres.referentiel'));
 | 
        
           |  |  | 202 | 		}
 | 
        
           | 624 | mathilde | 203 | 		$url = $this->formaterUrl($tpl, $params);
 | 
        
           |  |  | 204 | 		return $url;
 | 
        
           |  |  | 205 | 	}
 | 
        
           | 1115 | mathias | 206 |   | 
        
           | 898 | aurelien | 207 | 	private function getUrlImagesTaxons($idsTaxons) {
 | 
        
           | 1115 | mathias | 208 | 		$tpl = $this->obtenirSqueletteSelonApi('imagesTaxons');
 | 
        
           | 947 | aurelien | 209 | 		$params = array('projet' => $this->getProjet(),'nntaxon'=> $idsTaxons, 'referentiel' => Registre::get('parametres.referentiel'));
 | 
        
           | 624 | mathilde | 210 | 		$url = $this->formaterUrl($tpl, $params);
 | 
        
           |  |  | 211 | 		return $url;
 | 
        
           |  |  | 212 | 	}
 | 
        
           | 1115 | mathias | 213 |   | 
        
           |  |  | 214 | 	private function getUrlImagesGalerieMobile($nn) {
 | 
        
           |  |  | 215 | 		$tpl = Config::get('delGalerieMobileTpl');
 | 
        
           | 1321 | mathias | 216 | 		$params = array('nn' => $nn, 'referentiel' => Registre::get('parametres.referentiel'));
 | 
        
           | 1115 | mathias | 217 | 		$url = $this->formaterUrl($tpl, $params);
 | 
        
           |  |  | 218 | 		return $url;
 | 
        
           |  |  | 219 | 	}
 | 
        
           |  |  | 220 |   | 
        
           | 1123 | mathias | 221 | 	private function getUrlMeilleuresImagesParTag($nn, $tag, $protocole = Eflore::PROTOCOLE_CAPITALISATION, $limite = 10, $format = 'CRS') {
 | 
        
           | 1116 | mathias | 222 | 		$tpl = Config::get('delMeilleuresImagesParTagTpl');
 | 
        
           |  |  | 223 | 		$params = array('nn'=> $nn,
 | 
        
           |  |  | 224 | 						'tag'=> $tag,
 | 
        
           |  |  | 225 | 						'protocole' => $protocole,
 | 
        
           |  |  | 226 | 						'referentiel' => Registre::get('parametres.referentiel'),
 | 
        
           | 1123 | mathias | 227 | 						'limite' => $limite,
 | 
        
           |  |  | 228 | 						'format' => $format);
 | 
        
           | 1116 | mathias | 229 | 		$url = $this->formaterUrl($tpl, $params);
 | 
        
           |  |  | 230 | 		return $url;
 | 
        
           |  |  | 231 | 	}
 | 
        
           |  |  | 232 |   | 
        
           | 1115 | mathias | 233 | 	/**
 | 
        
           |  |  | 234 | 	 * Transforme les résultats issus des Webservices autres que eflore/cel afin de conserver un format homogène
 | 
        
           |  |  | 235 | 	 * @param mixed $images
 | 
        
           |  |  | 236 | 	 */
 | 
        
           |  |  | 237 | 	private function formaterResultatImages($images, $seulementUne = false) {
 | 
        
           |  |  | 238 | 		switch ($this->getApi()) {
 | 
        
           |  |  | 239 | 			case Eflore::API_DEL:
 | 
        
           |  |  | 240 | 				return $this->formaterResultatImagesDel($images, $seulementUne);
 | 
        
           |  |  | 241 | 			break;
 | 
        
           |  |  | 242 | 			default:
 | 
        
           |  |  | 243 | 				return $images;
 | 
        
           |  |  | 244 | 		}
 | 
        
           |  |  | 245 | 	}
 | 
        
           |  |  | 246 |   | 
        
           |  |  | 247 | 	private function formaterResultatImagesDel($images, $seulementUne = false) {
 | 
        
           |  |  | 248 | 		if ($seulementUne) {
 | 
        
           |  |  | 249 | 			return $this->formaterUnResultatImagesDel($images);
 | 
        
           |  |  | 250 | 		} else {
 | 
        
           |  |  | 251 | 			$retour = array();
 | 
        
           |  |  | 252 | 			foreach ($images as $idObsImage => $image) {
 | 
        
           |  |  | 253 | 				$retour[$image['id_image']] = array_merge($images[$idObsImage], $this->formaterUnResultatImagesDel($image));
 | 
        
           |  |  | 254 | 			}
 | 
        
           |  |  | 255 | 			return $retour;
 | 
        
           |  |  | 256 | 		}
 | 
        
           |  |  | 257 | 	}
 | 
        
           |  |  | 258 |   | 
        
           |  |  | 259 | 	/**
 | 
        
           |  |  | 260 | 	 * Convertit un array venant d'un Webservice del vers le format retourné par eflore/cel
 | 
        
           |  |  | 261 | 	 * @param array $image
 | 
        
           |  |  | 262 | 	 * @return array
 | 
        
           |  |  | 263 | 	 */
 | 
        
           |  |  | 264 | 	private function formaterUnResultatImagesDel(array $image) {
 | 
        
           |  |  | 265 | 		$libelleAuteur = $image['observation']['auteur.prenom'].' '.$image['observation']['auteur.nom'];
 | 
        
           | 1467 | mathias | 266 | 		$codeReferentiel = $image['observation']['determination.referentiel'];
 | 
        
           |  |  | 267 | 		if (strpos($codeReferentiel, ':') !== false) {
 | 
        
           |  |  | 268 | 			$codeReferentiel = substr($image['observation']['determination.referentiel'], 0, strpos($image['observation']['determination.referentiel'], ':'));
 | 
        
           |  |  | 269 | 		}
 | 
        
           | 1115 | mathias | 270 | 		$localiteLibelle = array($image['observation']['zone_geo'],
 | 
        
           |  |  | 271 | 				$image['observation']['lieudit'],
 | 
        
           |  |  | 272 | 				$image['observation']['station'],
 | 
        
           |  |  | 273 | 				$image['observation']['milieu']);
 | 
        
           |  |  | 274 | 		$retourImage = array(
 | 
        
           |  |  | 275 | 				'date' => $image['observation']['date_observation'],
 | 
        
           |  |  | 276 | 				'mime' => 'image/jpeg',
 | 
        
           |  |  | 277 | 				'auteur.libelle' => $libelleAuteur,
 | 
        
           |  |  | 278 | 				'auteur.id' => $image['observation']['auteur.id'],
 | 
        
           |  |  | 279 | 				'binaire.href' => $image['binaire.href'],
 | 
        
           |  |  | 280 | 				'observation.id' => $image['observation']['id_observation'],
 | 
        
           |  |  | 281 | 				'determination.libelle' => $image['observation']['determination.ns'].'[Dét. : '.$libelleAuteur.']',
 | 
        
           |  |  | 282 | 				'determination.nom_sci' => $image['observation']['determination.ns'],
 | 
        
           |  |  | 283 | 				'determination.nom_sci.code' => $codeReferentiel.'.'.$image['observation']['determination.nn'],
 | 
        
           |  |  | 284 | 				'station.commune' => $image['observation']['zone_geo'],
 | 
        
           |  |  | 285 | 				'station.lieudit' => $image['observation']['lieudit'],
 | 
        
           |  |  | 286 | 				'station.station' => $image['observation']['station'],
 | 
        
           |  |  | 287 | 				'station.milieu' => $image['observation']['milieu'],
 | 
        
           |  |  | 288 | 				'station.libelle' => $this->formaterLocalite($localiteLibelle)
 | 
        
           |  |  | 289 | 		);
 | 
        
           |  |  | 290 | 		return $retourImage;
 | 
        
           |  |  | 291 | 	}
 | 
        
           |  |  | 292 |   | 
        
           |  |  | 293 | 	private function formaterLocalite($infosLocalite) {
 | 
        
           |  |  | 294 | 		$localiteFmt = array();
 | 
        
           |  |  | 295 | 		foreach ($infosLocalite as $localite) {
 | 
        
           |  |  | 296 | 			if($localite != '') {
 | 
        
           |  |  | 297 | 				$localiteFmt[] = $localite;
 | 
        
           |  |  | 298 | 			}
 | 
        
           |  |  | 299 | 		}
 | 
        
           |  |  | 300 | 		if (empty($localiteFmt)) {
 | 
        
           |  |  | 301 | 			$localiteFmt[0] = 'localité inconnue';
 | 
        
           |  |  | 302 | 		}
 | 
        
           |  |  | 303 | 		return implode(" > ", $localiteFmt);
 | 
        
           |  |  | 304 | 	}
 | 
        
           | 130 | jpm | 305 | }
 | 
        
           |  |  | 306 | ?>
 |