Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 1381 Rev 1382
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
				echo $url;exit;
75
				$donnees = $this->chargerDonnees($url);
75
				$donnees = $this->chargerDonnees($url);
76
				$resultats = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
76
				$resultats = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
77
				$images += $resultats;
77
				$images += $resultats;
78
			}
78
			}
79
		} else {
79
		} else {
80
			$url = $this->getUrlImagesParIdsNoms($idsNoms);
80
			$url = $this->getUrlImagesParIdsNoms($idsNoms);
81
			$donnees = $this->chargerDonnees($url);
81
			$donnees = $this->chargerDonnees($url);
82
			$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
82
			$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
83
		}
83
		}
84
		return $this->formaterResultatImages($images);
84
		return $this->formaterResultatImages($images);
85
	}
85
	}
-
 
86
	
-
 
87
	public function getInfosTrancheImagesParIdsNoms($idNom) {
-
 
88
		$url = $this->getUrlImagesParIdsNoms($idNom, 10);
-
 
89
		$donnees = $this->chargerDonnees($url);
-
 
90
		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
-
 
91
		return $this->formaterResultatImages($images);
-
 
92
	}
86
 
93
 
87
	public function getInfosImageParIdImage($id_image) {
94
	public function getInfosImageParIdImage($id_image) {
88
		$tpl = $this->obtenirSqueletteSelonApi('imagesPopup');
95
		$tpl = $this->obtenirSqueletteSelonApi('imagesPopup');
89
		$url = $this->formaterUrl($tpl, array('id' => $id_image, 'referentiel' => Registre::get('parametres.referentiel')));
96
		$url = $this->formaterUrl($tpl, array('id' => $id_image, 'referentiel' => Registre::get('parametres.referentiel')));
90
		$image = $this->chargerDonnees($url);
97
		$image = $this->chargerDonnees($url);
91
		return $this->formaterResultatImages($image, true);
98
		return $this->formaterResultatImages($image, true);
92
	}
99
	}
93
	
100
	
94
	public function getInfosImages() {
101
	public function getInfosImages() {
95
		$url = $this->getUrlImages();
102
		$url = $this->getUrlImages();
96
		$donnees = $this->chargerDonnees($url);
103
		$donnees = $this->chargerDonnees($url);
97
		$images = (empty($donnees['resultats']) == false) ? $donnees['resultats'] : array();
104
		$images = (empty($donnees['resultats']) == false) ? $donnees['resultats'] : array();
98
		return $this->formaterResultatImages($images);
105
		return $this->formaterResultatImages($images);
99
	}
106
	}
100
 
107
 
101
	public function getInfosImagesTaxons() {
108
	public function getInfosImagesTaxons() {
102
		$pas = 800;
109
		$pas = 800;
103
		$idsTaxons = explode(',', $this->nntaxon);
110
		$idsTaxons = explode(',', $this->nntaxon);
104
		if(count($idsTaxons) >= $pas) {
111
		if(count($idsTaxons) >= $pas) {
105
			$images = array();
112
			$images = array();
106
			$idsPartages = array_chunk($idsTaxons, $pas);
113
			$idsPartages = array_chunk($idsTaxons, $pas);
107
			foreach ($idsPartages as $sousEnsembleIdsTaxons) {
114
			foreach ($idsPartages as $sousEnsembleIdsTaxons) {
108
				$url = $this->getUrlImagesTaxons(implode(',',$sousEnsembleIdsTaxons));
115
				$url = $this->getUrlImagesTaxons(implode(',',$sousEnsembleIdsTaxons));
109
				$donnees = $this->chargerDonnees($url);
116
				$donnees = $this->chargerDonnees($url);
110
				$resultats = (empty($donnees['resultats']) == false) ? $donnees['resultats'] : array();
117
				$resultats = (empty($donnees['resultats']) == false) ? $donnees['resultats'] : array();
111
				$images += $resultats;
118
				$images += $resultats;
112
			}
119
			}
113
		} else {
120
		} else {
114
			$url = $this->getUrlImagesTaxons($idsTaxons);
121
			$url = $this->getUrlImagesTaxons($idsTaxons);
115
			$donnees = $this->chargerDonnees($url);
122
			$donnees = $this->chargerDonnees($url);
116
			$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
123
			$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
117
		}
124
		}
118
		return $this->formaterResultatImages($images);
125
		return $this->formaterResultatImages($images);
119
	}
126
	}
120
 
127
 
121
	public function getInfosPremiereImageParIdsNoms($idsNoms) {
128
	public function getInfosPremiereImageParIdsNoms($idsNoms) {
122
		$url = $this->getUrlPremiereImageParIdsNoms($idsNoms);
129
		$url = $this->getUrlPremiereImageParIdsNoms($idsNoms);
123
		$donnees = $this->chargerDonnees($url);
130
		$donnees = $this->chargerDonnees($url);
124
		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
131
		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
125
		return $this->formaterResultatImages($images);
132
		return $this->formaterResultatImages($images);
126
	}
133
	}
127
 
134
 
128
	public function getInfosImagesGalerieMobile($nn) {
135
	public function getInfosImagesGalerieMobile($nn) {
129
		$url = $this->getUrlImagesGalerieMobile($nn);
136
		$url = $this->getUrlImagesGalerieMobile($nn);
130
		$donnees = $this->chargerDonnees($url);
137
		$donnees = $this->chargerDonnees($url);
131
		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
138
		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
132
		return $images;
139
		return $images;
133
	}
140
	}
134
 
141
 
135
	/**
142
	/**
136
	 * Retourne les $limite images ayant le plus de votes pour CHAQUE tag de $tags pour le protocole $protocole
143
	 * Retourne les $limite images ayant le plus de votes pour CHAQUE tag de $tags pour le protocole $protocole
137
	 */
144
	 */
138
	public function getInfosMeilleuresImagesParTag($nn, $tags, $protocole = Eflore::PROTOCOLE_CAPITALISATION, $limite = 10, $format = 'CRS') {
145
	public function getInfosMeilleuresImagesParTag($nn, $tags, $protocole = Eflore::PROTOCOLE_CAPITALISATION, $limite = 10, $format = 'CRS') {
139
		if (! is_array($tags)) {
146
		if (! is_array($tags)) {
140
			$tags = array($tags);
147
			$tags = array($tags);
141
		}
148
		}
142
		$images_tag = array();
149
		$images_tag = array();
143
		foreach ($tags as $tag) {
150
		foreach ($tags as $tag) {
144
			$url = $this->getUrlMeilleuresImagesParTag($nn, $tag, $protocole, $limite, $format);
151
			$url = $this->getUrlMeilleuresImagesParTag($nn, $tag, $protocole, $limite, $format);
145
			$donnees = $this->chargerDonnees($url);
152
			$donnees = $this->chargerDonnees($url);
146
			$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
153
			$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
147
			$images_tag[$tag] = $this->formaterResultatImagesDel($images);
154
			$images_tag[$tag] = $this->formaterResultatImagesDel($images);
148
		}
155
		}
149
		return $images_tag;
156
		return $images_tag;
150
	}
157
	}
151
 
158
 
152
	/**
159
	/**
153
	 * Retourne l'image ayant le plus de votes pour le pour capitalisation d'images, pour le premier tags de $tags. S'il
160
	 * Retourne l'image ayant le plus de votes pour le pour capitalisation d'images, pour le premier tags de $tags. S'il
154
	 * n'y a aucune image pour le premier tag, parcourt les autres tags jusqu'à en trouver une.
161
	 * n'y a aucune image pour le premier tag, parcourt les autres tags jusqu'à en trouver une.
155
	 */
162
	 */
156
	public function getInfosMeilleureImageParPrioriteTags($nn, $tags, $format = 'CRS') {
163
	public function getInfosMeilleureImageParPrioriteTags($nn, $tags, $format = 'CRS') {
157
		if (! is_array($tags)) {
164
		if (! is_array($tags)) {
158
			$tags = array($tags);
165
			$tags = array($tags);
159
		}
166
		}
160
		$image = null;
167
		$image = null;
161
		foreach ($tags as $tag) {
168
		foreach ($tags as $tag) {
162
			$url = $this->getUrlMeilleuresImagesParTag($nn, $tag, Eflore::PROTOCOLE_CAPITALISATION, 1, $format);
169
			$url = $this->getUrlMeilleuresImagesParTag($nn, $tag, Eflore::PROTOCOLE_CAPITALISATION, 1, $format);
163
			$donnees = $this->chargerDonnees($url);
170
			$donnees = $this->chargerDonnees($url);
164
			$image = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
171
			$image = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
165
			$image = $this->formaterResultatImagesDel($image);
172
			$image = $this->formaterResultatImagesDel($image);
166
			if (empty($image) == false) {
173
			if (empty($image) == false) {
167
				break;
174
				break;
168
			}
175
			}
169
		}
176
		}
170
		//echo "<pre>" . print_r($image, true) . "</pre>";
177
		//echo "<pre>" . print_r($image, true) . "</pre>";
171
		if (is_array($image)) {
178
		if (is_array($image)) {
172
			$image = array_pop($image);
179
			$image = array_pop($image);
173
		}
180
		}
174
		return $image;
181
		return $image;
175
	}
182
	}
176
 
183
 
177
	private function getUrlImagesParIdsNoms($idsNoms) {
184
	private function getUrlImagesParIdsNoms($idsNoms, $limite = 801) {
178
		$tpl = $this->obtenirSqueletteSelonApi('imagesResultatsDetermination');
185
		$tpl = $this->obtenirSqueletteSelonApi('imagesResultatsDetermination');
179
		$params = array('idsNoms' => implode(',', $idsNoms), 'referentiel' => Registre::get('parametres.referentiel'));
186
		$params = array('idsNoms' => implode(',', $idsNoms), 'referentiel' => Registre::get('parametres.referentiel'), 'limite' => $limite);
180
		$url = $this->formaterUrl($tpl, $params);
187
		$url = $this->formaterUrl($tpl, $params);
181
		return $url;
188
		return $url;
182
	}
189
	}
183
 
190
 
184
	public function getUrlPremiereImageParIdsNoms($idsNoms) {
191
	public function getUrlPremiereImageParIdsNoms($idsNoms) {
185
		$tpl = $this->obtenirSqueletteSelonApi('imagesPremiere');
192
		$tpl = $this->obtenirSqueletteSelonApi('imagesPremiere');
186
		$params = array('idsNoms' => implode(',', $idsNoms), 'referentiel' => Registre::get('parametres.referentiel'));
193
		$params = array('idsNoms' => implode(',', $idsNoms), 'referentiel' => Registre::get('parametres.referentiel'));
187
		return $this->formaterUrl($tpl, $params);
194
		return $this->formaterUrl($tpl, $params);
188
	}
195
	}
189
 
196
 
190
	private function getUrlImages($nn = false) {
197
	private function getUrlImages($nn = false) {
191
		$tpl = $this->obtenirSqueletteSelonApi('images');
198
		$tpl = $this->obtenirSqueletteSelonApi('images');
192
		if ($this->getApi() == Eflore::API_EFLORE) {
199
		if ($this->getApi() == Eflore::API_EFLORE) {
193
			$params = array('projet' => $this->getProjet(), 'limite' => $this->limite, 'depart' => $this->depart, 'referentiel' => Registre::get('parametres.referentiel'));
200
			$params = array('projet' => $this->getProjet(), 'limite' => $this->limite, 'depart' => $this->depart, 'referentiel' => Registre::get('parametres.referentiel'));
194
		}
201
		}
195
		$url = $this->formaterUrl($tpl, $params);
202
		$url = $this->formaterUrl($tpl, $params);
196
		return $url;
203
		return $url;
197
	}
204
	}
198
 
205
 
199
	private function getUrlImagesTaxons($idsTaxons) {
206
	private function getUrlImagesTaxons($idsTaxons) {
200
		$tpl = $this->obtenirSqueletteSelonApi('imagesTaxons');
207
		$tpl = $this->obtenirSqueletteSelonApi('imagesTaxons');
201
		$params = array('projet' => $this->getProjet(),'nntaxon'=> $idsTaxons, 'referentiel' => Registre::get('parametres.referentiel'));
208
		$params = array('projet' => $this->getProjet(),'nntaxon'=> $idsTaxons, 'referentiel' => Registre::get('parametres.referentiel'));
202
		$url = $this->formaterUrl($tpl, $params);
209
		$url = $this->formaterUrl($tpl, $params);
203
		return $url;
210
		return $url;
204
	}
211
	}
205
 
212
 
206
	private function getUrlImagesGalerieMobile($nn) {
213
	private function getUrlImagesGalerieMobile($nn) {
207
		$tpl = Config::get('delGalerieMobileTpl');
214
		$tpl = Config::get('delGalerieMobileTpl');
208
		$params = array('nn' => $nn, 'referentiel' => Registre::get('parametres.referentiel'));
215
		$params = array('nn' => $nn, 'referentiel' => Registre::get('parametres.referentiel'));
209
		$url = $this->formaterUrl($tpl, $params);
216
		$url = $this->formaterUrl($tpl, $params);
210
		return $url;
217
		return $url;
211
	}
218
	}
212
 
219
 
213
	private function getUrlMeilleuresImagesParTag($nn, $tag, $protocole = Eflore::PROTOCOLE_CAPITALISATION, $limite = 10, $format = 'CRS') {
220
	private function getUrlMeilleuresImagesParTag($nn, $tag, $protocole = Eflore::PROTOCOLE_CAPITALISATION, $limite = 10, $format = 'CRS') {
214
		$tpl = Config::get('delMeilleuresImagesParTagTpl');
221
		$tpl = Config::get('delMeilleuresImagesParTagTpl');
215
		$params = array('nn'=> $nn,
222
		$params = array('nn'=> $nn,
216
						'tag'=> $tag,
223
						'tag'=> $tag,
217
						'protocole' => $protocole,
224
						'protocole' => $protocole,
218
						'referentiel' => Registre::get('parametres.referentiel'),
225
						'referentiel' => Registre::get('parametres.referentiel'),
219
						'limite' => $limite,
226
						'limite' => $limite,
220
						'format' => $format);
227
						'format' => $format);
221
		$url = $this->formaterUrl($tpl, $params);
228
		$url = $this->formaterUrl($tpl, $params);
222
		return $url;
229
		return $url;
223
	}
230
	}
224
 
231
 
225
	/**
232
	/**
226
	 * Transforme les résultats issus des Webservices autres que eflore/cel afin de conserver un format homogène
233
	 * Transforme les résultats issus des Webservices autres que eflore/cel afin de conserver un format homogène
227
	 * @param mixed $images
234
	 * @param mixed $images
228
	 */
235
	 */
229
	private function formaterResultatImages($images, $seulementUne = false) {
236
	private function formaterResultatImages($images, $seulementUne = false) {
230
		switch ($this->getApi()) {
237
		switch ($this->getApi()) {
231
			case Eflore::API_DEL:
238
			case Eflore::API_DEL:
232
				return $this->formaterResultatImagesDel($images, $seulementUne);
239
				return $this->formaterResultatImagesDel($images, $seulementUne);
233
			break;
240
			break;
234
			default:
241
			default:
235
				return $images;
242
				return $images;
236
		}
243
		}
237
	}
244
	}
238
 
245
 
239
	private function formaterResultatImagesDel($images, $seulementUne = false) {
246
	private function formaterResultatImagesDel($images, $seulementUne = false) {
240
		if ($seulementUne) {
247
		if ($seulementUne) {
241
			return $this->formaterUnResultatImagesDel($images);
248
			return $this->formaterUnResultatImagesDel($images);
242
		} else {
249
		} else {
243
			$retour = array();
250
			$retour = array();
244
			foreach ($images as $idObsImage => $image) {
251
			foreach ($images as $idObsImage => $image) {
245
				$retour[$image['id_image']] = array_merge($images[$idObsImage], $this->formaterUnResultatImagesDel($image));
252
				$retour[$image['id_image']] = array_merge($images[$idObsImage], $this->formaterUnResultatImagesDel($image));
246
			}
253
			}
247
			return $retour;
254
			return $retour;
248
		}
255
		}
249
	}
256
	}
250
 
257
 
251
	/**
258
	/**
252
	 * Convertit un array venant d'un Webservice del vers le format retourné par eflore/cel
259
	 * Convertit un array venant d'un Webservice del vers le format retourné par eflore/cel
253
	 * @param array $image
260
	 * @param array $image
254
	 * @return array
261
	 * @return array
255
	 */
262
	 */
256
	private function formaterUnResultatImagesDel(array $image) {
263
	private function formaterUnResultatImagesDel(array $image) {
257
		$libelleAuteur = $image['observation']['auteur.prenom'].' '.$image['observation']['auteur.nom'];
264
		$libelleAuteur = $image['observation']['auteur.prenom'].' '.$image['observation']['auteur.nom'];
258
		$codeReferentiel = substr($image['observation']['determination.referentiel'], 0, strpos($image['observation']['determination.referentiel'], ':'));
265
		$codeReferentiel = substr($image['observation']['determination.referentiel'], 0, strpos($image['observation']['determination.referentiel'], ':'));
259
		$localiteLibelle = array($image['observation']['zone_geo'],
266
		$localiteLibelle = array($image['observation']['zone_geo'],
260
				$image['observation']['lieudit'],
267
				$image['observation']['lieudit'],
261
				$image['observation']['station'],
268
				$image['observation']['station'],
262
				$image['observation']['milieu']);
269
				$image['observation']['milieu']);
263
		$retourImage = array(
270
		$retourImage = array(
264
				'date' => $image['observation']['date_observation'],
271
				'date' => $image['observation']['date_observation'],
265
				'mime' => 'image/jpeg',
272
				'mime' => 'image/jpeg',
266
				'auteur.libelle' => $libelleAuteur,
273
				'auteur.libelle' => $libelleAuteur,
267
				'auteur.id' => $image['observation']['auteur.id'],
274
				'auteur.id' => $image['observation']['auteur.id'],
268
				'binaire.href' => $image['binaire.href'],
275
				'binaire.href' => $image['binaire.href'],
269
				'observation.id' => $image['observation']['id_observation'],
276
				'observation.id' => $image['observation']['id_observation'],
270
				'determination.libelle' => $image['observation']['determination.ns'].'[Dét. : '.$libelleAuteur.']',
277
				'determination.libelle' => $image['observation']['determination.ns'].'[Dét. : '.$libelleAuteur.']',
271
				'determination.nom_sci' => $image['observation']['determination.ns'],
278
				'determination.nom_sci' => $image['observation']['determination.ns'],
272
				'determination.nom_sci.code' => $codeReferentiel.'.'.$image['observation']['determination.nn'],
279
				'determination.nom_sci.code' => $codeReferentiel.'.'.$image['observation']['determination.nn'],
273
				'station.commune' => $image['observation']['zone_geo'],
280
				'station.commune' => $image['observation']['zone_geo'],
274
				'station.lieudit' => $image['observation']['lieudit'],
281
				'station.lieudit' => $image['observation']['lieudit'],
275
				'station.station' => $image['observation']['station'],
282
				'station.station' => $image['observation']['station'],
276
				'station.milieu' => $image['observation']['milieu'],
283
				'station.milieu' => $image['observation']['milieu'],
277
				'station.libelle' => $this->formaterLocalite($localiteLibelle)
284
				'station.libelle' => $this->formaterLocalite($localiteLibelle)
278
		);
285
		);
279
		return $retourImage;
286
		return $retourImage;
280
	}
287
	}
281
	
288
	
282
	private function formaterLocalite($infosLocalite) {
289
	private function formaterLocalite($infosLocalite) {
283
		$localiteFmt = array();
290
		$localiteFmt = array();
284
		foreach ($infosLocalite as $localite) {
291
		foreach ($infosLocalite as $localite) {
285
			if($localite != '') {
292
			if($localite != '') {
286
				$localiteFmt[] = $localite;
293
				$localiteFmt[] = $localite;
287
			}
294
			}
288
		}
295
		}
289
		if (empty($localiteFmt)) {
296
		if (empty($localiteFmt)) {
290
			$localiteFmt[0] = 'localité inconnue';
297
			$localiteFmt[0] = 'localité inconnue';
291
		}
298
		}
292
		return implode(" > ", $localiteFmt);
299
		return implode(" > ", $localiteFmt);
293
	}
300
	}
294
}
301
}
295
?>
302
?>