Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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