Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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