238 |
delphine |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Classe mère du module Liste.
|
|
|
5 |
*
|
|
|
6 |
* @category PHP 5.2
|
|
|
7 |
* @package eflore-consultation
|
|
|
8 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
|
|
9 |
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
|
|
|
10 |
* @copyright 2011 Tela-Botanica
|
|
|
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
|
|
|
13 |
* @version $Id$
|
|
|
14 |
*/
|
|
|
15 |
class Illustrations extends aControleur {
|
291 |
jpm |
16 |
|
|
|
17 |
private $conteneur = null;
|
294 |
delphine |
18 |
private $nomCourant = null;
|
291 |
jpm |
19 |
private $images = null;
|
478 |
jpm |
20 |
private $appUrls = null;
|
|
|
21 |
private $meta = null;
|
955 |
delphine |
22 |
private $referentiel = 'bdtfx';
|
|
|
23 |
private $donnees = array();
|
291 |
jpm |
24 |
|
|
|
25 |
public function __construct(Conteneur $conteneur) {
|
|
|
26 |
$this->conteneur = $conteneur;
|
294 |
delphine |
27 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
955 |
delphine |
28 |
$this->referentiel = $this->conteneur->getParametre('referentiel');
|
291 |
jpm |
29 |
$this->images = $this->conteneur->getApiImages();
|
|
|
30 |
$this->appUrls = $this->conteneur->getAppUrls();
|
320 |
aurelien |
31 |
$this->meta = $this->conteneur->getApiMetaDonnees();
|
238 |
delphine |
32 |
}
|
291 |
jpm |
33 |
|
|
|
34 |
public function obtenirDonnees() {
|
955 |
delphine |
35 |
$this->donnees['nt'] = $this->nomCourant->getNt();
|
1123 |
mathias |
36 |
$this->donnees['nnr'] = $this->nomCourant->getNnr();
|
1181 |
aurelien |
37 |
$this->donnees['referentiel'] = $this->referentiel;
|
955 |
delphine |
38 |
$this->donnees['nomSciRetenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html');
|
1123 |
mathias |
39 |
$infosNomRetenu = $this->nomCourant->getNomRetenu()->getInfos();
|
|
|
40 |
$this->donnees['nomComplet'] = $infosNomRetenu['nom_complet'];
|
955 |
delphine |
41 |
$this->getPhotos();
|
|
|
42 |
$this->getDessin();
|
1281 |
aurelien |
43 |
|
1123 |
mathias |
44 |
$this->getPhotosCaracteresIdentification();
|
|
|
45 |
$pso = $this->getPhotosSixOrganes();
|
1165 |
aurelien |
46 |
|
1281 |
aurelien |
47 |
// Le framework n'avait pas prévu l'inclusion de sous squelettes dans les modules
|
|
|
48 |
// en attendant, on utilise un chemin complet vers le fichier de squelette
|
|
|
49 |
$chemin_sous_squelette = Config::get('chemin_modules').AppControleur::getNomDossierDepuisClasse('Fiche').DS.Config::get('dossier_squelettes').DS;
|
|
|
50 |
$params = array('organes' => $pso, 'referentiel' => $this->referentiel,
|
|
|
51 |
'nnr' => $this->donnees['nnr'],
|
|
|
52 |
'nomComplet' => $this->donnees['nomComplet']);
|
|
|
53 |
$this->donnees['illustrationsOrganes'] = $this->getVue($chemin_sous_squelette.'fiche_illustrations_organes.tpl.html',$params);
|
1335 |
mathias |
54 |
$this->donnees['organes'] = $pso;
|
1281 |
aurelien |
55 |
|
1146 |
mathias |
56 |
// chemins
|
1273 |
aurelien |
57 |
$this->donnees['base_url_widget_saisie'] = Config::get('base_url_widget_saisie');
|
1335 |
mathias |
58 |
$this->donnees['base_url_pictoflora'] = Config::get('base_url_pictoflora');
|
955 |
delphine |
59 |
return $this->donnees;
|
238 |
delphine |
60 |
}
|
697 |
mathilde |
61 |
|
|
|
62 |
public function obtenirDonneesExport() {
|
955 |
delphine |
63 |
$this->donnees['nt'] = $this->nomCourant->getNt();
|
|
|
64 |
$this->donnees['nomSciRetenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html');
|
|
|
65 |
$this->donnees['cel'] = $this->getCelExport();
|
1357 |
mathias |
66 |
if ($this->referentiel == 'bdtfx') {
|
|
|
67 |
$this->donnees['coste'] = $this->getCoste();
|
|
|
68 |
}
|
955 |
delphine |
69 |
return $this->donnees;
|
697 |
mathilde |
70 |
}
|
291 |
jpm |
71 |
|
|
|
72 |
public function getBloc() {
|
1136 |
mathias |
73 |
$this->donnees = $this->images->getInfosMeilleureImageParPrioriteTags($nnr = $this->nomCourant->getNnr(), array(
|
|
|
74 |
'fleur', 'feuille', 'fruit', 'ecorce', 'port', 'rameau'));
|
955 |
delphine |
75 |
if (empty($this->donnees)) {
|
1137 |
mathias |
76 |
$this->donnees = $this->getPhoto('cel');
|
|
|
77 |
if (empty($this->donnees)) {
|
|
|
78 |
$infos_image = $this->getDessin();
|
|
|
79 |
if (empty($infos_image) == false ) {
|
|
|
80 |
$this->donnees['imageUrl'] = array_shift($infos_image['images']);
|
|
|
81 |
}
|
631 |
mathilde |
82 |
}
|
1136 |
mathias |
83 |
} else {
|
|
|
84 |
// extraction de l'url
|
|
|
85 |
$this->donnees = array('imageUrl' => $this->donnees['binaire.href']);
|
631 |
mathilde |
86 |
}
|
955 |
delphine |
87 |
if (empty($this->donnees)) {
|
|
|
88 |
$this->donnees = $this->getPhoto('photoflora');
|
631 |
mathilde |
89 |
}
|
955 |
delphine |
90 |
return $this->donnees;
|
631 |
mathilde |
91 |
}
|
|
|
92 |
|
1381 |
aurelien |
93 |
public function obtenirPhotoCelTpl() {
|
|
|
94 |
$images = $this->initialiserPhotos('cel');
|
|
|
95 |
$this->formaterListePhotos('cel', $images);
|
|
|
96 |
$this->formaterMetaPhotos('cel');
|
|
|
97 |
$chemin_sous_squelette = Config::get('chemin_modules').AppControleur::getNomDossierDepuisClasse('Fiche').DS.Config::get('dossier_squelettes').DS;
|
|
|
98 |
$donnees = array('cel' => array('images' => $this->donnees['cel']['images'], 'meta' => $this->donnees['cel']['meta'] ));
|
|
|
99 |
$html_tpl = $this->getVue($chemin_sous_squelette.'fiche_illustrations_cel.tpl.html', $donnees);
|
|
|
100 |
return $html_tpl;
|
|
|
101 |
}
|
631 |
mathilde |
102 |
|
1382 |
aurelien |
103 |
//TODO: factoriser les deux fonctions ci dessous et ci dessus
|
|
|
104 |
public function obtenirTranchesCelTpl($projet) {
|
|
|
105 |
// On ne prend que la tranche des images (10)
|
|
|
106 |
$images = $this->initialiserTranchePhotos($projet);
|
|
|
107 |
$this->formaterListePhotos($projet, $images);
|
|
|
108 |
$this->formaterMetaPhotos($projet);
|
|
|
109 |
$chemin_sous_squelette = Config::get('chemin_modules').AppControleur::getNomDossierDepuisClasse('Fiche').DS.Config::get('dossier_squelettes').DS;
|
|
|
110 |
$donnees = array('cel' => array('images' => $this->donnees['cel']['images'], 'meta' => $this->donnees[$projet]['meta'] ));
|
|
|
111 |
$html_tpl = $this->getVue($chemin_sous_squelette.'fiche_illustrations_cel.tpl.html', $donnees);
|
|
|
112 |
$this->donnees[$projet]['illustrationsCel'] = $html_tpl;
|
|
|
113 |
// Ensuite on fait juste un lien qui permettra de les charger
|
|
|
114 |
$this->donnees[$projet]['ajax_url'] = $this->formaterUrlAjaxPhotoCel();
|
|
|
115 |
}
|
|
|
116 |
|
631 |
mathilde |
117 |
public function getPhoto($source) {
|
|
|
118 |
$donnees = array();
|
|
|
119 |
$this->images->setProjet($source);
|
448 |
delphine |
120 |
$nnr = $this->nomCourant->getNnr();
|
1115 |
mathias |
121 |
$infos_image = $this->images->setApi(Eflore::API_EFLORE)->getInfosPremiereImageParIdsNoms(array($nnr));
|
801 |
delphine |
122 |
if ($infos_image != array()) {
|
|
|
123 |
$image = array_shift($infos_image);
|
631 |
mathilde |
124 |
$donnees['imageUrl'] = $image['binaire.href'];
|
470 |
aurelien |
125 |
}
|
291 |
jpm |
126 |
return $donnees;
|
|
|
127 |
}
|
478 |
jpm |
128 |
|
1014 |
raphael |
129 |
public function getCoste() {
|
|
|
130 |
$coste = array();
|
|
|
131 |
$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
|
|
|
132 |
$this->images->setProjet('coste');
|
|
|
133 |
$this->images->setNnTaxon($tax);
|
1115 |
mathias |
134 |
$costeImg = $this->images->setApi(Eflore::API_EFLORE)->getInfosImagesTaxons();
|
1014 |
raphael |
135 |
foreach ($costeImg as $infos) {
|
|
|
136 |
$coste['images'][] = $infos['binaire.href'];
|
|
|
137 |
}
|
|
|
138 |
$this->meta->setProjet('coste');
|
|
|
139 |
$meta = $this->meta->getMetaDonnees();
|
1130 |
aurelien |
140 |
$coste['meta'] = $meta[0];
|
1014 |
raphael |
141 |
$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
|
|
|
142 |
return $coste;
|
|
|
143 |
}
|
|
|
144 |
|
955 |
delphine |
145 |
public function getDessin() {
|
|
|
146 |
$projet = Config::get($this->referentiel.'.baseDessins');
|
|
|
147 |
if ($projet != "") {
|
|
|
148 |
$dessin = array();
|
|
|
149 |
$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
|
|
|
150 |
$this->images->setProjet($projet);
|
|
|
151 |
$this->images->setNnTaxon($tax);
|
1115 |
mathias |
152 |
$costeImg = $this->images->setApi(Eflore::API_EFLORE)->getInfosImagesTaxons();
|
955 |
delphine |
153 |
foreach ($costeImg as $infos) {
|
|
|
154 |
$dessin['images'][] = $infos['binaire.href'];
|
|
|
155 |
}
|
1251 |
aurelien |
156 |
$this->meta->setProjet($projet);
|
955 |
delphine |
157 |
$meta = $this->meta->getMetaDonnees();
|
1130 |
aurelien |
158 |
$dessin['meta'] = $meta[0];
|
955 |
delphine |
159 |
$dessin['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
|
1251 |
aurelien |
160 |
$this->donnees[$projet] = $dessin;
|
955 |
delphine |
161 |
}
|
|
|
162 |
}
|
|
|
163 |
|
|
|
164 |
public function getPhotos() {
|
|
|
165 |
$projets[] = Config::get($this->referentiel.'.baseImages');
|
|
|
166 |
$projets[] = Config::get($this->referentiel.'.baseImagesSupp');
|
|
|
167 |
foreach ($projets as $projet) {
|
|
|
168 |
if ($projet != "") {
|
1115 |
mathias |
169 |
if ($projet == "cel") {
|
1382 |
aurelien |
170 |
// Chargement des 10 premieres images + un lien pour en afficher plus
|
|
|
171 |
$this->obtenirTranchesCelTpl($projet);
|
1115 |
mathias |
172 |
} else {
|
|
|
173 |
$this->images->setApi(Eflore::API_EFLORE);
|
1381 |
aurelien |
174 |
$images = $this->initialiserPhotos($projet);
|
|
|
175 |
$this->formaterListePhotos($projet, $images);
|
|
|
176 |
$this->formaterMetaPhotos($projet);
|
1115 |
mathias |
177 |
}
|
621 |
mathilde |
178 |
}
|
955 |
delphine |
179 |
}
|
621 |
mathilde |
180 |
}
|
1123 |
mathias |
181 |
|
1381 |
aurelien |
182 |
private function formaterUrlAjaxPhotoCel() {
|
|
|
183 |
$infos = array('referentiel' => $this->referentiel,
|
|
|
184 |
'module' => 'fiche',
|
|
|
185 |
'action' => 'templateAjax',
|
|
|
186 |
'sous_action' => 'photoCelTpl',
|
|
|
187 |
'num_nom' => $this->nomCourant->getNnr(),
|
|
|
188 |
'onglet' => 'illustrations');
|
|
|
189 |
return Config::get('base_url_application_onglets').'?'.http_build_query($infos);
|
|
|
190 |
}
|
|
|
191 |
|
1123 |
mathias |
192 |
public function getPhotosSixOrganes() {
|
1165 |
aurelien |
193 |
$organes = $this->getOrganes();
|
1123 |
mathias |
194 |
$nnr = $this->nomCourant->getNnr();
|
|
|
195 |
$infosOrganes = $this->images->getInfosMeilleuresImagesParTag($nnr, array_keys($organes), Eflore::PROTOCOLE_CAPITALISATION, 6, 'CRX2S');
|
1303 |
aurelien |
196 |
|
1123 |
mathias |
197 |
$vide = true;
|
|
|
198 |
foreach ($infosOrganes as $tag => $organe) {
|
1349 |
mathias |
199 |
foreach ($organe as $id_image => &$image) {
|
|
|
200 |
$image['urlMauvaiseIdentification'] = $this->appUrls->obtenirUrlMauvaiseIdentification($image['observation']['id_observation']);
|
|
|
201 |
}
|
1123 |
mathias |
202 |
$organes[$tag] = $organe;
|
|
|
203 |
$nbImages = count($organe);
|
|
|
204 |
if ($nbImages != 0) {
|
|
|
205 |
$vide = false;
|
|
|
206 |
for ($i = 6; $i > $nbImages; $i--) {
|
|
|
207 |
$organes[$tag][] = null;
|
|
|
208 |
}
|
|
|
209 |
}
|
|
|
210 |
}
|
|
|
211 |
if ($vide) {
|
|
|
212 |
$organes = array();
|
|
|
213 |
}
|
1303 |
aurelien |
214 |
|
1123 |
mathias |
215 |
return $organes;
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
public function getPhotosOrganes() {
|
1165 |
aurelien |
219 |
$organes = $this->getOrganes();
|
1123 |
mathias |
220 |
$nnr = $this->nomCourant->getNnr();
|
|
|
221 |
$infosOrganes = $this->images->getInfosMeilleuresImagesParTag($nnr, array_keys($organes), Eflore::PROTOCOLE_CAPITALISATION, 1);
|
|
|
222 |
$vide = true;
|
|
|
223 |
foreach ($infosOrganes as $tag => $organe) {
|
|
|
224 |
$nbImages = count($organe);
|
|
|
225 |
// une image par organe seulement
|
|
|
226 |
$organes[$tag] = array_pop($organe);
|
|
|
227 |
if ($nbImages != 0) {
|
|
|
228 |
$vide = false;
|
|
|
229 |
}
|
|
|
230 |
}
|
|
|
231 |
if ($vide) {
|
|
|
232 |
$organes = array();
|
|
|
233 |
}
|
|
|
234 |
$this->donnees['organes'] = $organes;
|
|
|
235 |
}
|
|
|
236 |
|
|
|
237 |
public function getPhotosCaracteresIdentification() {
|
|
|
238 |
$caracteres = array();
|
|
|
239 |
$nnr = $this->nomCourant->getNnr();
|
1166 |
mathias |
240 |
// pas de tag: on cherche les mieux votées pour ce protocole sans tenir compte des tags
|
|
|
241 |
$infosCaracteres = $this->images->getInfosMeilleuresImagesParTag($nnr, '', Eflore::PROTOCOLE_CARACTERES, 3);
|
1123 |
mathias |
242 |
if (! empty($infosCaracteres) && ! empty($infosCaracteres[''])) { // le tag est vide, ici
|
1166 |
mathias |
243 |
$caracteres = $infosCaracteres[''];
|
1123 |
mathias |
244 |
}
|
1337 |
aurelien |
245 |
foreach($caracteres as $id_image => &$caractere) {
|
|
|
246 |
$caractere['urlDetailImg'] = $this->appUrls->obtenirUrlPopUpIllustrations($id_image);
|
|
|
247 |
$caractere['urlImgGrandFormat'] = $this->obtenirUrlImageGrandFormatCel($id_image);
|
|
|
248 |
$caractere['urlContact'] = $this->appUrls->obtenirUrlPopUpContact($caractere['auteur.id'], $id_image);
|
|
|
249 |
$caractere['urlProfil'] = $this->appUrls->obtenirUrlProfilAnnuaire($caractere['auteur.id']);
|
|
|
250 |
$caractere['urlMauvaiseIdentification'] = $this->appUrls->obtenirUrlMauvaiseIdentification($caractere['observation']['id_observation']);
|
|
|
251 |
}
|
1123 |
mathias |
252 |
$this->donnees['caracteres'] = $caracteres;
|
|
|
253 |
}
|
1165 |
aurelien |
254 |
|
|
|
255 |
private function getOrganes() {
|
|
|
256 |
return array(
|
|
|
257 |
'fleur' => array(),
|
|
|
258 |
'feuille' => array(),
|
|
|
259 |
'fruit' => array(),
|
|
|
260 |
'ecorce' => array(),
|
|
|
261 |
'port' => array(),
|
|
|
262 |
'rameau' => array());
|
|
|
263 |
}
|
1088 |
raphael |
264 |
|
|
|
265 |
// XXX: webservice:
|
|
|
266 |
// /service:eflore:0.1/cel/images?masque.nn=XXX&referentiel=bdtfx&retour.format=CS&navigation.limite=801
|
955 |
delphine |
267 |
private function initialiserPhotos($projet) {
|
|
|
268 |
$this->images->setProjet($projet);
|
448 |
delphine |
269 |
$nnr = $this->nomCourant->getNnr();
|
1123 |
mathias |
270 |
$ret = $this->images->getInfosImagesParIdsNoms(array($nnr));
|
|
|
271 |
return $ret;
|
955 |
delphine |
272 |
}
|
1382 |
aurelien |
273 |
|
|
|
274 |
private function initialiserTranchePhotos($projet) {
|
|
|
275 |
$this->images->setProjet($projet);
|
|
|
276 |
$nnr = $this->nomCourant->getNnr();
|
|
|
277 |
$ret = $this->images->getInfosTrancheImagesParIdsNoms(array($nnr));
|
|
|
278 |
return $ret;
|
|
|
279 |
}
|
955 |
delphine |
280 |
|
|
|
281 |
private function formaterListePhotos($projet, $images) {
|
|
|
282 |
foreach ($images as $idImg => $img) {
|
|
|
283 |
$infosImg = array();
|
|
|
284 |
$infosImg['src'] = $img['binaire.href'];
|
|
|
285 |
$infosImg['nomSci'] = $img['determination.nom_sci'];
|
|
|
286 |
$infosImg['station'] = $img['station.libelle'];
|
|
|
287 |
$infosImg['date'] = $this->formaterDateImg($img['date']);
|
|
|
288 |
$infosImg['auteur'] = $img['auteur.libelle'];
|
1135 |
mathias |
289 |
$infosImg['auteur.id'] = $img['auteur.id'];
|
955 |
delphine |
290 |
if ($projet == "cel") {
|
|
|
291 |
$infosImg['urlDetailImg'] = $this->appUrls->obtenirUrlPopUpIllustrations($idImg);
|
1303 |
aurelien |
292 |
$infosImg['urlImgGrandFormat'] = $this->obtenirUrlImageGrandFormatCel($idImg);
|
955 |
delphine |
293 |
$infosImg['urlContact'] = $this->appUrls->obtenirUrlPopUpContact($img['auteur.id'], $idImg);
|
1114 |
aurelien |
294 |
$infosImg['urlProfil'] = $this->appUrls->obtenirUrlProfilAnnuaire($img['auteur.id']);
|
|
|
295 |
$infosImg['urlMauvaiseIdentification'] = $this->appUrls->obtenirUrlMauvaiseIdentification($img['observation.id']);
|
955 |
delphine |
296 |
}
|
|
|
297 |
$this->donnees[$projet]['images'][$idImg] = $infosImg;
|
515 |
jpm |
298 |
}
|
955 |
delphine |
299 |
}
|
|
|
300 |
|
1311 |
aurelien |
301 |
public static function obtenirUrlImageGrandFormatCel($id, $format = "O") {
|
1303 |
aurelien |
302 |
$tpl = Config::get('baseUrlImageCelTpl');
|
|
|
303 |
return sprintf($tpl, str_pad($id, 9, '0', STR_PAD_LEFT).$format.'.jpg');
|
|
|
304 |
}
|
|
|
305 |
|
|
|
306 |
// XXX: public static pour être injecté dans le squelette d'entete
|
1311 |
aurelien |
307 |
public static function obtenirTemplateUrlImageGrandFormatOrganes($format = "O") {
|
1303 |
aurelien |
308 |
return $tpl = sprintf(Config::get('baseUrlImageCelTpl').$format.'.jpg', '{id_image}');
|
|
|
309 |
}
|
|
|
310 |
|
955 |
delphine |
311 |
private function formaterMetaPhotos($projet) {
|
|
|
312 |
$this->meta->setProjet($projet);
|
339 |
aurelien |
313 |
$meta = $this->meta->getMetaDonnees();
|
1130 |
aurelien |
314 |
$titreMeta = $meta[0];
|
|
|
315 |
$this->donnees[$projet]['meta'] = $titreMeta;
|
955 |
delphine |
316 |
$this->donnees[$projet]['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
|
339 |
aurelien |
317 |
}
|
697 |
mathilde |
318 |
|
955 |
delphine |
319 |
|
|
|
320 |
|
697 |
mathilde |
321 |
public function getCelExport() {
|
|
|
322 |
$cel = array();
|
|
|
323 |
$this->images->setProjet('cel');
|
|
|
324 |
$nnr = $this->nomCourant->getNnr();
|
|
|
325 |
$img = $this->images->getUrlPremiereImageParIdsNoms(array($nnr));
|
|
|
326 |
if($img) {
|
|
|
327 |
$img = array_values($img);
|
|
|
328 |
$cel['images']['src'] = $img[0]['binaire.href'];
|
|
|
329 |
$cel['images']['nomSci'] = $img[0]['determination.nom_sci'];
|
978 |
aurelien |
330 |
$cel['images']['station'] = $img[0]['station.libelle'];
|
697 |
mathilde |
331 |
$cel['images']['date'] = $this->formaterDateImg($img[0]['date']);
|
|
|
332 |
$cel['images']['auteur'] = $img[0]['auteur.libelle'];
|
|
|
333 |
$this->meta->setProjet('cel');
|
|
|
334 |
$meta = $this->meta->getMetaDonnees();
|
1130 |
aurelien |
335 |
$cel['meta'] = $meta[0];
|
697 |
mathilde |
336 |
$cel['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('cel');
|
|
|
337 |
}
|
|
|
338 |
return $cel;
|
|
|
339 |
}
|
|
|
340 |
|
497 |
jpm |
341 |
private function formaterDateImg($date) {
|
|
|
342 |
$dateFmt = $date;
|
1326 |
mathias |
343 |
if ($date == '' || $date == null || strpos($date, '0000-00-00') !== false || $date == '1970-01-01 01:01:01') {
|
1019 |
raphael |
344 |
return 'inconnue';
|
497 |
jpm |
345 |
}
|
1019 |
raphael |
346 |
$time = strtotime($date);
|
|
|
347 |
if(!$time) {
|
|
|
348 |
/* TODO: php -r "echo strtotime('1891-00-00 00:00:00');"
|
|
|
349 |
TODO: fixer le template pour affiche "en l'année X", plutôt que "le X"
|
|
|
350 |
si FALSE pour avant 1901: problème php
|
|
|
351 |
On retourne alors simplement l'année.
|
|
|
352 |
si correction, ne pas oublier modules/popup_illustrations/PopupIllustrations.php */
|
|
|
353 |
$dateFmt = explode('-', $date);
|
|
|
354 |
return $dateFmt[0];
|
|
|
355 |
}
|
|
|
356 |
return strftime('%e %B %Y', strtotime($date));
|
497 |
jpm |
357 |
}
|
|
|
358 |
|
955 |
delphine |
359 |
private function formaterNomSci($nom) {
|
|
|
360 |
$nomFmt = $nom;
|
|
|
361 |
if (is_null($nom) || $nom == '') {
|
|
|
362 |
$nomFmt = 'inconnu';
|
|
|
363 |
}
|
|
|
364 |
return $nomFmt;
|
497 |
jpm |
365 |
}
|
238 |
delphine |
366 |
}
|
|
|
367 |
?>
|