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