416 |
aurelien |
1 |
<?php
|
993 |
aurelien |
2 |
// Attention classe à migrer ou en cours de migration : utilisez la branche si vous faites des developpements de prod !!!!!
|
|
|
3 |
|
416 |
aurelien |
4 |
/**
|
522 |
jpm |
5 |
* Service fournissant des informations concernant les images du CEL au format RSS1, RSS2 ou ATOM.
|
416 |
aurelien |
6 |
* Encodage en entrée : utf8
|
|
|
7 |
* Encodage en sortie : utf8
|
|
|
8 |
*
|
|
|
9 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
|
|
10 |
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
|
|
|
11 |
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
|
|
|
12 |
* @version $Id$
|
|
|
13 |
* @copyright 2010
|
|
|
14 |
*/
|
528 |
jpm |
15 |
// TODO : résoudre le problème des images liées à plusieurs obs. Cela créé plusieurs item avec le même id pour atom...
|
416 |
aurelien |
16 |
class CelSyndicationImage extends Cel {
|
|
|
17 |
|
528 |
jpm |
18 |
private $parametres_origines = null;
|
416 |
aurelien |
19 |
private $format = null;
|
|
|
20 |
private $service = null;
|
|
|
21 |
private $squelette = null;
|
|
|
22 |
private $squelette_dossier = null;
|
790 |
delphine |
23 |
private $auteurs = array();
|
416 |
aurelien |
24 |
private $flux = array();
|
|
|
25 |
|
630 |
jpm |
26 |
private $format_image = 'XL';
|
416 |
aurelien |
27 |
|
593 |
aurelien |
28 |
private $criteres = array(
|
949 |
aurelien |
29 |
'utilisateur' => 'c.id_utilisateur',
|
|
|
30 |
'commune' => 'b.zone_geo',
|
|
|
31 |
'dept' => 'b.id_zone_geo',
|
710 |
delphine |
32 |
'taxon' => 'b.nom_ret',
|
949 |
aurelien |
33 |
'commentaire' => 'c.commentaire',
|
|
|
34 |
'date' => 'c.date_prise_de_vue',
|
750 |
delphine |
35 |
'tag' => 'tag',
|
|
|
36 |
'projet' => 'projet');
|
593 |
aurelien |
37 |
|
416 |
aurelien |
38 |
/**
|
|
|
39 |
* Méthode appelée avec une requête de type GET.
|
|
|
40 |
*/
|
524 |
jpm |
41 |
public function getElement($params = array()) {
|
416 |
aurelien |
42 |
// Initialisation des variables
|
528 |
jpm |
43 |
$this->parametres_origines = $params;
|
416 |
aurelien |
44 |
$info = array();
|
|
|
45 |
$contenu = '';
|
522 |
jpm |
46 |
|
536 |
jpm |
47 |
if (! $this->etreFluxAdmin() || $this->authentifierAdmin()) {
|
522 |
jpm |
48 |
// Pré traitement des paramêtres
|
|
|
49 |
$pour_bdd = false;
|
524 |
jpm |
50 |
$p = $this->traiterParametres(array('service', 'format'), $params, $pour_bdd);
|
522 |
jpm |
51 |
extract($p);
|
524 |
jpm |
52 |
$this->parametres = $params;
|
|
|
53 |
$this->squelette_dossier = dirname(__FILE__).DIRECTORY_SEPARATOR.'squelettes'.DIRECTORY_SEPARATOR;
|
416 |
aurelien |
54 |
|
522 |
jpm |
55 |
// Récupération de la liste des flux
|
|
|
56 |
$this->chargerListeDesFlux();
|
|
|
57 |
|
|
|
58 |
// Chargement du bon type de service demandé
|
|
|
59 |
if (isset($service)) {
|
524 |
jpm |
60 |
$this->service = $this->traiterNomService($service);
|
522 |
jpm |
61 |
$methode = $this->getNomMethodeService();
|
|
|
62 |
if (method_exists($this, $methode)) {
|
524 |
jpm |
63 |
if (isset($format) && preg_match('/^(?:rss1|rss2|atom)$/i', $format)) {
|
|
|
64 |
// Mise en minuscule de l'indication du format
|
|
|
65 |
$this->format = strtolower($format);
|
|
|
66 |
// Définition du fichier squelette demandé
|
|
|
67 |
$this->squelette = $this->squelette_dossier.$this->format.'.tpl.xml';
|
|
|
68 |
} else if (isset($this->flux[$this->service])) {
|
|
|
69 |
$this->format = '';
|
|
|
70 |
$this->messages[] = "Le service CEL Syndication nécessite d'indiquer en second paramètre le format : rss1, rss2 ou atom.";
|
416 |
aurelien |
71 |
}
|
524 |
jpm |
72 |
|
|
|
73 |
if (!isset($this->flux[$this->service]) || isset($this->format)) {
|
710 |
delphine |
74 |
// Suppression des deux premiers paramètres (service et format) pour le reste des méthodes
|
524 |
jpm |
75 |
array_shift($this->parametres);
|
|
|
76 |
array_shift($this->parametres);
|
|
|
77 |
|
|
|
78 |
// Récupération du contenu à renvoyer
|
|
|
79 |
$contenu = $this->$methode();
|
|
|
80 |
}
|
522 |
jpm |
81 |
} else {
|
|
|
82 |
$this->messages[] = "Le type d'information demandé '$this->service' n'est pas disponible.";
|
416 |
aurelien |
83 |
}
|
|
|
84 |
} else {
|
522 |
jpm |
85 |
$this->messages[] = "Le service CEL Syndication Image nécessite d'indiquer en premier paramètre le type d'information demandé.";
|
416 |
aurelien |
86 |
}
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
// Envoie sur la sortie standard
|
|
|
90 |
$encodage = 'utf-8';
|
|
|
91 |
$mime = $this->getTypeMime();
|
|
|
92 |
$formatage_json = $this->getFormatageJson();
|
|
|
93 |
$this->envoyer($contenu, $mime, $encodage, $formatage_json);
|
|
|
94 |
}
|
|
|
95 |
|
524 |
jpm |
96 |
private function chargerListeDesFlux() {
|
|
|
97 |
$this->setFlux('simple', 'Nouvelles images liées à une observation dans le CEL',
|
|
|
98 |
"Ce flux fournit l'url des nouvelles images du CEL liées à une observation.");
|
|
|
99 |
$this->setFlux('complet', 'Nouvelles images liées à une observation dans le CEL (détails)',
|
|
|
100 |
"Ce flux fournit les informations sur les nouvelles images du CEL liées à une observation.");
|
742 |
delphine |
101 |
$this->setFlux('par-mots-cles', 'Flux de syndication obsolète',
|
|
|
102 |
"Ce flux est désormais accessible via le flux multicriteres/atom/M?tag='mot-cle'.");
|
|
|
103 |
$this->setFlux('par-commune','Flux de syndication obsolète',
|
|
|
104 |
"Ce flux est désormais accessible via le flux multicriteres/atom/M?commune='commune'.");
|
710 |
delphine |
105 |
$this->setFlux('multicriteres','Flux de syndication des nouvelles images liées à une observation publique du CEL '.
|
|
|
106 |
'filtrées par un ou plusieurs critères',
|
|
|
107 |
"Ce flux fournit des informations sur les nouvelles images liées à une observation du CEL filtrées par ".
|
742 |
delphine |
108 |
"auteur (mail), commune (nom), departement (code postal), taxon (nom scientifique), commentaire, tag ".
|
|
|
109 |
"et/ou date.");
|
416 |
aurelien |
110 |
}
|
|
|
111 |
|
524 |
jpm |
112 |
private function setFlux($nom, $titre, $description) {
|
710 |
delphine |
113 |
$url_base = $this->config['settings']['baseURLAbsoluDyn'].'CelSyndicationImage/';
|
524 |
jpm |
114 |
$formats = array('atom', 'rss2', 'rss1');
|
|
|
115 |
$flux = array();
|
|
|
116 |
foreach ($formats as $format) {
|
|
|
117 |
$url = $url_base.$nom.'/'.$format;
|
|
|
118 |
$flux[$format] = $url;
|
|
|
119 |
}
|
|
|
120 |
$this->flux[$nom] = array('titre' => $titre, 'description' => $description, 'urls' => $flux);
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
private function getFlux($nom) {
|
|
|
124 |
return isset($this->flux[$nom]) ? $this->flux[$nom] : array();
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
private function traiterNomService($nom) {
|
|
|
128 |
$nom = strtolower($nom);
|
|
|
129 |
return $nom;
|
|
|
130 |
}
|
|
|
131 |
|
416 |
aurelien |
132 |
private function getNomMethodeService() {
|
|
|
133 |
$methode = '';
|
524 |
jpm |
134 |
$service_formate = str_replace(' ', '', ucwords(implode(' ', explode('-', $this->service))));
|
416 |
aurelien |
135 |
$methode = 'getService'.$service_formate;
|
|
|
136 |
return $methode;
|
|
|
137 |
}
|
|
|
138 |
|
524 |
jpm |
139 |
private function getUrlBase() {
|
636 |
jpm |
140 |
$url_base = sprintf($this->config['settings']['baseURLAbsolu'], get_class($this).'/');
|
524 |
jpm |
141 |
return $url_base;
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
private function getUrlServiceBase() {
|
528 |
jpm |
145 |
$url_service = $this->getUrlBase().implode('/', $this->parametres_origines);
|
524 |
jpm |
146 |
return $url_service;
|
|
|
147 |
}
|
|
|
148 |
|
416 |
aurelien |
149 |
private function getTypeMime() {
|
|
|
150 |
$mime = '';
|
|
|
151 |
switch ($this->format) {
|
|
|
152 |
case 'atom' :
|
|
|
153 |
$mime = 'application/atom+xml';
|
|
|
154 |
break;
|
|
|
155 |
case 'rss1' :
|
|
|
156 |
case 'rss2' :
|
|
|
157 |
$mime = 'application/rss+xml';
|
|
|
158 |
break;
|
524 |
jpm |
159 |
case 'opml' :
|
|
|
160 |
$mime = 'text/x-opml';
|
|
|
161 |
break;
|
416 |
aurelien |
162 |
default:
|
|
|
163 |
$mime = 'text/html';
|
|
|
164 |
}
|
|
|
165 |
return $mime;
|
|
|
166 |
}
|
|
|
167 |
|
|
|
168 |
private function getFormatageJson() {
|
|
|
169 |
$json = false;
|
|
|
170 |
switch ($this->service) {
|
524 |
jpm |
171 |
case 'liste-des-flux' :
|
416 |
aurelien |
172 |
$json = true;
|
|
|
173 |
break;
|
|
|
174 |
default:
|
|
|
175 |
$json = false;
|
|
|
176 |
}
|
|
|
177 |
return $json;
|
|
|
178 |
}
|
528 |
jpm |
179 |
|
|
|
180 |
private function creerCategorie($element) {
|
|
|
181 |
$categorie = '';
|
|
|
182 |
$categorie = 'Image';
|
|
|
183 |
$categorie = $this->nettoyerTexte($categorie);
|
|
|
184 |
return $categorie;
|
|
|
185 |
}
|
524 |
jpm |
186 |
|
522 |
jpm |
187 |
private function etreFluxAdmin() {
|
710 |
delphine |
188 |
return (isset($_GET['admin']) && $_GET['admin'] == '1') ? true : false;
|
416 |
aurelien |
189 |
}
|
|
|
190 |
|
522 |
jpm |
191 |
private function creerUrlService() {
|
|
|
192 |
$url_service = $this->getUrlServiceBase();
|
528 |
jpm |
193 |
if (count($_GET) > 0) {
|
636 |
jpm |
194 |
$parametres_get = array();
|
|
|
195 |
foreach ($_GET as $cle => $valeur) {
|
|
|
196 |
$parametres_get[] = $cle.'='.$valeur;
|
|
|
197 |
}
|
|
|
198 |
$url_service .= '?'.implode('&', $parametres_get);
|
416 |
aurelien |
199 |
}
|
522 |
jpm |
200 |
return $url_service;
|
416 |
aurelien |
201 |
}
|
|
|
202 |
|
710 |
delphine |
203 |
protected function executerRequete($requete, $retour = 'All', $mode = PDO::FETCH_ASSOC) {
|
416 |
aurelien |
204 |
try {
|
|
|
205 |
$infos = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC);
|
|
|
206 |
if ($infos === false) {
|
|
|
207 |
$this->messages[] = "La requête suivante a retourné aucun résultat :\n$requete";
|
|
|
208 |
}
|
|
|
209 |
} catch (PDOException $e) {
|
|
|
210 |
$this->messages[] = sprintf($this->getTxt('sql_erreur'), $e->getFile(), $e->getLine(), $e->getMessage());
|
|
|
211 |
}
|
|
|
212 |
return $infos;
|
|
|
213 |
}
|
|
|
214 |
|
|
|
215 |
private function executerService($elements) {
|
|
|
216 |
// Prétraitement des données
|
|
|
217 |
$donnees = $this->construireDonneesCommunesAuFlux($elements);
|
|
|
218 |
foreach ($elements as $element) {
|
804 |
delphine |
219 |
$identifiants[$element['ci_ce_utilisateur']] = $element['ci_ce_utilisateur'];
|
790 |
delphine |
220 |
}
|
|
|
221 |
$this->auteurs = $this->creerAuteurs($identifiants);
|
|
|
222 |
foreach ($elements as $element) {
|
416 |
aurelien |
223 |
$donnees['items'][] = $this->construireDonneesCommunesAuxItems($element);
|
|
|
224 |
}
|
|
|
225 |
|
|
|
226 |
// Création du contenu à partir d'un template PHP
|
|
|
227 |
$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
|
|
|
228 |
|
|
|
229 |
return $contenu;
|
|
|
230 |
}
|
|
|
231 |
|
|
|
232 |
private function construireDonneesCommunesAuFlux($infos) {
|
|
|
233 |
$donnees = $this->getFlux($this->service);
|
|
|
234 |
$donnees['guid'] = $this->getUrlServiceBase();
|
|
|
235 |
$donnees['lien_service'] = $this->creerUrlService();
|
710 |
delphine |
236 |
$donnees['lien_cel'] = (isset($infos['num_nom_sel'])) ?
|
|
|
237 |
sprintf($this->config['settings']['efloreUrlTpl'], $infos['num_nom_sel'], 'illustration') : '';
|
416 |
aurelien |
238 |
$donnees['editeur'] = $this->config['settings']['editeur'];
|
|
|
239 |
$derniere_info_en_date = reset($infos);
|
|
|
240 |
$date_modification_timestamp = strtotime($derniere_info_en_date['ci_meta_date_ajout']);
|
|
|
241 |
$donnees['date_maj_RSS'] = date(DATE_RSS, $date_modification_timestamp);
|
|
|
242 |
$donnees['date_maj_ATOM'] = date(DATE_ATOM, $date_modification_timestamp);
|
|
|
243 |
$donnees['date_maj_W3C'] = date(DATE_W3C, $date_modification_timestamp);
|
|
|
244 |
$donnees['annee_courante'] = date('Y');
|
|
|
245 |
$donnees['generateur'] = 'CEL - Jrest - CelSyndicationImage';
|
710 |
delphine |
246 |
$donnees['generateur_version'] = (preg_match('/([0-9]+)/', '$Revision$', $match)) ? $match[1] : '0';
|
416 |
aurelien |
247 |
return $donnees;
|
|
|
248 |
}
|
|
|
249 |
|
|
|
250 |
private function construireDonneesCommunesAuxItems($info) {
|
|
|
251 |
$item = array();
|
528 |
jpm |
252 |
$date_modification_timestamp = $this->convertirDateHeureMysqlEnTimestamp($info['ci_meta_date_ajout']);
|
416 |
aurelien |
253 |
$item['date_maj_simple'] = strftime('%A %d %B %Y à %H:%M', $date_modification_timestamp);
|
|
|
254 |
$item['date_maj_RSS'] = date(DATE_RSS, $date_modification_timestamp);
|
|
|
255 |
$item['date_maj_ATOM'] = date(DATE_ATOM, $date_modification_timestamp);
|
|
|
256 |
$item['date_maj_W3C'] = date(DATE_W3C, $date_modification_timestamp);
|
|
|
257 |
$item['titre'] = $this->creerTitre($info);
|
|
|
258 |
$item['guid'] = $this->creerGuidItem($info);
|
|
|
259 |
$item['lien'] = $this->creerLienItem($info);
|
528 |
jpm |
260 |
$item['categorie'] = $this->creerCategorie($item);
|
|
|
261 |
$item['description'] = $this->creerDescription($this->protegerCaracteresHtmlDansChamps($info), $item);
|
|
|
262 |
$item['description_encodee'] = htmlspecialchars($this->creerDescription($info, $item));
|
804 |
delphine |
263 |
$item['modifier_par'] = $this->auteurs[$info['ci_ce_utilisateur']];
|
416 |
aurelien |
264 |
return $item;
|
|
|
265 |
}
|
|
|
266 |
|
|
|
267 |
private function creerGuidItem($element) {
|
528 |
jpm |
268 |
$guid = $this->getUrlImage($element['ci_id_image']);
|
416 |
aurelien |
269 |
return $guid;
|
|
|
270 |
}
|
|
|
271 |
|
522 |
jpm |
272 |
private function creerTitre($element) {
|
|
|
273 |
$methode = 'creerTitre'.$this->service;
|
|
|
274 |
$methode = (method_exists($this, $methode)) ? $methode : 'creerTitreSimple';
|
|
|
275 |
$titre = $this->$methode($element);
|
|
|
276 |
$titre = $this->nettoyerTexte($titre);
|
|
|
277 |
return $titre;
|
416 |
aurelien |
278 |
}
|
|
|
279 |
|
523 |
jpm |
280 |
private function creerDescription($donnees, $item) {
|
522 |
jpm |
281 |
$methode = 'creerDescription'.$this->service;
|
525 |
jpm |
282 |
$methode = (method_exists($this, $methode)) ? $methode : 'creerDescriptionComplet';
|
523 |
jpm |
283 |
$description = $this->$methode($donnees, $item);
|
416 |
aurelien |
284 |
$description = $this->nettoyerTexte($description);
|
|
|
285 |
return $description;
|
|
|
286 |
}
|
522 |
jpm |
287 |
|
|
|
288 |
private function creerLienItem($element) {
|
630 |
jpm |
289 |
if ($this->etreNull($element['id'])) {
|
|
|
290 |
// Lien vers image grand format
|
|
|
291 |
$lien = $this->getUrlImage($element['ci_id_image'], $this->format_image);
|
|
|
292 |
} else {
|
|
|
293 |
// Lien vers fiche eFlore onglet Illustration
|
|
|
294 |
$lien = sprintf($this->config['settings']['efloreUrlTpl'], $element['num_nom_sel'], 'illustration');
|
|
|
295 |
}
|
522 |
jpm |
296 |
return $lien;
|
416 |
aurelien |
297 |
}
|
|
|
298 |
|
524 |
jpm |
299 |
private function getServiceListeDesFlux() {
|
|
|
300 |
return $this->flux;
|
|
|
301 |
}
|
|
|
302 |
|
|
|
303 |
private function getServiceOpml() {
|
|
|
304 |
$donnees = array();
|
|
|
305 |
$id = 1;
|
|
|
306 |
foreach ($this->flux as $flux_nom => $flux){
|
|
|
307 |
$info = array();
|
|
|
308 |
$info['type'] = 'atom';
|
|
|
309 |
$info['titre'] = $flux['titre'];
|
|
|
310 |
$info['texte'] = "CEL - Images - $flux_nom";
|
|
|
311 |
$info['description'] = $flux['description'];
|
|
|
312 |
$info['url_xml'] = $this->getUrlBase().$flux_nom.'/atom';
|
|
|
313 |
$info['url_html'] = $this->config['settings']['aideCelUrl'].'FluxSyndication';
|
|
|
314 |
$donnees['liste_flux'][] = $info;
|
522 |
jpm |
315 |
}
|
|
|
316 |
|
524 |
jpm |
317 |
$this->squelette = $this->squelette_dossier.'opml.tpl.xml';
|
|
|
318 |
$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
|
|
|
319 |
return $contenu;
|
|
|
320 |
}
|
|
|
321 |
|
|
|
322 |
private function getServiceSimple() {
|
|
|
323 |
if (isset($this->parametres[0])) {
|
|
|
324 |
$this->format_image = $this->parametres[0];
|
|
|
325 |
}
|
522 |
jpm |
326 |
|
|
|
327 |
// Construction de la requête
|
716 |
delphine |
328 |
$requete = (isset($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' ci.*, '.
|
613 |
jpm |
329 |
' ci_id_image, ci_ce_utilisateur, ci_nom_original, ci_meta_date_ajout, ci_meta_mots_cles, ci_meta_comment, ci_note_image '.
|
522 |
jpm |
330 |
'FROM cel_obs_images AS coi '.
|
|
|
331 |
'LEFT JOIN cel_inventory AS ci '.
|
|
|
332 |
'ON (coi.coi_ce_observation = ci.ordre AND coi.coi_ce_utilisateur = ci.identifiant) '.
|
|
|
333 |
'LEFT JOIN cel_images AS cim '.
|
|
|
334 |
'ON (coi.coi_ce_image = cim.ci_id_image AND coi.coi_ce_utilisateur = cim.ci_ce_utilisateur) '.
|
|
|
335 |
'WHERE ci.transmission = 1 '.
|
|
|
336 |
' AND ci.identifiant = cim.ci_ce_utilisateur '.
|
716 |
delphine |
337 |
'ORDER BY '.(isset($this->orderby) && (!is_null($this->orderby)) ? $this->orderby : 'ci_meta_date_ajout DESC').' '.
|
522 |
jpm |
338 |
"LIMIT $this->start, $this->limit ";
|
|
|
339 |
|
|
|
340 |
$elements = $this->executerRequete($requete);
|
|
|
341 |
|
|
|
342 |
// Création du contenu
|
|
|
343 |
$contenu = $this->executerService($elements);
|
|
|
344 |
return $contenu;
|
416 |
aurelien |
345 |
}
|
|
|
346 |
|
522 |
jpm |
347 |
private function creerTitreSimple($element) {
|
603 |
jpm |
348 |
if ($this->etreNull($element['nom_sel']) && $this->etreNull($element['num_nom_sel'])) {
|
790 |
delphine |
349 |
$titre = "Ajout d'une photo par ".$this->auteurs[$element['ci_ce_utilisateur']];
|
603 |
jpm |
350 |
} else {
|
790 |
delphine |
351 |
$titre = $element['nom_sel'].' [nn'.$element['num_nom_sel'].'] par '.$this->auteurs[$element['ci_ce_utilisateur']];
|
603 |
jpm |
352 |
}
|
522 |
jpm |
353 |
return $titre;
|
416 |
aurelien |
354 |
}
|
|
|
355 |
|
523 |
jpm |
356 |
private function creerDescriptionSimple($donnees, $item) {
|
585 |
jpm |
357 |
$description = sprintf($this->config['settings']['efloreUrlTpl'], urlencode($donnees['num_nom_sel']), 'illustration');
|
522 |
jpm |
358 |
return $description;
|
416 |
aurelien |
359 |
}
|
|
|
360 |
|
524 |
jpm |
361 |
private function getServiceComplet() {
|
522 |
jpm |
362 |
// Construction de la requête
|
710 |
delphine |
363 |
$requete = (isset($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' ci.*, '.
|
603 |
jpm |
364 |
' ci_id_image, ci_ce_utilisateur, ci_nom_original, ci_meta_date_ajout, ci_meta_mots_cles, ci_meta_comment, ci_note_image '.
|
525 |
jpm |
365 |
'FROM cel_images AS cim '.
|
|
|
366 |
' LEFT JOIN cel_obs_images AS coi '.
|
|
|
367 |
' ON (coi.coi_ce_image = cim.ci_id_image AND coi.coi_ce_utilisateur = cim.ci_ce_utilisateur) '.
|
|
|
368 |
' LEFT JOIN cel_inventory AS ci '.
|
|
|
369 |
' ON (coi.coi_ce_observation = ci.ordre AND coi.coi_ce_utilisateur = ci.identifiant) '.
|
|
|
370 |
(($this->etreFluxAdmin()) ? '' : 'WHERE ci.transmission = 1 ').
|
710 |
delphine |
371 |
'ORDER BY '.(isset($this->orderby) && (!is_null($this->orderby)) ? $this->orderby : 'ci_meta_date_ajout DESC').' '.
|
522 |
jpm |
372 |
"LIMIT $this->start, $this->limit ";
|
|
|
373 |
|
|
|
374 |
$elements = $this->executerRequete($requete);
|
525 |
jpm |
375 |
|
522 |
jpm |
376 |
// Création du contenu
|
525 |
jpm |
377 |
if ($elements != false && count($elements) > 0) {
|
|
|
378 |
$contenu = $this->executerService($elements);
|
|
|
379 |
} else {
|
|
|
380 |
$this->messages[] = "Aucune image disponible.";
|
|
|
381 |
}
|
|
|
382 |
|
522 |
jpm |
383 |
return $contenu;
|
516 |
aurelien |
384 |
}
|
593 |
aurelien |
385 |
|
|
|
386 |
private function getServiceMultiCriteres() {
|
710 |
delphine |
387 |
$contenu = '';
|
714 |
delphine |
388 |
if (isset($_GET['debut'])) $this->start = $_GET['debut'];
|
|
|
389 |
if (isset($_GET['limite'])) $this->limite = $_GET['limite'];
|
593 |
aurelien |
390 |
|
|
|
391 |
// Construction de la requête
|
603 |
jpm |
392 |
$requete = 'SELECT * '.
|
945 |
jpm |
393 |
'FROM cel_obs_images AS a '.
|
|
|
394 |
' INNER JOIN cel_inventory AS b '.
|
603 |
jpm |
395 |
' ON (a.coi_ce_observation = b.ordre AND a.coi_ce_utilisateur = b.identifiant) '.
|
945 |
jpm |
396 |
' INNER JOIN cel_images AS c '.
|
814 |
delphine |
397 |
' ON (a.coi_ce_image = c.ci_id_image AND a.coi_ce_utilisateur = c.ci_ce_utilisateur) '.
|
945 |
jpm |
398 |
'WHERE b.identifiant = c.ci_ce_utilisateur '.
|
949 |
aurelien |
399 |
(($this->etreFluxAdmin()) ? '' : 'AND b.transmission = 1 ').
|
603 |
jpm |
400 |
' AND ';
|
593 |
aurelien |
401 |
|
603 |
jpm |
402 |
if ($this->estUneRechercheGenerale()) {
|
593 |
aurelien |
403 |
$chaine_requete = $_GET['recherche'];
|
714 |
delphine |
404 |
$requete .= $this->creerSousRequeteRechercheGenerale($chaine_requete);
|
593 |
aurelien |
405 |
} else {
|
|
|
406 |
$criteres = $this->traiterCriteresMultiples($_GET) ;
|
714 |
delphine |
407 |
if (!empty($criteres)) {
|
|
|
408 |
$requete .= $this->creerSousRequeteRechercheParCriteres($criteres);
|
|
|
409 |
}
|
593 |
aurelien |
410 |
}
|
750 |
delphine |
411 |
$requete = str_replace(' AND ) ',' ', $requete);
|
603 |
jpm |
412 |
$requete = rtrim($requete, 'AND ');
|
710 |
delphine |
413 |
$requete .= ' ORDER BY '.(isset($this->orderby) && (!is_null($this->orderby)) ? $this->orderby :
|
|
|
414 |
'c.ci_meta_date_ajout DESC').' '."LIMIT $this->start,$this->limit ";
|
593 |
aurelien |
415 |
$elements = $this->executerRequete($requete);
|
|
|
416 |
|
|
|
417 |
// Création du contenu
|
|
|
418 |
if ($elements != false && count($elements) > 0) {
|
|
|
419 |
$contenu = $this->executerService($elements);
|
|
|
420 |
} else {
|
750 |
delphine |
421 |
$this->messages[] = "Aucune image disponible.";
|
593 |
aurelien |
422 |
}
|
|
|
423 |
|
|
|
424 |
return $contenu;
|
|
|
425 |
}
|
|
|
426 |
|
|
|
427 |
private function creerSousRequeteRechercheParCriteres($criteres) {
|
|
|
428 |
$requete = '';
|
603 |
jpm |
429 |
foreach ($criteres as $pair) {
|
|
|
430 |
$nom_valeur = explode("=",$pair);
|
|
|
431 |
if (sizeof($nom_valeur) != 0) {
|
710 |
delphine |
432 |
switch ($nom_valeur[0]) {
|
|
|
433 |
case "ci_limite" : $this->limite = $this->bdd->quote($nom_valeur[1]); break;
|
|
|
434 |
case "c.ci_numero_page" : $this->limite*$this->bdd->quote($nom_valeur[1]); break;
|
|
|
435 |
case "c.ci_meta_comment" : $mots_comment_liste = explode(" " , $nom_valeur[1]);
|
|
|
436 |
foreach($mots_comment_liste as $mot_comment) {
|
|
|
437 |
$mot_comment = trim($mot_comment) ;
|
|
|
438 |
$requete .= $nom_valeur[0].' LIKE '.$this->bdd->quote('%'.$mot_comment.'%').' AND ';
|
|
|
439 |
}
|
|
|
440 |
break;
|
|
|
441 |
case "c.ci_meta_date" :
|
|
|
442 |
$nom_valeur[1] = str_replace('/', '-', $nom_valeur[1]);
|
|
|
443 |
if (preg_match('/(^[0-9]{2})-([0-9]{2})-([0-9]{4}$)/', $nom_valeur[1], $matches)) {
|
|
|
444 |
$nom_valeur[1] = $matches[3].'-'.$matches[2].'-'.$matches[1];
|
|
|
445 |
}
|
|
|
446 |
$requete .= $nom_valeur[0].'='.$this->bdd->quote($nom_valeur[1]).' AND '; break;
|
|
|
447 |
case "b.nom_ret" :
|
|
|
448 |
if ($nom_valeur[1] == "indetermine") $nom_valeur[1] = 'null';
|
|
|
449 |
$requete .= ' ('.$nom_valeur[0].' LIKE "%'.$nom_valeur[1].'%" OR b.nom_sel LIKE "%'.
|
|
|
450 |
$nom_valeur[1].'%") AND '; break;
|
750 |
delphine |
451 |
case "tag" : $requete .= $this->creerSousRequeteMotsCles($nom_valeur[1]); break;
|
|
|
452 |
case "projet" : $requete .= $this->creerSousRequeteProjet($nom_valeur[1]); break;
|
710 |
delphine |
453 |
default : $requete .= $nom_valeur[0].' = "'.$nom_valeur[1].'" AND '; break;
|
603 |
jpm |
454 |
}
|
593 |
aurelien |
455 |
}
|
|
|
456 |
}
|
603 |
jpm |
457 |
$requete = rtrim($requete,' AND ');
|
593 |
aurelien |
458 |
return $requete;
|
|
|
459 |
}
|
|
|
460 |
|
714 |
delphine |
461 |
private function creerSousRequeteMotsCles($mot_cle) {
|
741 |
delphine |
462 |
if (preg_match('/.*OU.*/', $mot_cle)) {
|
714 |
delphine |
463 |
$requete = $this->creerSousRequeteMotsClesOu($mot_cle);
|
|
|
464 |
} else if (preg_match('/.*ET.*/', $mot_cle)) {
|
|
|
465 |
$requete = $this->creerSousRequeteMotsClesEt($mot_cle);
|
|
|
466 |
} else {
|
|
|
467 |
// Construction de la requête
|
718 |
delphine |
468 |
$prerequete = "SELECT cmc_id_mot_cle_utilisateur, cmc_id_proprietaire FROM cel_mots_cles_images WHERE ".
|
714 |
delphine |
469 |
'cmc_id_mot_cle_general = '.$this->bdd->quote($this->encoderMotCle($mot_cle));
|
716 |
delphine |
470 |
$elements = $this->executerRequete($prerequete);
|
714 |
delphine |
471 |
if ($elements != false && count($elements) > 0) {
|
749 |
delphine |
472 |
$requete = ' ( ';
|
714 |
delphine |
473 |
foreach ($elements as $occurence) {
|
|
|
474 |
$requete .= '(ci_meta_mots_cles LIKE "%'.$occurence['cmc_id_mot_cle_utilisateur'].'%" AND ci_ce_utilisateur = '.
|
|
|
475 |
$this->bdd->quote($occurence['cmc_id_proprietaire']).' ) OR ';
|
|
|
476 |
}
|
750 |
delphine |
477 |
} else {
|
|
|
478 |
$requete = ' (ci_meta_mots_cles like "inexistant" OR';
|
|
|
479 |
}
|
714 |
delphine |
480 |
}
|
718 |
delphine |
481 |
$requete = rtrim($requete,' OR ').' ) AND ';
|
714 |
delphine |
482 |
return $requete;
|
|
|
483 |
}
|
|
|
484 |
|
|
|
485 |
private function creerSousRequeteMotsClesOu($mot_cle) {
|
741 |
delphine |
486 |
$tab_mots_cles = explode('OU', $mot_cle);
|
714 |
delphine |
487 |
$where = '';
|
|
|
488 |
foreach ($tab_mots_cles as $mot) {
|
741 |
delphine |
489 |
$where .= 'cmc_id_mot_cle_general = '.$this->bdd->quote($this->encoderMotCle(trim($mot))).' OR ';
|
714 |
delphine |
490 |
}
|
|
|
491 |
$where = rtrim($where,' OR ');
|
|
|
492 |
|
|
|
493 |
// Construction de la requête
|
|
|
494 |
$prerequete = "SELECT cmc_id_mot_cle_utilisateur, cmc_id_proprietaire FROM cel_mots_cles_images WHERE $where ";
|
|
|
495 |
$elements = $this->executerRequete($prerequete);//print_r($elements);
|
|
|
496 |
if ($elements != false && count($elements) > 0) {
|
749 |
delphine |
497 |
$requete = ' ( ';
|
714 |
delphine |
498 |
foreach ($elements as $occurence) {
|
|
|
499 |
$requete .= '(ci_meta_mots_cles LIKE "%'.$occurence['cmc_id_mot_cle_utilisateur'].'%" AND ci_ce_utilisateur = '.
|
|
|
500 |
$this->bdd->quote($occurence['cmc_id_proprietaire']).' ) OR ';
|
|
|
501 |
}
|
750 |
delphine |
502 |
} else {
|
|
|
503 |
$requete = ' (ci_meta_mots_cles like "inexistant" OR';
|
714 |
delphine |
504 |
}
|
|
|
505 |
return $requete;
|
|
|
506 |
}
|
|
|
507 |
|
|
|
508 |
private function creerSousRequeteMotsClesEt($mot_cle) {
|
|
|
509 |
$where = '';
|
|
|
510 |
$champs = 'a.cmc_id_proprietaire , ';
|
|
|
511 |
$table = '';
|
|
|
512 |
$i = "a"; $j = "a";
|
|
|
513 |
|
|
|
514 |
$tab_mots_cles = explode("ET", $mot_cle);
|
|
|
515 |
foreach ($tab_mots_cles as $mot) {
|
|
|
516 |
$champs .= "$i.cmc_id_mot_cle_utilisateur as $i , ";
|
|
|
517 |
$table .= "cel_mots_cles_images $i , ";
|
741 |
delphine |
518 |
$where .= "$i.cmc_id_mot_cle_general = ".$this->bdd->quote($this->encoderMotCle(trim($mot))).' AND ';
|
714 |
delphine |
519 |
if ($i !== "a") {
|
|
|
520 |
$where .= " $i.cmc_id_proprietaire = ".$j.".cmc_id_proprietaire AND ";
|
|
|
521 |
$j++;
|
|
|
522 |
}
|
|
|
523 |
$i++;
|
|
|
524 |
}
|
945 |
jpm |
525 |
$where = rtrim($where,' AND ');
|
|
|
526 |
$champs = rtrim($champs,' , ');
|
|
|
527 |
$table = rtrim($table,' , ');
|
714 |
delphine |
528 |
|
|
|
529 |
// Construction de la requête
|
741 |
delphine |
530 |
$prerequete = "SELECT $champs FROM $table WHERE $where ";
|
714 |
delphine |
531 |
$elements = $this->executerRequete($prerequete);//print_r($elements);
|
|
|
532 |
if ($elements != false && count($elements) > 0) {
|
749 |
delphine |
533 |
$requete = ' ( ';
|
714 |
delphine |
534 |
foreach ($elements as $occurence) {
|
741 |
delphine |
535 |
$requete .= ' (';
|
714 |
delphine |
536 |
for ($j = 'a'; $j < $i; $j++) {
|
716 |
delphine |
537 |
$requete .= 'ci_meta_mots_cles like "%'.$occurence[$j].'%" AND ';
|
714 |
delphine |
538 |
}
|
716 |
delphine |
539 |
$requete .= ' ci_ce_utilisateur = '.$this->bdd->quote($occurence['cmc_id_proprietaire']).' ) OR ';
|
714 |
delphine |
540 |
}
|
750 |
delphine |
541 |
} else {
|
|
|
542 |
$requete = ' (ci_meta_mots_cles like "inexistant" OR';
|
714 |
delphine |
543 |
}
|
|
|
544 |
return $requete;
|
|
|
545 |
}
|
750 |
delphine |
546 |
|
|
|
547 |
private function creerSousRequeteProjet($mot_cle) {
|
|
|
548 |
$requete = 'mots_cles like "inexistant" OR';
|
|
|
549 |
if (preg_match('/.*OU.*/', $mot_cle)) {
|
|
|
550 |
$requete = $this->creerSousRequeteProjetOu($mot_cle);
|
|
|
551 |
} else if (preg_match('/.*ET.*/', $mot_cle)) {
|
|
|
552 |
$requete = $this->creerSousRequeteProjetEt($mot_cle);
|
|
|
553 |
} else {
|
|
|
554 |
// Construction de la requête
|
|
|
555 |
$prerequete = 'SELECT * '.
|
|
|
556 |
'FROM cel_mots_cles_obs '.
|
|
|
557 |
'WHERE cmc_id_mot_cle_general = '.$this->bdd->quote($this->encoderMotCle($mot_cle));
|
|
|
558 |
$elements = $this->executerRequete($prerequete);
|
|
|
559 |
if ($elements != false && count($elements) > 0) {
|
|
|
560 |
$requete = '';
|
|
|
561 |
foreach ($elements as $occurence) {
|
|
|
562 |
$requete .= '(mots_cles LIKE "%'.$occurence['cmc_id_mot_cle_utilisateur'].'%" AND identifiant = '.
|
|
|
563 |
$this->bdd->quote($occurence['cmc_id_proprietaire']).' ) OR ';
|
|
|
564 |
}
|
|
|
565 |
}
|
|
|
566 |
}
|
|
|
567 |
$requete = rtrim($requete,' OR ').' AND ';
|
|
|
568 |
return $requete;
|
|
|
569 |
}
|
|
|
570 |
|
|
|
571 |
private function creerSousRequeteProjetOu($mot_cle) {
|
|
|
572 |
$requete = 'mots_cles like "inexistant" OR';
|
|
|
573 |
$tab_mots_cles = explode('OU', $mot_cle);
|
|
|
574 |
$where = '';
|
|
|
575 |
foreach ($tab_mots_cles as $mot) {
|
|
|
576 |
$where .= 'cmc_id_mot_cle_general = '.$this->bdd->quote($this->encoderMotCle(trim($mot))).' OR ';
|
|
|
577 |
}
|
|
|
578 |
$where = rtrim($where,' OR ');
|
|
|
579 |
|
|
|
580 |
// Construction de la requête
|
|
|
581 |
$prerequete = "SELECT cmc_id_mot_cle_utilisateur, cmc_id_proprietaire FROM cel_mots_cles_obs WHERE $where ";
|
|
|
582 |
$elements = $this->executerRequete($prerequete);
|
|
|
583 |
if ($elements != false && count($elements) > 0) {
|
|
|
584 |
$requete = '';
|
|
|
585 |
foreach ($elements as $occurence) {
|
|
|
586 |
$requete .= '(mots_cles LIKE "%'.$occurence['cmc_id_mot_cle_utilisateur'].'%" AND identifiant = '.
|
|
|
587 |
$this->bdd->quote($occurence['cmc_id_proprietaire']).' ) OR ';
|
|
|
588 |
}
|
|
|
589 |
}
|
|
|
590 |
return $requete;
|
|
|
591 |
}
|
|
|
592 |
|
|
|
593 |
private function creerSousRequeteProjetEt($mot_cle) {
|
|
|
594 |
$requete = 'mots_cles like "inexistant" OR';
|
|
|
595 |
$where = '';
|
|
|
596 |
$champs = 'a.cmc_id_proprietaire , ';
|
|
|
597 |
$table = '';
|
|
|
598 |
$i = "a"; $j = "a";
|
|
|
599 |
|
949 |
aurelien |
600 |
$tab_mots_cles = explode("ET", $mot_cle);
|
|
|
601 |
|
750 |
delphine |
602 |
foreach ($tab_mots_cles as $mot) {
|
|
|
603 |
$champs .= "$i.cmc_id_mot_cle_utilisateur as $i , ";
|
|
|
604 |
$table .= "cel_mots_cles_obs $i , ";
|
|
|
605 |
$where .= "$i.cmc_id_mot_cle_general = ".$this->bdd->quote($this->encoderMotCle(trim($mot))).' AND ';
|
|
|
606 |
if ($i !== "a") {
|
|
|
607 |
$where .= " $i.cmc_id_proprietaire = ".$j.".cmc_id_proprietaire AND ";
|
|
|
608 |
$j++;
|
|
|
609 |
}
|
|
|
610 |
$i++;
|
|
|
611 |
}
|
945 |
jpm |
612 |
$where = rtrim($where, ' AND ');
|
|
|
613 |
$champs = rtrim($champs, ' , ');
|
|
|
614 |
$table = rtrim($table, ' , ');
|
750 |
delphine |
615 |
|
|
|
616 |
// Construction de la requête
|
|
|
617 |
$prerequete = "SELECT $champs FROM $table WHERE $where ";
|
|
|
618 |
$elements = $this->executerRequete($prerequete);//print_r($elements);
|
|
|
619 |
if ($elements != false && count($elements) > 0) {
|
|
|
620 |
$requete = '';
|
|
|
621 |
foreach ($elements as $occurence) {
|
|
|
622 |
$requete = ' (';
|
|
|
623 |
for ($j = 'a'; $j < $i; $j++) {
|
|
|
624 |
$requete .= 'mots_cles like "%'.$occurence[$j].'%" AND ';
|
|
|
625 |
}
|
|
|
626 |
$requete .= ' identifiant = '.$this->bdd->quote($occurence['cmc_id_proprietaire']).' ) OR ';
|
|
|
627 |
}
|
|
|
628 |
}
|
|
|
629 |
return $requete;
|
|
|
630 |
}
|
|
|
631 |
|
593 |
aurelien |
632 |
private function creerSousRequeteRechercheGenerale($chaine_requete) {
|
603 |
jpm |
633 |
$requete = '';
|
|
|
634 |
if (trim($chaine_requete) != '') {
|
|
|
635 |
$chaine_requete = strtolower($chaine_requete);
|
|
|
636 |
$chaine_requete = str_replace(' ', '_', $chaine_requete);
|
|
|
637 |
$requete = ' ('.
|
|
|
638 |
'b.nom_ret LIKE "'.$chaine_requete.'%"'.
|
|
|
639 |
' OR '.
|
|
|
640 |
'b.nom_sel LIKE "'.$chaine_requete.'%"'.
|
|
|
641 |
' OR '.
|
|
|
642 |
'b.location LIKE "'.$chaine_requete.'%" '.
|
|
|
643 |
' OR '.
|
|
|
644 |
'b.id_location LIKE "'.$chaine_requete.'%" '.
|
|
|
645 |
' OR '.
|
|
|
646 |
'c.ci_ce_utilisateur LIKE "'.$chaine_requete.'%" '.
|
|
|
647 |
') ';
|
593 |
aurelien |
648 |
}
|
|
|
649 |
return $requete;
|
|
|
650 |
}
|
|
|
651 |
|
|
|
652 |
private function estUneRechercheGenerale() {
|
|
|
653 |
return isset($_GET['recherche']);
|
|
|
654 |
}
|
|
|
655 |
|
|
|
656 |
private function traiterCriteresMultiples($tableau_criteres) {
|
|
|
657 |
$tableau_criteres_pour_bdd = array();
|
|
|
658 |
|
|
|
659 |
foreach($tableau_criteres as $nom_critere => $valeur_critere) {
|
603 |
jpm |
660 |
if (isset($this->criteres[$nom_critere])) {
|
593 |
aurelien |
661 |
$tableau_criteres_pour_bdd[] = $this->criteres[$nom_critere].'='.$valeur_critere;
|
|
|
662 |
}
|
|
|
663 |
}
|
|
|
664 |
return $tableau_criteres_pour_bdd;
|
|
|
665 |
}
|
|
|
666 |
|
523 |
jpm |
667 |
private function creerDescriptionComplet($donnees, $item) {
|
790 |
delphine |
668 |
$auteur = $this->auteurs[$donnees['ci_ce_utilisateur']];
|
813 |
delphine |
669 |
$auteur_mail = $donnees['ci_ce_utilisateur'];
|
528 |
jpm |
670 |
|
525 |
jpm |
671 |
$id_img = $donnees['ci_id_image'];
|
528 |
jpm |
672 |
$nom_fichier = $donnees['ci_nom_original'];
|
628 |
jpm |
673 |
$url_img = $this->getUrlImage($donnees['ci_id_image'], 'CS');
|
630 |
jpm |
674 |
$url_img_normale = $this->getUrlImage($donnees['ci_id_image'], 'XL');
|
528 |
jpm |
675 |
$mots_cles_image = $this->decoderMotsClesImg($donnees['identifiant'], $donnees['ci_meta_mots_cles']);
|
|
|
676 |
$note = ($donnees['ci_note_image'] +1).'/5';
|
|
|
677 |
$commentaire_img = $donnees['ci_meta_comment'];
|
|
|
678 |
|
525 |
jpm |
679 |
$id_obs = $donnees['id'];
|
528 |
jpm |
680 |
$famille = $donnees['famille'];
|
|
|
681 |
$nom_saisi = $donnees['nom_sel'];
|
|
|
682 |
$nom_retenu = $donnees['nom_ret'];
|
525 |
jpm |
683 |
$mots_cles_obs = $this->decoderMotsClesObs($donnees['identifiant'], $donnees['mots_cles']);
|
528 |
jpm |
684 |
$lieu = $donnees['location'].' ('.$donnees['id_location'].') > '.$donnees['lieudit'].' > '.$donnees['station'];
|
|
|
685 |
$milieu = $donnees['milieu'];
|
525 |
jpm |
686 |
$coordonnees = ($this->etreNull($donnees['coord_x']) && $this->etreNull($donnees['coord_y'])) ? '' : $donnees['coord_x'].'/'.$donnees['coord_y'];
|
528 |
jpm |
687 |
$commentaire_obs = $donnees['commentaire'];
|
525 |
jpm |
688 |
$date_observation = $this->formaterDate($donnees['date_observation'], '%A %d %B %Y');
|
|
|
689 |
$date_transmission = $this->formaterDate($donnees['date_transmission']);
|
|
|
690 |
$date_modification = $this->formaterDate($donnees['date_modification']);
|
|
|
691 |
$date_creation = $this->formaterDate($donnees['date_creation']);
|
|
|
692 |
$transmission = $donnees['transmission'] == 1 ? "oui ($date_transmission)" : 'non';
|
523 |
jpm |
693 |
|
525 |
jpm |
694 |
$description = '<style>.champ{color:grey} .gauche{float:left;padding:0 20px 0 0;} ul{list-style-type:none;padding:0;}</style>'.
|
603 |
jpm |
695 |
'<h2>'.(!$this->etreNull($id_obs) ? "Image #$id_img liée à l'observation #$id_obs" : "Image #$id_img non liée à une observation.").'</h2>'.
|
630 |
jpm |
696 |
'<a href="'.$url_img_normale.'"><img class="gauche" src="'.$url_img.'" alt="'.$nom_fichier.'" /></a>'.
|
525 |
jpm |
697 |
'<div class="gauche">'.
|
|
|
698 |
'<h3>'.'Image'.'</h3>'.
|
|
|
699 |
'<ul>'.
|
630 |
jpm |
700 |
'<li>'.'<span class="champ">URL :</span> <a href="'.$url_img_normale.'" onclick="javascript:window.open(this.href);return false;">'.$url_img_normale.'</a></li>'.
|
525 |
jpm |
701 |
'<li>'.'<span class="champ">Importée le :</span> '.$item['date_maj_simple'].'</li>'.
|
|
|
702 |
'<li>'.'<span class="champ">Par :</span> '.
|
813 |
delphine |
703 |
(($this->etreFluxAdmin()) ? '<a href="mailto:'.$auteur_mail.'">'.$auteur.'</a>' : $auteur).
|
525 |
jpm |
704 |
'</li>'.
|
528 |
jpm |
705 |
'<li>'.'<span class="champ">Nom du fichier :</span> '.$nom_fichier.'</li>'.
|
|
|
706 |
'<li>'.'<span class="champ">Note qualité :</span> '.$note.'</li>'.
|
|
|
707 |
'<li>'.'<span class="champ">Commentaires :</span> '.$commentaire_img.'</li>'.
|
525 |
jpm |
708 |
'<li>'.'<span class="champ">Mots-clés :</span> '.implode(', ', $mots_cles_image).'</li>'.
|
|
|
709 |
'</ul>'.
|
603 |
jpm |
710 |
'</div>';
|
525 |
jpm |
711 |
// TODO : ajouter le champ commentaire EXIF.
|
603 |
jpm |
712 |
if (! $this->etreNull($id_obs)) {
|
|
|
713 |
$description .=
|
|
|
714 |
'<div class="gauche">'.
|
|
|
715 |
'<h3>'.'Observation'.'</h3>'.
|
|
|
716 |
'<ul>'.
|
|
|
717 |
'<li>'.'<span class="champ">Famille :</span> '.$famille.'</li>'.
|
|
|
718 |
'<li>'.'<span class="champ">Nom saisi :</span> '.$nom_saisi.'</li>'.
|
|
|
719 |
'<li>'.'<span class="champ">Nom retenu :</span> '.$nom_retenu.'</li>'.
|
|
|
720 |
'<li>'.'<span class="champ">Observée le :</span> '.$date_observation.'</li>'.
|
|
|
721 |
'<li>'.'<span class="champ">Lieu :</span> '.$lieu.'</li>'.
|
|
|
722 |
'<li>'.'<span class="champ">Milieu :</span> '.$milieu.'</li>'.
|
|
|
723 |
(($this->etreFluxAdmin()) ? '<li><span class="champ">Coordonnées (Lat/Long) :</span> '.$coordonnees.'</li>' : '').
|
|
|
724 |
'<li>'.'<span class="champ">Commentaire :</span> '.$commentaire_obs.'</li>'.
|
|
|
725 |
'<li>'.'<span class="champ">Mots-clés :</span> '.implode(', ', $mots_cles_obs).'</li>'.
|
|
|
726 |
(($this->etreFluxAdmin()) ? '<li><span class="champ">Transmis (= public) :</span> '.$transmission.'</li>' : '').
|
|
|
727 |
'<li><span class="champ">Modifiée le :</span> '.$date_modification.'</li>'.
|
|
|
728 |
'<li><span class="champ">Créée le :</span> '.$date_creation.'</li>'.
|
|
|
729 |
'</ul>'.
|
|
|
730 |
'</div>';
|
|
|
731 |
}
|
522 |
jpm |
732 |
$description = $this->nettoyerTexte($description);
|
|
|
733 |
return $description;
|
416 |
aurelien |
734 |
}
|
525 |
jpm |
735 |
|
|
|
736 |
private function getServiceParMotsCles() {
|
742 |
delphine |
737 |
$infos=array();
|
|
|
738 |
$infos[0]['num_nom_sel'] = '';
|
|
|
739 |
$infos[0]['ci_meta_date_ajout'] = '2011-06-28';
|
|
|
740 |
$donnees = $this->construireDonneesCommunesAuFlux($infos);
|
|
|
741 |
$donnees['items'][0]['guid'] = 0;
|
|
|
742 |
$donnees['items'][0]['description'] = 'Ce flux est devenu obsolète. Veuillez utiliser le flux '.
|
|
|
743 |
'<b>http://www.tela-botanica.org/eflore/cel2/jrest/CelSyndicationImage/multicriteres/atom?tag=';
|
|
|
744 |
if (isset($this->parametres[0])) {
|
|
|
745 |
$donnees['items'][0]['description'] .= $this->parametres[0].'</b>';
|
525 |
jpm |
746 |
} else {
|
742 |
delphine |
747 |
$donnees['items'][0]['description'] .= '</b>';
|
525 |
jpm |
748 |
}
|
742 |
delphine |
749 |
$donnees['items'][0]['titre'] = '';
|
|
|
750 |
$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
|
525 |
jpm |
751 |
return $contenu;
|
|
|
752 |
}
|
|
|
753 |
|
|
|
754 |
private function getServiceParCommune() {
|
742 |
delphine |
755 |
$infos=array();
|
|
|
756 |
$infos[0]['num_nom_sel'] = '';
|
|
|
757 |
$infos[0]['ci_meta_date_ajout'] = '2011-06-28';
|
|
|
758 |
$donnees = $this->construireDonneesCommunesAuFlux($infos);
|
|
|
759 |
$donnees['items'][0]['guid'] = 0;
|
|
|
760 |
$donnees['items'][0]['description'] = 'Ce flux est devenu obsolète. Veuillez utiliser le flux '.
|
|
|
761 |
'<b>http://www.tela-botanica.org/eflore/cel2/jrest/CelSyndicationImage/multicriteres/atom?commune=';
|
|
|
762 |
if (isset($this->parametres[0])) {
|
|
|
763 |
$donnees['items'][0]['description'] .= $this->parametres[0].'</b>';
|
525 |
jpm |
764 |
} else {
|
742 |
delphine |
765 |
$donnees['items'][0]['description'] .= '</b>';
|
525 |
jpm |
766 |
}
|
742 |
delphine |
767 |
$donnees['items'][0]['titre'] = '';
|
|
|
768 |
$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
|
525 |
jpm |
769 |
return $contenu;
|
|
|
770 |
}
|
416 |
aurelien |
771 |
}
|