Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1321 | Rev 1382 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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