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