Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 1273 Rev 1281
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe mère du module Liste.
4
 * Classe mère du module Liste.
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 Illustrations extends aControleur {
15
class Illustrations extends aControleur {
16
 
16
 
17
	private $conteneur = null;
17
	private $conteneur = null;
18
	private $nomCourant = null;
18
	private $nomCourant = null;
19
	private $images = null;
19
	private $images = null;
20
	private $appUrls = null;
20
	private $appUrls = null;
21
	private $meta = null;
21
	private $meta = null;
22
	private $referentiel = 'bdtfx';
22
	private $referentiel = 'bdtfx';
23
	private $donnees = array();
23
	private $donnees = array();
24
 
24
 
25
	public function __construct(Conteneur $conteneur) {
25
	public function __construct(Conteneur $conteneur) {
26
		$this->conteneur = $conteneur;
26
		$this->conteneur = $conteneur;
27
		$this->nomCourant = $this->conteneur->getNomCourant();
27
		$this->nomCourant = $this->conteneur->getNomCourant();
28
		$this->referentiel = $this->conteneur->getParametre('referentiel');
28
		$this->referentiel = $this->conteneur->getParametre('referentiel');
29
		$this->images = $this->conteneur->getApiImages();
29
		$this->images = $this->conteneur->getApiImages();
30
		$this->appUrls = $this->conteneur->getAppUrls();
30
		$this->appUrls = $this->conteneur->getAppUrls();
31
		$this->meta = $this->conteneur->getApiMetaDonnees();
31
		$this->meta = $this->conteneur->getApiMetaDonnees();
32
	}
32
	}
33
 
33
 
34
	public function obtenirDonnees() {
34
	public function obtenirDonnees() {
35
		$this->donnees['nt'] = $this->nomCourant->getNt();
35
		$this->donnees['nt'] = $this->nomCourant->getNt();
36
		$this->donnees['nnr'] = $this->nomCourant->getNnr();
36
		$this->donnees['nnr'] = $this->nomCourant->getNnr();
37
		$this->donnees['referentiel'] = $this->referentiel;
37
		$this->donnees['referentiel'] = $this->referentiel;
38
		$this->donnees['nomSciRetenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html');
38
		$this->donnees['nomSciRetenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html');
39
		$infosNomRetenu = $this->nomCourant->getNomRetenu()->getInfos();
39
		$infosNomRetenu = $this->nomCourant->getNomRetenu()->getInfos();
40
		$this->donnees['nomComplet'] = $infosNomRetenu['nom_complet'];
40
		$this->donnees['nomComplet'] = $infosNomRetenu['nom_complet'];
41
		$this->getPhotos();
41
		$this->getPhotos();
42
		$this->getDessin();
42
		$this->getDessin();
43
		//$this->getPhotosOrganes();
-
 
-
 
43
		
44
		$this->getPhotosCaracteresIdentification();
44
		$this->getPhotosCaracteresIdentification();
45
		$pso = $this->getPhotosSixOrganes();
45
		$pso = $this->getPhotosSixOrganes();
-
 
46
		
46
		// reconstruction de getPhotosOrganes à partir des données de getPhotosSixOrganes
47
		// Le framework n'avait pas prévu l'inclusion de sous squelettes dans les modules
47
		/*$this->donnees['organes'] = array();
-
 
48
		foreach ($pso as $organe => $images) {
48
		// en attendant, on utilise un chemin complet vers le fichier de squelette
49
			$clefs = array_keys($images);
-
 
50
			$image = $images[$clefs[0]];
-
 
51
			// changement de format - en dur, cracra !
49
		$chemin_sous_squelette = Config::get('chemin_modules').AppControleur::getNomDossierDepuisClasse('Fiche').DS.Config::get('dossier_squelettes').DS;
52
			$image['binaire.href'] = str_replace('CRX2S', 'CRS', $image['binaire.href']);
50
		$params = array('organes' => $pso, 'referentiel' => $this->referentiel, 
53
			$this->donnees['organes'][$organe] = $image;
51
						'nnr' => $this->donnees['nnr'], 
54
		}*/
-
 
55
		// --
-
 
56
		$this->setCheminSquelette('modules/fiche/squelettes/'); // @FIXME le chemin devrait déjà être défini correctement !?
-
 
57
		$params = array('organes' => $pso, 'referentiel' => $this->referentiel, 'nnr' => $this->donnees['nnr'], 'nomComplet' => $this->donnees['nomComplet']);
52
						'nomComplet' => $this->donnees['nomComplet']);
58
		$this->donnees['illustrationsOrganes'] = $this->getVue('fiche_illustrations_organes',$params);
53
		$this->donnees['illustrationsOrganes'] = $this->getVue($chemin_sous_squelette.'fiche_illustrations_organes.tpl.html',$params);
59
		
54
		
60
		// chemins
55
		// chemins
61
		$this->donnees['base_url_widget_saisie'] = Config::get('base_url_widget_saisie');
56
		$this->donnees['base_url_widget_saisie'] = Config::get('base_url_widget_saisie');
62
		$this->donnees['base_url_del'] = Config::get('base_url_del');
57
		$this->donnees['base_url_del'] = Config::get('base_url_del');
63
		return $this->donnees;
58
		return $this->donnees;
64
	}
59
	}
65
	
60
	
66
	public function obtenirDonneesExport() {
61
	public function obtenirDonneesExport() {
67
		$this->donnees['nt'] = $this->nomCourant->getNt();
62
		$this->donnees['nt'] = $this->nomCourant->getNt();
68
		$this->donnees['nomSciRetenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html');
63
		$this->donnees['nomSciRetenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html');
69
		$this->donnees['cel'] = $this->getCelExport();
64
		$this->donnees['cel'] = $this->getCelExport();
70
		$this->donnees['coste'] = $this->getCoste();
65
		$this->donnees['coste'] = $this->getCoste();
71
		return $this->donnees;
66
		return $this->donnees;
72
	}
67
	}
73
 
68
 
74
	public function getBloc() {
69
	public function getBloc() {
75
		$this->donnees = $this->images->getInfosMeilleureImageParPrioriteTags($nnr = $this->nomCourant->getNnr(), array(
70
		$this->donnees = $this->images->getInfosMeilleureImageParPrioriteTags($nnr = $this->nomCourant->getNnr(), array(
76
				'fleur', 'feuille', 'fruit', 'ecorce', 'port', 'rameau'));
71
				'fleur', 'feuille', 'fruit', 'ecorce', 'port', 'rameau'));
77
		if (empty($this->donnees)) {
72
		if (empty($this->donnees)) {
78
			$this->donnees = $this->getPhoto('cel');
73
			$this->donnees = $this->getPhoto('cel');
79
			if (empty($this->donnees)) {
74
			if (empty($this->donnees)) {
80
				$infos_image = $this->getDessin();
75
				$infos_image = $this->getDessin();
81
				if (empty($infos_image) == false ) {
76
				if (empty($infos_image) == false ) {
82
					$this->donnees['imageUrl'] =  array_shift($infos_image['images']);
77
					$this->donnees['imageUrl'] =  array_shift($infos_image['images']);
83
				}
78
				}
84
			}
79
			}
85
		} else {
80
		} else {
86
			// extraction de l'url
81
			// extraction de l'url
87
			$this->donnees = array('imageUrl' => $this->donnees['binaire.href']);
82
			$this->donnees = array('imageUrl' => $this->donnees['binaire.href']);
88
		}
83
		}
89
		if (empty($this->donnees)) {
84
		if (empty($this->donnees)) {
90
			$this->donnees = $this->getPhoto('photoflora');
85
			$this->donnees = $this->getPhoto('photoflora');
91
		}
86
		}
92
		return $this->donnees;
87
		return $this->donnees;
93
	}
88
	}
94
	
89
	
95
	
90
	
96
	public function getPhoto($source) {
91
	public function getPhoto($source) {
97
		$donnees = array();
92
		$donnees = array();
98
		$this->images->setProjet($source);
93
		$this->images->setProjet($source);
99
		$nnr = $this->nomCourant->getNnr();
94
		$nnr = $this->nomCourant->getNnr();
100
		$infos_image = $this->images->setApi(Eflore::API_EFLORE)->getInfosPremiereImageParIdsNoms(array($nnr));
95
		$infos_image = $this->images->setApi(Eflore::API_EFLORE)->getInfosPremiereImageParIdsNoms(array($nnr));
101
		if ($infos_image != array()) {
96
		if ($infos_image != array()) {
102
			$image = array_shift($infos_image);
97
			$image = array_shift($infos_image);
103
			$donnees['imageUrl'] =  $image['binaire.href'];
98
			$donnees['imageUrl'] =  $image['binaire.href'];
104
		}
99
		}
105
		return $donnees;
100
		return $donnees;
106
	}
101
	}
107
 
102
 
108
	public function getCoste() {
103
	public function getCoste() {
109
		$coste = array();
104
		$coste = array();
110
		$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
105
		$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
111
		$this->images->setProjet('coste');
106
		$this->images->setProjet('coste');
112
		$this->images->setNnTaxon($tax);
107
		$this->images->setNnTaxon($tax);
113
		$costeImg = $this->images->setApi(Eflore::API_EFLORE)->getInfosImagesTaxons();
108
		$costeImg = $this->images->setApi(Eflore::API_EFLORE)->getInfosImagesTaxons();
114
		foreach ($costeImg as $infos) {
109
		foreach ($costeImg as $infos) {
115
			$coste['images'][] = $infos['binaire.href'];
110
			$coste['images'][] = $infos['binaire.href'];
116
		}
111
		}
117
		$this->meta->setProjet('coste');
112
		$this->meta->setProjet('coste');
118
		$meta = $this->meta->getMetaDonnees();
113
		$meta = $this->meta->getMetaDonnees();
119
		$coste['meta'] = $meta[0];
114
		$coste['meta'] = $meta[0];
120
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
115
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
121
		return $coste;
116
		return $coste;
122
	}
117
	}
123
 
118
 
124
	public function getDessin() {
119
	public function getDessin() {
125
		$projet = Config::get($this->referentiel.'.baseDessins');
120
		$projet = Config::get($this->referentiel.'.baseDessins');
126
		if ($projet != "") {
121
		if ($projet != "") {
127
			$dessin = array();
122
			$dessin = array();
128
			$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
123
			$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
129
			$this->images->setProjet($projet);
124
			$this->images->setProjet($projet);
130
			$this->images->setNnTaxon($tax);
125
			$this->images->setNnTaxon($tax);
131
			$costeImg = $this->images->setApi(Eflore::API_EFLORE)->getInfosImagesTaxons();
126
			$costeImg = $this->images->setApi(Eflore::API_EFLORE)->getInfosImagesTaxons();
132
				foreach ($costeImg as $infos) {
127
				foreach ($costeImg as $infos) {
133
					$dessin['images'][] = $infos['binaire.href'];
128
					$dessin['images'][] = $infos['binaire.href'];
134
				}
129
				}
135
			$this->meta->setProjet($projet);
130
			$this->meta->setProjet($projet);
136
			$meta = $this->meta->getMetaDonnees();
131
			$meta = $this->meta->getMetaDonnees();
137
			$dessin['meta'] = $meta[0];
132
			$dessin['meta'] = $meta[0];
138
			$dessin['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
133
			$dessin['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
139
			$this->donnees[$projet] = $dessin;
134
			$this->donnees[$projet] = $dessin;
140
		}
135
		}
141
	}
136
	}
142
	
137
	
143
	public function getPhotos() {
138
	public function getPhotos() {
144
		$projets[] = Config::get($this->referentiel.'.baseImages');
139
		$projets[] = Config::get($this->referentiel.'.baseImages');
145
		$projets[] = Config::get($this->referentiel.'.baseImagesSupp');
140
		$projets[] = Config::get($this->referentiel.'.baseImagesSupp');
146
		foreach ($projets as $projet) {
141
		foreach ($projets as $projet) {
147
			if ($projet != "") {
142
			if ($projet != "") {
148
				if ($projet == "cel") {
143
				if ($projet == "cel") {
149
					$this->images->setApi(Eflore::API_EFLORE); // prêt à passer à API_DEL
144
					$this->images->setApi(Eflore::API_EFLORE); // prêt à passer à API_DEL
150
				} else {
145
				} else {
151
					$this->images->setApi(Eflore::API_EFLORE);
146
					$this->images->setApi(Eflore::API_EFLORE);
152
				}
147
				}
153
				$images = $this->initialiserPhotos($projet);
148
				$images = $this->initialiserPhotos($projet);
154
				$this->formaterListePhotos($projet, $images);
149
				$this->formaterListePhotos($projet, $images);
155
				$this->formaterMetaPhotos($projet);
150
				$this->formaterMetaPhotos($projet);
156
			}
151
			}
157
		}
152
		}
158
	}
153
	}
159
	
154
	
160
	public function getPhotosSixOrganes() {
155
	public function getPhotosSixOrganes() {
161
		$organes = $this->getOrganes();
156
		$organes = $this->getOrganes();
162
		$nnr = $this->nomCourant->getNnr();
157
		$nnr = $this->nomCourant->getNnr();
163
		$infosOrganes = $this->images->getInfosMeilleuresImagesParTag($nnr, array_keys($organes), Eflore::PROTOCOLE_CAPITALISATION, 6, 'CRX2S');
158
		$infosOrganes = $this->images->getInfosMeilleuresImagesParTag($nnr, array_keys($organes), Eflore::PROTOCOLE_CAPITALISATION, 6, 'CRX2S');
164
		$vide = true;
159
		$vide = true;
165
		foreach ($infosOrganes as $tag => $organe) {
160
		foreach ($infosOrganes as $tag => $organe) {
166
			$organes[$tag] = $organe;
161
			$organes[$tag] = $organe;
167
			$nbImages = count($organe);
162
			$nbImages = count($organe);
168
			if ($nbImages != 0) {
163
			if ($nbImages != 0) {
169
				$vide = false;
164
				$vide = false;
170
				for ($i = 6; $i > $nbImages; $i--) {
165
				for ($i = 6; $i > $nbImages; $i--) {
171
					$organes[$tag][] = null;
166
					$organes[$tag][] = null;
172
				}
167
				}
173
			}
168
			}
174
		}
169
		}
175
		if ($vide) {
170
		if ($vide) {
176
			$organes = array();
171
			$organes = array();
177
		}
172
		}
178
		return $organes;
173
		return $organes;
179
	}
174
	}
180
	
175
	
181
	public function getPhotosOrganes() {
176
	public function getPhotosOrganes() {
182
		$organes = $this->getOrganes();
177
		$organes = $this->getOrganes();
183
		$nnr = $this->nomCourant->getNnr();
178
		$nnr = $this->nomCourant->getNnr();
184
		$infosOrganes = $this->images->getInfosMeilleuresImagesParTag($nnr, array_keys($organes), Eflore::PROTOCOLE_CAPITALISATION, 1);
179
		$infosOrganes = $this->images->getInfosMeilleuresImagesParTag($nnr, array_keys($organes), Eflore::PROTOCOLE_CAPITALISATION, 1);
185
		$vide = true;
180
		$vide = true;
186
		foreach ($infosOrganes as $tag => $organe) {
181
		foreach ($infosOrganes as $tag => $organe) {
187
			$nbImages = count($organe);
182
			$nbImages = count($organe);
188
			// une image par organe seulement
183
			// une image par organe seulement
189
			$organes[$tag] = array_pop($organe);
184
			$organes[$tag] = array_pop($organe);
190
			if ($nbImages != 0) {
185
			if ($nbImages != 0) {
191
				$vide = false;
186
				$vide = false;
192
			}
187
			}
193
		}
188
		}
194
		if ($vide) {
189
		if ($vide) {
195
			$organes = array();
190
			$organes = array();
196
		}
191
		}
197
		$this->donnees['organes'] = $organes;
192
		$this->donnees['organes'] = $organes;
198
	}
193
	}
199
	
194
	
200
	public function getPhotosCaracteresIdentification() {
195
	public function getPhotosCaracteresIdentification() {
201
		$caracteres = array();
196
		$caracteres = array();
202
		$nnr = $this->nomCourant->getNnr();
197
		$nnr = $this->nomCourant->getNnr();
203
		// pas de tag: on cherche les mieux votées pour ce protocole sans tenir compte des tags
198
		// pas de tag: on cherche les mieux votées pour ce protocole sans tenir compte des tags
204
		$infosCaracteres = $this->images->getInfosMeilleuresImagesParTag($nnr, '', Eflore::PROTOCOLE_CARACTERES, 3);
199
		$infosCaracteres = $this->images->getInfosMeilleuresImagesParTag($nnr, '', Eflore::PROTOCOLE_CARACTERES, 3);
205
		if (! empty($infosCaracteres) && ! empty($infosCaracteres[''])) { // le tag est vide, ici
200
		if (! empty($infosCaracteres) && ! empty($infosCaracteres[''])) { // le tag est vide, ici
206
			$caracteres = $infosCaracteres[''];
201
			$caracteres = $infosCaracteres[''];
207
		}
202
		}
208
		$this->donnees['caracteres'] = $caracteres;
203
		$this->donnees['caracteres'] = $caracteres;
209
	}
204
	}
210
	
205
	
211
	private function getOrganes() {
206
	private function getOrganes() {
212
		return array(
207
		return array(
213
				'fleur' => array(),
208
				'fleur' => array(),
214
				'feuille' => array(),
209
				'feuille' => array(),
215
				'fruit' => array(),
210
				'fruit' => array(),
216
				'ecorce' => array(),
211
				'ecorce' => array(),
217
				'port' => array(),
212
				'port' => array(),
218
				'rameau' => array());
213
				'rameau' => array());
219
	}
214
	}
220
 
215
 
221
	// XXX: webservice:
216
	// XXX: webservice:
222
	// /service:eflore:0.1/cel/images?masque.nn=XXX&referentiel=bdtfx&retour.format=CS&navigation.limite=801
217
	// /service:eflore:0.1/cel/images?masque.nn=XXX&referentiel=bdtfx&retour.format=CS&navigation.limite=801
223
	private function initialiserPhotos($projet) {
218
	private function initialiserPhotos($projet) {
224
		$this->images->setProjet($projet);
219
		$this->images->setProjet($projet);
225
		$nnr = $this->nomCourant->getNnr();
220
		$nnr = $this->nomCourant->getNnr();
226
		$ret = $this->images->getInfosImagesParIdsNoms(array($nnr));
221
		$ret = $this->images->getInfosImagesParIdsNoms(array($nnr));
227
		return $ret;
222
		return $ret;
228
	}
223
	}
229
	
224
	
230
	private function formaterListePhotos($projet, $images) {
225
	private function formaterListePhotos($projet, $images) {
231
		foreach ($images as $idImg => $img) {
226
		foreach ($images as $idImg => $img) {
232
			$infosImg = array();
227
			$infosImg = array();
233
			$infosImg['src'] = $img['binaire.href'];
228
			$infosImg['src'] = $img['binaire.href'];
234
			$infosImg['nomSci'] = $img['determination.nom_sci'];
229
			$infosImg['nomSci'] = $img['determination.nom_sci'];
235
			$infosImg['station'] = $img['station.libelle'];
230
			$infosImg['station'] = $img['station.libelle'];
236
			$infosImg['date'] = $this->formaterDateImg($img['date']);
231
			$infosImg['date'] = $this->formaterDateImg($img['date']);
237
			$infosImg['auteur'] = $img['auteur.libelle'];
232
			$infosImg['auteur'] = $img['auteur.libelle'];
238
			$infosImg['auteur.id'] = $img['auteur.id'];
233
			$infosImg['auteur.id'] = $img['auteur.id'];
239
			if ($projet == "cel") {
234
			if ($projet == "cel") {
240
				$infosImg['urlDetailImg'] = $this->appUrls->obtenirUrlPopUpIllustrations($idImg);
235
				$infosImg['urlDetailImg'] = $this->appUrls->obtenirUrlPopUpIllustrations($idImg);
241
				$infosImg['urlContact'] = $this->appUrls->obtenirUrlPopUpContact($img['auteur.id'], $idImg);
236
				$infosImg['urlContact'] = $this->appUrls->obtenirUrlPopUpContact($img['auteur.id'], $idImg);
242
				$infosImg['urlProfil'] = $this->appUrls->obtenirUrlProfilAnnuaire($img['auteur.id']);
237
				$infosImg['urlProfil'] = $this->appUrls->obtenirUrlProfilAnnuaire($img['auteur.id']);
243
				$infosImg['urlMauvaiseIdentification'] =  $this->appUrls->obtenirUrlMauvaiseIdentification($img['observation.id']);
238
				$infosImg['urlMauvaiseIdentification'] =  $this->appUrls->obtenirUrlMauvaiseIdentification($img['observation.id']);
244
			}
239
			}
245
			$this->donnees[$projet]['images'][$idImg] = $infosImg;
240
			$this->donnees[$projet]['images'][$idImg] = $infosImg;
246
		}
241
		}
247
	}
242
	}
248
	
243
	
249
	private function formaterMetaPhotos($projet) {
244
	private function formaterMetaPhotos($projet) {
250
		$this->meta->setProjet($projet);
245
		$this->meta->setProjet($projet);
251
		$meta = $this->meta->getMetaDonnees();
246
		$meta = $this->meta->getMetaDonnees();
252
		$titreMeta = $meta[0];
247
		$titreMeta = $meta[0];
253
		$this->donnees[$projet]['meta'] = $titreMeta;
248
		$this->donnees[$projet]['meta'] = $titreMeta;
254
		$this->donnees[$projet]['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
249
		$this->donnees[$projet]['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
255
	}
250
	}
256
	
251
	
257
	
252
	
258
	
253
	
259
	public function getCelExport() {
254
	public function getCelExport() {
260
		$cel = array();
255
		$cel = array();
261
		$this->images->setProjet('cel');
256
		$this->images->setProjet('cel');
262
		$nnr = $this->nomCourant->getNnr();
257
		$nnr = $this->nomCourant->getNnr();
263
		$img = $this->images->getUrlPremiereImageParIdsNoms(array($nnr));
258
		$img = $this->images->getUrlPremiereImageParIdsNoms(array($nnr));
264
		if($img) {
259
		if($img) {
265
			$img = array_values($img);
260
			$img = array_values($img);
266
			$cel['images']['src'] = $img[0]['binaire.href'];
261
			$cel['images']['src'] = $img[0]['binaire.href'];
267
			$cel['images']['nomSci'] = $img[0]['determination.nom_sci'];
262
			$cel['images']['nomSci'] = $img[0]['determination.nom_sci'];
268
			$cel['images']['station'] = $img[0]['station.libelle'];
263
			$cel['images']['station'] = $img[0]['station.libelle'];
269
			$cel['images']['date'] = $this->formaterDateImg($img[0]['date']);
264
			$cel['images']['date'] = $this->formaterDateImg($img[0]['date']);
270
			$cel['images']['auteur'] = $img[0]['auteur.libelle'];
265
			$cel['images']['auteur'] = $img[0]['auteur.libelle'];
271
			$this->meta->setProjet('cel');
266
			$this->meta->setProjet('cel');
272
			$meta = $this->meta->getMetaDonnees();
267
			$meta = $this->meta->getMetaDonnees();
273
			$cel['meta'] = $meta[0];
268
			$cel['meta'] = $meta[0];
274
			$cel['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('cel');
269
			$cel['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('cel');
275
		}
270
		}
276
		return $cel;
271
		return $cel;
277
	}
272
	}
278
 
273
 
279
	private function formaterDateImg($date) {
274
	private function formaterDateImg($date) {
280
		$dateFmt = $date;
275
		$dateFmt = $date;
281
		if ($date == '' || $date == null || $date == '0000-00-00' || $date == '1970-01-01 01:01:01') {
276
		if ($date == '' || $date == null || $date == '0000-00-00' || $date == '1970-01-01 01:01:01') {
282
			return 'inconnue';
277
			return 'inconnue';
283
		}
278
		}
284
		$time = strtotime($date);
279
		$time = strtotime($date);
285
		if(!$time) {
280
		if(!$time) {
286
			/* TODO: php -r "echo strtotime('1891-00-00 00:00:00');"
281
			/* TODO: php -r "echo strtotime('1891-00-00 00:00:00');"
287
			   TODO: fixer le template pour affiche "en l'année X", plutôt que "le X"
282
			   TODO: fixer le template pour affiche "en l'année X", plutôt que "le X"
288
			   si FALSE pour avant 1901: problème php
283
			   si FALSE pour avant 1901: problème php
289
			   On retourne alors simplement l'année.
284
			   On retourne alors simplement l'année.
290
			   si correction, ne pas oublier modules/popup_illustrations/PopupIllustrations.php */
285
			   si correction, ne pas oublier modules/popup_illustrations/PopupIllustrations.php */
291
			$dateFmt = explode('-', $date);
286
			$dateFmt = explode('-', $date);
292
			return $dateFmt[0];
287
			return $dateFmt[0];
293
		}
288
		}
294
		return strftime('%e %B %Y', strtotime($date));
289
		return strftime('%e %B %Y', strtotime($date));
295
	}
290
	}
296
 
291
 
297
	private function formaterNomSci($nom) {
292
	private function formaterNomSci($nom) {
298
		$nomFmt = $nom;
293
		$nomFmt = $nom;
299
		if (is_null($nom) || $nom == '') {
294
		if (is_null($nom) || $nom == '') {
300
			$nomFmt = 'inconnu';
295
			$nomFmt = 'inconnu';
301
		}
296
		}
302
		return $nomFmt;
297
		return $nomFmt;
303
	}
298
	}
304
}
299
}
305
?>
300
?>