Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1361 Rev 1410
1
<?php
1
<?php
2
/**
2
/**
3
 * Service fournissant des informations concernant le CEL au format RSS1, RSS2 ou ATOM.
3
 * Service fournissant des informations concernant le CEL au format RSS1, RSS2 ou ATOM.
4
 * Encodage en entrée : utf8
4
 * Encodage en entrée : utf8
5
 * Encodage en sortie : utf8
5
 * Encodage en sortie : utf8
6
 * Format du service :
6
 * Format du service :
7
 * /CelSyndicationObservation/liste-des-flux
7
 * /CelSyndicationObservation/liste-des-flux
8
 * /CelSyndicationObservation/opml
8
 * /CelSyndicationObservation/opml
9
 * /CelSyndicationObservation/par-defaut/(rss1|rss2|atom)?start=0&limit=150
9
 * /CelSyndicationObservation/par-defaut/(rss1|rss2|atom)?start=0&limit=150
10
 * /CelSyndicationObservation/pour-admin/(rss1|rss2|atom)?start=0&limit=150
10
 * /CelSyndicationObservation/pour-admin/(rss1|rss2|atom)?start=0&limit=150
11
 * /CelSyndicationObservation/par-mots-cles/(rss1|rss2|atom)/mot-cle?start=0&limit=150
11
 * /CelSyndicationObservation/par-mots-cles/(rss1|rss2|atom)/mot-cle?start=0&limit=150
12
 * /CelSyndicationObservation/par-commune/(rss1|rss2|atom)/nom-commune?start=0&limit=150
12
 * /CelSyndicationObservation/par-commune/(rss1|rss2|atom)/nom-commune?start=0&limit=150
13
 *
13
 *
14
 * Les paramêtres :
14
 * Les paramêtres :
15
 *  - "start" indique le numéro du premier item à afficher
15
 *  - "start" indique le numéro du premier item à afficher
16
 *  - "limit" nombre d'items à afficher
16
 *  - "limit" nombre d'items à afficher
17
 *
17
 *
18
 * @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
18
 * @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
19
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
19
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
20
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
20
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
21
 * @version $Id$
21
 * @version $Id$
22
 * @copyright 2010
22
 * @copyright 2010
23
 */
23
 */
24
class CelSyndicationObservation extends Cel {
24
class CelSyndicationObservation extends Cel {
25
 
25
 
26
	private $parametres_origines = null;
26
	private $parametres_origines = null;
27
	private $format = null;
27
	private $format = null;
28
	private $service = null;
28
	private $service = null;
29
	private $squelette = null;
29
	private $squelette = null;
30
	private $squelette_dossier = null;
30
	private $squelette_dossier = null;
31
	private $auteurs = array();
31
	private $auteurs = array();
32
	private $flux = array();
32
	private $flux = array();
33
	private $criteres = array(
33
	private $criteres = array(
34
		'utilisateur' => 'courriel_utilisateur',
34
		'utilisateur' => 'courriel_utilisateur',
35
		'commune' => 'zone_geo',
35
		'commune' => 'zone_geo',
36
		'dept' => 'ce_zone_geo',
36
		'dept' => 'ce_zone_geo',
37
		'taxon' => 'nom_ret',
37
		'taxon' => 'nom_ret',
38
		'commentaire' => 'commentaire',
38
		'commentaire' => 'commentaire',
39
		'date' => 'date_observation',
39
		'date' => 'date_observation',
40
		'projet' => 'mots-cles');
40
		'projet' => 'mots-cles');
41
 
41
 
42
	/**
42
	/**
43
	 * Méthode appelée avec une requête de type GET.
43
	 * Méthode appelée avec une requête de type GET.
44
	 */
44
	 */
45
	public function getElement($params = array()) {
45
	public function getElement($params = array()) {
46
		// Initialisation des variables
46
		// Initialisation des variables
47
		$this->parametres_origines = $params;
47
		$this->parametres_origines = $params;
48
		$info = array();
48
		$info = array();
49
		$contenu = '';
49
		$contenu = '';
50
 
50
 
51
		if (! $this->etreFluxAdmin() || $this->authentifierAdmin()) {
51
		if (! $this->etreFluxAdmin() || $this->authentifierAdmin()) {
52
			// Pré traitement des paramêtres
52
			// Pré traitement des paramêtres
53
			$pour_bdd = false;
53
			$pour_bdd = false;
54
			$p = $this->traiterParametres(array('service', 'format'), $params, $pour_bdd);
54
			$p = $this->traiterParametres(array('service', 'format'), $params, $pour_bdd);
55
			extract($p);
55
			extract($p);
56
			$this->parametres = $params;
56
			$this->parametres = $params;
57
			$this->squelette_dossier = dirname(__FILE__).DIRECTORY_SEPARATOR.'squelettes'.DIRECTORY_SEPARATOR;
57
			$this->squelette_dossier = dirname(__FILE__).DIRECTORY_SEPARATOR.'squelettes'.DIRECTORY_SEPARATOR;
58
 
58
 
59
			// Récupération de la liste des flux
59
			// Récupération de la liste des flux
60
			$this->chargerListeDesFlux();
60
			$this->chargerListeDesFlux();
61
 
61
 
62
			// Chargement du bon type de service demandé
62
			// Chargement du bon type de service demandé
63
			if (isset($service)) {
63
			if (isset($service)) {
64
				$this->service = $this->traiterNomService($service);
64
				$this->service = $this->traiterNomService($service);
65
				$methode = $this->getNomMethodeService();
65
				$methode = $this->getNomMethodeService();
66
				if (method_exists($this, $methode)) {
66
				if (method_exists($this, $methode)) {
67
					if (isset($format) && preg_match('/^(?:rss1|rss2|atom)$/i', $format)) {
67
					if (isset($format) && preg_match('/^(?:rss1|rss2|atom)$/i', $format)) {
68
						// Mise en minuscule de l'indication du format
68
						// Mise en minuscule de l'indication du format
69
						$this->format = strtolower($format);
69
						$this->format = strtolower($format);
70
						// Définition du fichier squelette demandé
70
						// Définition du fichier squelette demandé
71
						$this->squelette = $this->squelette_dossier.$this->format.'.tpl.xml';
71
						$this->squelette = $this->squelette_dossier.$this->format.'.tpl.xml';
72
					} else if (isset($this->flux[$this->service])) {
72
					} else if (isset($this->flux[$this->service])) {
73
						$this->format = '';
73
						$this->format = '';
74
						$this->messages[] = "Le service CEL Syndication nécessite d'indiquer en second paramètre le format : rss1, rss2 ou atom.";
74
						$this->messages[] = "Le service CEL Syndication nécessite d'indiquer en second paramètre le format : rss1, rss2 ou atom.";
75
					}
75
					}
76
 
76
 
77
					if (!isset($this->flux[$this->service]) || isset($this->format)) {
77
					if (!isset($this->flux[$this->service]) || isset($this->format)) {
78
						// Suppression des paramêtres inutile pour le reste des méthodes
78
						// Suppression des paramêtres inutile pour le reste des méthodes
79
						array_shift($this->parametres);
79
						array_shift($this->parametres);
80
						array_shift($this->parametres);
80
						array_shift($this->parametres);
81
 
81
 
82
						// Récupération du contenu à renvoyer
82
						// Récupération du contenu à renvoyer
83
						$contenu = $this->$methode();
83
						$contenu = $this->$methode();
84
					}
84
					}
85
				} else {
85
				} else {
86
					$this->messages[] = "Le type d'information demandé '$this->service' n'est pas disponible.";
86
					$this->messages[] = "Le type d'information demandé '$this->service' n'est pas disponible.";
87
				}
87
				}
88
			} else {
88
			} else {
89
				$this->messages[] = "Le service CEL Syndication Observation nécessite d'indiquer en premier paramètre le type d'information demandé.";
89
				$this->messages[] = "Le service CEL Syndication Observation nécessite d'indiquer en premier paramètre le type d'information demandé.";
90
			}
90
			}
91
		}
91
		}
92
 
92
 
93
		// Envoie sur la sortie standard
93
		// Envoie sur la sortie standard
94
		$encodage = 'utf-8';
94
		$encodage = 'utf-8';
95
		$mime = $this->getTypeMime();
95
		$mime = $this->getTypeMime();
96
		$formatage_json = $this->getFormatageJson();
96
		$formatage_json = $this->getFormatageJson();
97
		$this->envoyer($contenu, $mime, $encodage, $formatage_json);
97
		$this->envoyer($contenu, $mime, $encodage, $formatage_json);
98
	}
98
	}
99
 
99
 
100
	private function getUrlBase() {
100
	private function getUrlBase() {
101
		$url_base = sprintf($this->config['settings']['baseURLAbsolu'], get_class($this).'/');
101
		$url_base = sprintf($this->config['settings']['baseURLAbsolu'], get_class($this).'/');
102
		return $url_base;
102
		return $url_base;
103
	}
103
	}
104
 
104
 
105
	private function getUrlServiceBase() {
105
	private function getUrlServiceBase() {
106
		$url_service = $this->getUrlBase().implode('/', $this->parametres_origines);
106
		$url_service = $this->getUrlBase().implode('/', $this->parametres_origines);
107
		return $url_service;
107
		return $url_service;
108
	}
108
	}
109
 
109
 
110
	private function traiterNomService($nom) {
110
	private function traiterNomService($nom) {
111
		$nom = strtolower($nom);
111
		$nom = strtolower($nom);
112
		return $nom;
112
		return $nom;
113
	}
113
	}
114
 
114
 
115
	private function getNomMethodeService() {
115
	private function getNomMethodeService() {
116
		$methode = '';
116
		$methode = '';
117
		$service_formate = str_replace(' ', '', ucwords(implode(' ', explode('-', $this->service))));
117
		$service_formate = str_replace(' ', '', ucwords(implode(' ', explode('-', $this->service))));
118
		$methode = 'getService'.$service_formate;
118
		$methode = 'getService'.$service_formate;
119
		return $methode;
119
		return $methode;
120
	}
120
	}
121
 
121
 
122
	private function getTypeMime() {
122
	private function getTypeMime() {
123
		$mime = '';
123
		$mime = '';
124
		$test = isset($this->format) ? $this->format : $this->service;
124
		$test = isset($this->format) ? $this->format : $this->service;
125
		switch ($test) {
125
		switch ($test) {
126
			case 'atom' :
126
			case 'atom' :
127
				$mime = 'application/atom+xml';
127
				$mime = 'application/atom+xml';
128
				break;
128
				break;
129
			case 'rss1' :
129
			case 'rss1' :
130
			case 'rss2' :
130
			case 'rss2' :
131
				$mime = 'application/rss+xml';
131
				$mime = 'application/rss+xml';
132
				break;
132
				break;
133
			case 'opml' :
133
			case 'opml' :
134
				$mime = 'text/x-opml';
134
				$mime = 'text/x-opml';
135
				break;
135
				break;
136
			default:
136
			default:
137
				$mime = 'text/html';
137
				$mime = 'text/html';
138
		}
138
		}
139
		return $mime;
139
		return $mime;
140
	}
140
	}
141
 
141
 
142
	private function getFormatageJson() {
142
	private function getFormatageJson() {
143
		$json = false;
143
		$json = false;
144
		switch ($this->service) {
144
		switch ($this->service) {
145
			case 'liste-des-flux' :
145
			case 'liste-des-flux' :
146
				$json = true;
146
				$json = true;
147
				break;
147
				break;
148
			default:
148
			default:
149
				$json = false;
149
				$json = false;
150
		}
150
		}
151
		return $json;
151
		return $json;
152
	}
152
	}
153
 
153
 
154
	private function getFlux($nom) {
154
	private function getFlux($nom) {
155
		return isset($this->flux[$nom]) ? $this->flux[$nom] : array();
155
		return isset($this->flux[$nom]) ? $this->flux[$nom] : array();
156
	}
156
	}
157
 
157
 
158
	private function setFlux($nom, $titre, $description) {
158
	private function setFlux($nom, $titre, $description) {
159
		$url_base = $this->getUrlBase();
159
		$url_base = $this->getUrlBase();
160
		$formats = array('atom', 'rss2', 'rss1');
160
		$formats = array('atom', 'rss2', 'rss1');
161
		$flux = array();
161
		$flux = array();
162
		foreach ($formats as $format) {
162
		foreach ($formats as $format) {
163
			$url = $url_base.$nom.'/'.$format;
163
			$url = $url_base.$nom.'/'.$format;
164
			$flux[$format] = $url;
164
			$flux[$format] = $url;
165
		}
165
		}
166
		$this->flux[$nom] = array('titre' => $titre, 'description' => $description, 'urls' => $flux);
166
		$this->flux[$nom] = array('titre' => $titre, 'description' => $description, 'urls' => $flux);
167
	}
167
	}
168
 
168
 
169
	private function chargerListeDesFlux() {
169
	private function chargerListeDesFlux() {
170
		$this->setFlux('par-defaut', 'Flux de syndication des observations publiques du CEL',
170
		$this->setFlux('par-defaut', 'Flux de syndication des observations publiques du CEL',
171
			'Ce flux fournit des informations sur les observations du CEL.');
171
			'Ce flux fournit des informations sur les observations du CEL.');
172
		$this->setFlux('par-mots-cles', 'Flux de syndication obsolète',
172
		$this->setFlux('par-mots-cles', 'Flux de syndication obsolète',
173
			"Ce flux est désormais accessible via le flux multicriteres/atom/M?tag='mot-cle'.");
173
			"Ce flux est désormais accessible via le flux multicriteres/atom/M?tag='mot-cle'.");
174
		$this->setFlux('par-commune','Flux de syndication obsolète',
174
		$this->setFlux('par-commune','Flux de syndication obsolète',
175
			"Ce flux  est désormais accessible via le flux multicriteres/atom/M?commune='commune'.");
175
			"Ce flux  est désormais accessible via le flux multicriteres/atom/M?commune='commune'.");
176
		$this->setFlux('multicriteres','Flux de syndication des nouvelles observations publiques du CEL '.
176
		$this->setFlux('multicriteres','Flux de syndication des nouvelles observations publiques du CEL '.
177
			'filtrées par un ou plusieurs critères',
177
			'filtrées par un ou plusieurs critères',
178
			"Ce flux fournit des informations sur les nouvelles observations du CEL filtrées par ".
178
			"Ce flux fournit des informations sur les nouvelles observations du CEL filtrées par ".
179
			"auteur (mail), commune (nom), departement (code postal), taxon (nom scientifique), commentaire, projet ".
179
			"auteur (mail), commune (nom), departement (code postal), taxon (nom scientifique), commentaire, projet ".
180
			"et/ou date.");
180
			"et/ou date.");
181
	}
181
	}
182
 
182
 
183
	private function getServiceListeDesFlux() {
183
	private function getServiceListeDesFlux() {
184
		return $this->flux;
184
		return $this->flux;
185
	}
185
	}
186
 
186
 
187
	private function getServiceOpml() {
187
	private function getServiceOpml() {
188
		$donnees = array();
188
		$donnees = array();
189
		$id = 1;
189
		$id = 1;
190
		foreach ($this->flux as $flux_nom => $flux){
190
		foreach ($this->flux as $flux_nom => $flux){
191
			$info = array();
191
			$info = array();
192
			$info['type'] = 'atom';
192
			$info['type'] = 'atom';
193
			$info['titre'] = $flux['titre'];
193
			$info['titre'] = $flux['titre'];
194
			$info['texte'] = "CEL - Obs - $flux_nom";
194
			$info['texte'] = "CEL - Obs - $flux_nom";
195
			$info['description'] = $flux['description'];
195
			$info['description'] = $flux['description'];
196
			$info['url_xml'] = $this->getUrlBase().$flux_nom.'/atom';
196
			$info['url_xml'] = $this->getUrlBase().$flux_nom.'/atom';
197
			$info['url_html'] = $this->config['settings']['aideCelUrl'].'FluxSyndication';
197
			$info['url_html'] = $this->config['settings']['aideCelUrl'].'FluxSyndication';
198
			$donnees['liste_flux'][] = $info;
198
			$donnees['liste_flux'][] = $info;
199
		}
199
		}
200
 
200
 
201
		$this->squelette = $this->squelette_dossier.'opml.tpl.xml';
201
		$this->squelette = $this->squelette_dossier.'opml.tpl.xml';
202
		$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
202
		$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
203
		return $contenu;
203
		return $contenu;
204
	}
204
	}
205
 
205
 
206
	private function getServiceParDefaut() {
206
	private function getServiceParDefaut() {
207
		// Construction de la requête
207
		// Construction de la requête
208
		$requete = 	(isset($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' * '.
208
		$requete = 	(isset($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' * '.
209
			'FROM cel_obs '.
209
			'FROM cel_obs '.
210
			(($this->etreFluxAdmin()) ? '' : 'WHERE transmission = 1 ').
210
			(($this->etreFluxAdmin()) ? '' : 'WHERE transmission = 1 ').
211
			'ORDER BY '.(isset($this->orderby) && (!is_null($this->orderby)) ? $this->orderby  : 'date_modification DESC').' '.
211
			'ORDER BY '.(isset($this->orderby) && (!is_null($this->orderby)) ? $this->orderby  : 'date_modification DESC').' '.
212
			"LIMIT $this->start,$this->limit ";
212
			"LIMIT $this->start,$this->limit ";
213
 
213
 
214
		$elements = $this->executerRequete($requete);
214
		$elements = $this->executerRequete($requete);
215
 
215
 
216
		// Création du contenu
216
		// Création du contenu
217
		$contenu = $this->executerService($elements);
217
		$contenu = $this->executerService($elements);
218
		return $contenu;
218
		return $contenu;
219
	}
219
	}
220
 
220
 
221
	private function getServiceParMotsCles() {
221
	private function getServiceParMotsCles() {
222
		$infos=array();
222
		$infos=array();
223
		$infos[0]['nom_sel_nn'] = '';
223
		$infos[0]['nom_sel_nn'] = '';
224
		$infos[0]['date_modification'] = '2011-06-28';
224
		$infos[0]['date_modification'] = '2011-06-28';
225
		$donnees = $this->construireDonneesCommunesAuFlux($infos);
225
		$donnees = $this->construireDonneesCommunesAuFlux($infos);
226
		$donnees['items'][0]['guid'] = 0;
226
		$donnees['items'][0]['guid'] = 0;
227
		$donnees['items'][0]['description'] =  'Ce flux est devenu obsolète. Veuillez utiliser le flux '.
227
		$donnees['items'][0]['description'] =  'Ce flux est devenu obsolète. Veuillez utiliser le flux '.
228
			'<b>http://www.tela-botanica.org/eflore/cel2/jrest/CelSyndicationObservation/multicriteres/atom?projet=';
228
			'<b>http://www.tela-botanica.org/eflore/cel2/jrest/CelSyndicationObservation/multicriteres/atom?projet=';
229
		if (isset($this->parametres[0])) {
229
		if (isset($this->parametres[0])) {
230
			$donnees['items'][0]['description'] .= $this->parametres[0].'</b>';
230
			$donnees['items'][0]['description'] .= $this->parametres[0].'</b>';
231
		} else {
231
		} else {
232
			$donnees['items'][0]['description'] .= '</b>';
232
			$donnees['items'][0]['description'] .= '</b>';
233
		}
233
		}
234
		$donnees['items'][0]['titre'] = '';
234
		$donnees['items'][0]['titre'] = '';
235
		$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
235
		$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
236
		return $contenu;
236
		return $contenu;
237
	}
237
	}
238
 
238
 
239
	private function getServiceParCommune() {
239
	private function getServiceParCommune() {
240
		$infos=array();
240
		$infos=array();
241
		$infos[0]['nom_sel_nn'] = '';
241
		$infos[0]['nom_sel_nn'] = '';
242
		$infos[0]['date_modification'] = '2011-06-28';
242
		$infos[0]['date_modification'] = '2011-06-28';
243
		$donnees = $this->construireDonneesCommunesAuFlux($infos);
243
		$donnees = $this->construireDonneesCommunesAuFlux($infos);
244
		$donnees['items'][0]['guid'] = 0;
244
		$donnees['items'][0]['guid'] = 0;
245
		$donnees['items'][0]['description'] = 'Ce flux est devenu obsolète. Veuillez utiliser le flux '.
245
		$donnees['items'][0]['description'] = 'Ce flux est devenu obsolète. Veuillez utiliser le flux '.
246
			'<b>http://www.tela-botanica.org/eflore/cel2/jrest/CelSyndicationObservation/multicriteres/atom?commune=';
246
			'<b>http://www.tela-botanica.org/eflore/cel2/jrest/CelSyndicationObservation/multicriteres/atom?commune=';
247
		if (isset($this->parametres[0])) {
247
		if (isset($this->parametres[0])) {
248
			$donnees['items'][0]['description'] .= $this->parametres[0].'</b>';
248
			$donnees['items'][0]['description'] .= $this->parametres[0].'</b>';
249
		} else {
249
		} else {
250
			$donnees['items'][0]['description'] .= '</b>';
250
			$donnees['items'][0]['description'] .= '</b>';
251
		}
251
		}
252
		$donnees['items'][0]['titre'] = '';
252
		$donnees['items'][0]['titre'] = '';
253
		$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
253
		$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
254
		return $contenu;
254
		return $contenu;
255
	}
255
	}
256
 
256
 
257
	private function getServiceMultiCriteres() {
257
	private function getServiceMultiCriteres() {
258
		$contenu = '';
258
		$contenu = '';
259
		if (isset($_GET['debut'])) $this->start = $_GET['debut'];
259
		if (isset($_GET['debut'])) $this->start = $_GET['debut'];
260
		if (isset($_GET['limite'])) $this->limite = $_GET['limite'];
260
		if (isset($_GET['limite'])) $this->limite = $_GET['limite'];
261
 
261
 
262
		// Construction de la requête
262
		// Construction de la requête
263
		$requete = (isset($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' * '.
263
		$requete = (isset($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' * '.
264
				'FROM cel_obs '.
264
				'FROM cel_obs '.
265
				'WHERE 1 AND '.(($this->etreFluxAdmin()) ? '' : ' transmission = 1 AND ');
265
				'WHERE 1 AND '.(($this->etreFluxAdmin()) ? '' : ' transmission = 1 AND ');
266
 
266
 
267
		if ($this->estUneRechercheGenerale()) {
267
		if ($this->estUneRechercheGenerale()) {
268
			$chaine_requete = $_GET['recherche'];
268
			$chaine_requete = $_GET['recherche'];
269
			$requete .= $this->creerSousRequeteRechercheGenerale($chaine_requete);
269
			$requete .= $this->creerSousRequeteRechercheGenerale($chaine_requete);
270
		} else {
270
		} else {
271
			$criteres = $this->traiterCriteresMultiples($_GET) ;
271
			$criteres = $this->traiterCriteresMultiples($_GET) ;
272
			if (!empty($criteres)) {
272
			if (!empty($criteres)) {
273
				$requete .= $this->creerSousRequeteRechercheParCriteres($criteres);
273
				$requete .= $this->creerSousRequeteRechercheParCriteres($criteres);
274
			}
274
			}
275
		}
275
		}
276
		$requete = rtrim($requete, 'AND ');
276
		$requete = rtrim($requete, 'AND ');
277
		$requete .= ' ORDER BY '.(isset($this->orderby) && (!is_null($this->orderby)) ? $this->orderby  :
277
		$requete .= ' ORDER BY '.(isset($this->orderby) && (!is_null($this->orderby)) ? $this->orderby  :
278
			'date_modification DESC, zone_geo ASC').' '.
278
			'date_modification DESC, zone_geo ASC').' '.
279
				"LIMIT $this->start,$this->limit ";
279
				"LIMIT $this->start,$this->limit ";
280
 
280
 
281
		$elements = $this->executerRequete($requete);
281
		$elements = $this->executerRequete($requete);
282
 
282
 
283
		// Création du contenu
283
		// Création du contenu
284
		if ($elements != false && count($elements) > 0) {
284
		if ($elements != false && count($elements) > 0) {
285
			$contenu = $this->executerService($elements);
285
			$contenu = $this->executerService($elements);
286
		} else {
286
		} else {
287
			$this->messages[] = "Aucune observation disponible.";
287
			$this->messages[] = "Aucune observation disponible.";
288
		}
288
		}
289
 
289
 
290
        return $contenu;
290
        return $contenu;
291
	}
291
	}
292
 
292
 
293
	private function creerSousRequeteRechercheParCriteres($criteres) {
293
	private function creerSousRequeteRechercheParCriteres($criteres) {
294
		$requete = '';
294
		$requete = '';
295
		foreach ($criteres as $pair) {
295
		foreach ($criteres as $pair) {
296
			$nom_valeur = explode("=",$pair);
296
			$nom_valeur = explode("=",$pair);
297
			if (sizeof($nom_valeur) != 0) {
297
			if (sizeof($nom_valeur) != 0) {
298
				switch ($nom_valeur[0]) {
298
				switch ($nom_valeur[0]) {
299
					case "ci_limite" : $this->limite = $this->bdd->quote($nom_valeur[1]); break;
299
					case "ci_limite" : $this->limite = $this->bdd->quote($nom_valeur[1]); break;
300
					case "commentaire" : $mots_comment_liste = explode(" " , $nom_valeur[1]);
300
					case "commentaire" : $mots_comment_liste = explode(" " , $nom_valeur[1]);
301
						foreach($mots_comment_liste as $mot_comment) {
301
						foreach($mots_comment_liste as $mot_comment) {
302
							$mot_comment = trim($mot_comment) ;
302
							$mot_comment = trim($mot_comment) ;
303
							$requete .= $nom_valeur[0].' LIKE '.$this->bdd->quote('%'.$mot_comment.'%').' AND ';
303
							$requete .= $nom_valeur[0].' LIKE '.$this->bdd->quote('%'.$mot_comment.'%').' AND ';
304
						}
304
						}
305
						break;
305
						break;
306
					case "date_observation" :
306
					case "date_observation" :
307
						$nom_valeur[1] = str_replace('/', '-', $nom_valeur[1]);
307
						$nom_valeur[1] = str_replace('/', '-', $nom_valeur[1]);
308
						if (preg_match('/(^[0-9]{2})-([0-9]{2})-([0-9]{4}$)/', $nom_valeur[1], $matches)) {
308
						if (preg_match('/(^[0-9]{2})-([0-9]{2})-([0-9]{4}$)/', $nom_valeur[1], $matches)) {
309
							$nom_valeur[1] = $matches[3].'-'.$matches[2].'-'.$matches[1];
309
							$nom_valeur[1] = $matches[3].'-'.$matches[2].'-'.$matches[1];
310
						}
310
						}
311
						$requete .= $nom_valeur[0].'='.$this->bdd->quote($nom_valeur[1]).' AND '; break;
311
						$requete .= $nom_valeur[0].'='.$this->bdd->quote($nom_valeur[1]).' AND '; break;
312
					case "ce_zone_geo" :
312
					case "ce_zone_geo" :
313
						$requete .= ' ('.$nom_valeur[0].' LIKE "INSEE-C:'.$nom_valeur[1].'%") AND '; break;
313
						$requete .= ' ('.$nom_valeur[0].' LIKE "INSEE-C:'.$nom_valeur[1].'%") AND '; break;
314
					case "nom_ret" :
314
					case "nom_ret" :
315
						if ($nom_valeur[1] == "indetermine") $nom_valeur[1] = 'null';
315
						if ($nom_valeur[1] == "indetermine") $nom_valeur[1] = 'null';
316
						$requete .= ' ('.$nom_valeur[0].' LIKE "%'.$nom_valeur[1].'%" OR nom_sel LIKE "%'.
316
						$requete .= ' ('.$nom_valeur[0].' LIKE "%'.$nom_valeur[1].'%" OR nom_sel LIKE "%'.
317
							$nom_valeur[1].'%") AND '; break;
317
							$nom_valeur[1].'%") AND '; break;
318
					case "mots-cles" : $requete .= $this->creerSousRequeteMotsCles($nom_valeur[1]).' AND '; break;
318
					case "mots-cles" : $requete .= $this->creerSousRequeteMotsCles($nom_valeur[1]).' AND '; break;
319
					default : $requete .= $nom_valeur[0].' = "'.$nom_valeur[1].'" AND '; break;
319
					default : $requete .= $nom_valeur[0].' = "'.$nom_valeur[1].'" AND '; break;
320
				}
320
				}
321
			}
321
			}
322
		}
322
		}
323
		$requete = rtrim($requete,' AND ');
323
		$requete = rtrim($requete,' AND ');
324
		return $requete;
324
		return $requete;
325
	}
325
	}
326
 
326
 
327
	private function creerSousRequeteMotsCles($mot_cle) {
327
	private function creerSousRequeteMotsCles($mot_cle) {
328
		$requete = '';
328
		$requete = '';
329
		if (preg_match('/.*OU.*/', $mot_cle)) {
329
		if (preg_match('/.*OU.*/', $mot_cle)) {
330
			$mots_cles_tab = explode('OU',$mot_cle);
330
			$mots_cles_tab = explode('OU',$mot_cle);
331
			foreach($mots_cles_tab as $mot_cle_item) {
331
			foreach($mots_cles_tab as $mot_cle_item) {
332
				$requete .= '(mots_cles_texte LIKE '.$this->proteger('%'.$mot_cle_item.'%').') OR ';
332
				$requete .= '(mots_cles_texte LIKE '.$this->proteger('%'.$mot_cle_item.'%').') OR ';
333
			}
333
			}
334
			$requete = '('.rtrim($requete,'OR ').') ';
334
			$requete = '('.rtrim($requete,'OR ').') ';
335
		} else if (preg_match('/.*ET.*/', $mot_cle)) {
335
		} else if (preg_match('/.*ET.*/', $mot_cle)) {
336
			$mots_cles_tab = explode('ET',$mot_cle);
336
			$mots_cles_tab = explode('ET',$mot_cle);
337
			foreach($mots_cles_tab as $mot_cle_item) {
337
			foreach($mots_cles_tab as $mot_cle_item) {
338
				$requete .= '(mots_cles_texte LIKE '.$this->proteger('%'.$mot_cle_item.'%').') AND ';
338
				$requete .= '(mots_cles_texte LIKE '.$this->proteger('%'.$mot_cle_item.'%').') AND ';
339
			}
339
			}
340
			$requete = '('.rtrim($requete, 'AND ').') ';
340
			$requete = '('.rtrim($requete, 'AND ').') ';
341
		} else {
341
		} else {
342
			$requete = "(mots_cles_texte LIKE ".$this->proteger('%'.$mot_cle.'%').') ';
342
			$requete = "(mots_cles_texte LIKE ".$this->proteger('%'.$mot_cle.'%').') ';
343
		}
343
		}
344
		return $requete;
344
		return $requete;
345
	}
345
	}
346
 
346
 
347
	private function traiterCriteresMultiples($tableau_criteres) {
347
	private function traiterCriteresMultiples($tableau_criteres) {
348
		$tableau_criteres_pour_bdd = array();
348
		$tableau_criteres_pour_bdd = array();
349
 
349
 
350
		foreach($tableau_criteres as $nom_critere => $valeur_critere) {
350
		foreach($tableau_criteres as $nom_critere => $valeur_critere) {
351
			if (isset($this->criteres[$nom_critere])) {
351
			if (isset($this->criteres[$nom_critere])) {
352
				$tableau_criteres_pour_bdd[] = $this->criteres[$nom_critere].'='.$valeur_critere;
352
				$tableau_criteres_pour_bdd[] = $this->criteres[$nom_critere].'='.$valeur_critere;
353
			}
353
			}
354
		}
354
		}
355
		return $tableau_criteres_pour_bdd;
355
		return $tableau_criteres_pour_bdd;
356
	}
356
	}
357
 
357
 
358
	private function creerSousRequeteRechercheGenerale($chaine_requete) {
358
	private function creerSousRequeteRechercheGenerale($chaine_requete) {
359
		$requete = '';
359
		$requete = '';
360
		if (trim($chaine_requete) != '') {
360
		if (trim($chaine_requete) != '') {
361
			$chaine_requete = strtolower($chaine_requete);
361
			$chaine_requete = strtolower($chaine_requete);
362
			$chaine_requete = str_replace(' ', '_', $chaine_requete);
362
			$chaine_requete = str_replace(' ', '_', $chaine_requete);
363
			$requete = ' ('.
363
			$requete = ' ('.
364
				'nom_ret LIKE "'.$chaine_requete.'%"'.
364
				'nom_ret LIKE "'.$chaine_requete.'%"'.
365
				' OR '.
365
				' OR '.
366
				'nom_sel LIKE "'.$chaine_requete.'%"'.
366
				'nom_sel LIKE "'.$chaine_requete.'%"'.
367
				' OR '.
367
				' OR '.
368
				'zone_geo LIKE "'.$chaine_requete.'%" '.
368
				'zone_geo LIKE "'.$chaine_requete.'%" '.
369
				' OR '.
369
				' OR '.
370
				'ce_zone_geo LIKE "'.$chaine_requete.'%" '.
370
				'ce_zone_geo LIKE "'.$chaine_requete.'%" '.
371
				' OR '.
371
				' OR '.
372
				'ce_zone_geo LIKE "INSEE-C:'.$chaine_requete.'%" '.
372
				'ce_zone_geo LIKE "INSEE-C:'.$chaine_requete.'%" '.
373
				' OR '.
373
				' OR '.
374
				'courriel_utilisateur LIKE "'.$chaine_requete.'%" '.
374
				'courriel_utilisateur LIKE "'.$chaine_requete.'%" '.
375
				' OR '.
375
				' OR '.
376
				'mots_cles_texte LIKE "'.$chaine_requete.'%" '.
376
				'mots_cles_texte LIKE "'.$chaine_requete.'%" '.
377
				') ';
377
				') ';
378
		}
378
		}
379
		return $requete;
379
		return $requete;
380
	}
380
	}
381
 
381
 
382
	private function estUneRechercheGenerale() {
382
	private function estUneRechercheGenerale() {
383
		return isset($_GET['recherche']);
383
		return isset($_GET['recherche']);
384
	}
384
	}
385
 
385
 
386
	private function executerService($elements) {
386
	private function executerService($elements) {
387
		$contenu = '';
387
		$contenu = '';
388
		if (is_array($elements)) {
388
		if (is_array($elements)) {
389
			// Prétraitement des données
389
			// Prétraitement des données
390
			$donnees = $this->construireDonneesCommunesAuFlux($elements);
390
			$donnees = $this->construireDonneesCommunesAuFlux($elements);
391
			foreach ($elements as $element) {
391
			foreach ($elements as $element) {
392
				$identifiants[$element['courriel_utilisateur']] = $element['courriel_utilisateur'];
392
				$identifiants[$element['courriel_utilisateur']] = $element['courriel_utilisateur'];
393
			}
393
			}
394
			$this->auteurs = $this->creerAuteurs($identifiants);
394
			$this->auteurs = $this->creerAuteurs($identifiants);
395
			foreach ($elements as $element) {
395
			foreach ($elements as $element) {
396
				$donnees['items'][] = $this->construireDonneesCommunesAuxItems($element);
396
				$donnees['items'][] = $this->construireDonneesCommunesAuxItems($element);
397
			}
397
			}
398
 
398
 
399
			// Création du contenu à partir d'un template PHP
399
			// Création du contenu à partir d'un template PHP
400
			if (isset($this->squelette)) {
400
			if (isset($this->squelette)) {
401
				$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
401
				$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
402
			}
402
			}
403
		}
403
		}
404
		return $contenu;
404
		return $contenu;
405
	}
405
	}
406
 
406
 
407
	private function construireDonneesCommunesAuFlux($observations) {
407
	private function construireDonneesCommunesAuFlux($observations) {
408
		$donnees = $this->getFlux($this->service);
408
		$donnees = $this->getFlux($this->service);
409
		$donnees['guid'] = $this->getUrlServiceBase();
409
		$donnees['guid'] = $this->getUrlServiceBase();
410
		$donnees['titre'] = 'Flux des observations du CEL';
410
		$donnees['titre'] = 'Flux des observations du CEL';
411
		$donnees['lien_service'] = $this->creerUrlService();
411
		$donnees['lien_service'] = $this->creerUrlService();
412
		$donnees['lien_cel'] = $this->config['settings']['baseURLAbsolu'];
412
		$donnees['lien_cel'] = $this->config['settings']['baseURLAbsolu'];
413
		$donnees['editeur'] = $this->config['settings']['editeur'];
413
		$donnees['editeur'] = $this->config['settings']['editeur'];
414
		$derniere_info_en_date = reset($observations);
414
		$derniere_info_en_date = reset($observations);
415
		$date_modification_timestamp = strtotime($derniere_info_en_date['date_modification']);
415
		$date_modification_timestamp = strtotime($derniere_info_en_date['date_modification']);
416
		$donnees['date_maj_RSS'] = date(DATE_RSS, $date_modification_timestamp);
416
		$donnees['date_maj_RSS'] = date(DATE_RSS, $date_modification_timestamp);
417
		$donnees['date_maj_ATOM'] = date(DATE_ATOM, $date_modification_timestamp);
417
		$donnees['date_maj_ATOM'] = date(DATE_ATOM, $date_modification_timestamp);
418
		$donnees['date_maj_W3C'] = date(DATE_W3C, $date_modification_timestamp);
418
		$donnees['date_maj_W3C'] = date(DATE_W3C, $date_modification_timestamp);
419
		$donnees['annee_courante'] = date('Y');
419
		$donnees['annee_courante'] = date('Y');
420
		$donnees['generateur'] = 'CEL - Jrest - CelSyndicationObservation';
420
		$donnees['generateur'] = 'CEL - Jrest - CelSyndicationObservation';
421
		$donnees['generateur_version'] = (preg_match('/([0-9]+)/', '$Revision$', $match)) ?  $match[1] : '0';
421
		$donnees['generateur_version'] = (preg_match('/([0-9]+)/', '$Revision$', $match)) ?  $match[1] : '0';
422
		return $donnees;
422
		return $donnees;
423
	}
423
	}
424
 
424
 
425
	private function construireDonneesCommunesAuxItems($observation) {
425
	private function construireDonneesCommunesAuxItems($observation) {
426
		$item = array();
426
		$item = array();
427
		$date_modification_timestamp = $this->convertirDateHeureMysqlEnTimestamp($observation['date_modification']);
427
		$date_modification_timestamp = $this->convertirDateHeureMysqlEnTimestamp($observation['date_modification']);
428
		$item['date_maj_simple'] = strftime('%A %d %B %Y à %H:%M', $date_modification_timestamp);
428
		$item['date_maj_simple'] = strftime('%A %d %B %Y à %H:%M', $date_modification_timestamp);
429
		$item['date_maj_RSS'] = date(DATE_RSS, $date_modification_timestamp);
429
		$item['date_maj_RSS'] = date(DATE_RSS, $date_modification_timestamp);
430
		$item['date_maj_ATOM'] = date(DATE_ATOM, $date_modification_timestamp);
430
		$item['date_maj_ATOM'] = date(DATE_ATOM, $date_modification_timestamp);
431
		$item['date_maj_W3C'] = date(DATE_W3C, $date_modification_timestamp);
431
		$item['date_maj_W3C'] = date(DATE_W3C, $date_modification_timestamp);
432
		$item['date_creation_simple'] = strftime('%A %d %B %Y à %H:%M', strtotime($observation['date_creation']));
432
		$item['date_creation_simple'] = strftime('%A %d %B %Y à %H:%M', strtotime($observation['date_creation']));
433
		$item['titre'] = $this->creerTitre($observation);
433
		$item['titre'] = $this->creerTitre($observation);
434
		$item['guid'] = $this->creerGuidItem($observation);
434
		$item['guid'] = $this->creerGuidItem($observation);
435
		$item['lien'] = $this->creerLienItem($observation);
435
		$item['lien'] = $this->creerLienItem($observation);
436
		$item['categorie'] = $this->creerCategorie($item);
436
		$item['categorie'] = $this->creerCategorie($item);
437
		$item['description'] = $this->creerDescription($this->protegerCaracteresHtmlDansChamps($observation), $item);
437
		$item['description'] = $this->creerDescription($this->protegerCaracteresHtmlDansChamps($observation), $item);
438
		$item['description_encodee'] = htmlspecialchars($this->creerDescription($observation, $item));
438
		$item['description_encodee'] = htmlspecialchars($this->creerDescription($observation, $item));
439
		$item['modifier_par'] = $observation['id_observation'];
439
		$item['modifier_par'] = $observation['id_observation'];
440
		return $item;
440
		return $item;
441
	}
441
	}
442
 
442
 
443
	private function creerTitre($obs) {
443
	private function creerTitre($obs) {
444
		$date = $obs['date_observation'];
-
 
445
		$date = date("d/m/Y", strtotime($date));
444
		$date = ($obs['date_observation'] != '0000-00-00 00:00:00') ? 'le '.date("d/m/Y", strtotime($date)) : '' ;
446
		$nom_plante = $obs['nom_sel'].' [nn'.$obs['nom_sel_nn'].']';
445
		$nom_plante = $obs['nom_sel'].' [nn'.$obs['nom_sel_nn'].']';
447
		$lieu = $obs['zone_geo'].' ('.$obs['ce_zone_geo'].')';
446
		$lieu = $obs['zone_geo'].' ('.$obs['ce_zone_geo'].')';
448
		$utilisateur = $this->getIntituleAuteur($obs['courriel_utilisateur']);
447
		$utilisateur = $this->getIntituleAuteur($obs['courriel_utilisateur']);
449
		$titre = "$nom_plante à $lieu par $utilisateur le $date";
448
		$titre = "$nom_plante à $lieu par $utilisateur $date";
450
		$titre = $this->nettoyerTexte($titre);
449
		$titre = $this->nettoyerTexte($titre);
451
		return $titre;
450
		return $titre;
452
	}
451
	}
453
 
452
 
454
	private function creerGuidItem($element) {
453
	private function creerGuidItem($element) {
455
		$guid = sprintf($this->config['settings']['guidObsTpl'], $element['id_observation']);
454
		$guid = sprintf($this->config['settings']['guidObsTpl'], $element['id_observation']);
456
		return $guid;
455
		return $guid;
457
	}
456
	}
458
 
457
 
459
	private function creerLienItem($element) {
458
	private function creerLienItem($element) {
460
		$lien = null;
459
		$lien = null;
461
		if ($element['nom_sel_nn'] != 0) {
460
		if ($element['nom_sel_nn'] != 0) {
462
			$lien = sprintf($this->config['settings']['efloreUrlTpl'], urlencode($element['nom_sel_nn']), 'cel');
461
			$lien = sprintf($this->config['settings']['efloreUrlTpl'], urlencode($element['nom_sel_nn']), 'cel');
463
		}
462
		}
464
		return $lien;
463
		return $lien;
465
	}
464
	}
466
 
465
 
467
	private function creerDescription($obs, $item) {
466
	private function creerDescription($obs, $item) {
468
		$id_obs = $obs['id_observation'];
467
		$id_obs = $obs['id_observation'];
469
		$famille = $obs['famille'];
468
		$famille = $obs['famille'];
470
		$nom_saisi = $obs['nom_sel'];
469
		$nom_saisi = $obs['nom_sel'];
471
		$nom_retenu = $obs['nom_ret'];
470
		$nom_retenu = $obs['nom_ret'];
472
		$auteur = $this->getIntituleAuteur($obs['courriel_utilisateur']);
471
		$auteur = $this->getIntituleAuteur($obs['courriel_utilisateur']);
473
		$auteur_mail = $obs['courriel_utilisateur'];
472
		$auteur_mail = $obs['courriel_utilisateur'];
474
		$mots_cles_obs = $obs['mots_cles_texte'];
473
		$mots_cles_obs = $obs['mots_cles_texte'];
475
		$lien_correction = sprintf($this->config['settings']['phpEditUrlTpl'], $obs['id_observation']);
474
		$lien_correction = sprintf($this->config['settings']['phpEditUrlTpl'], $obs['id_observation']);
476
		$lieu = $obs['zone_geo'].' ('.$this->convertirCodeZoneGeoVersCodeInsee($obs['ce_zone_geo']).') > '.$obs['lieudit'].' > '.$obs['station'];
475
		$lieu = $obs['zone_geo'].' ('.$this->convertirCodeZoneGeoVersCodeInsee($obs['ce_zone_geo']).') > '.$obs['lieudit'].' > '.$obs['station'];
477
		$milieu = $obs['milieu'];
476
		$milieu = $obs['milieu'];
478
		$coordonnees = ($this->etreNull($obs['latitude']) && $this->etreNull($obs['longitude'])) ? '' : $obs['latitude'].'/'.$obs['longitude'];
477
		$coordonnees = ($this->etreNull($obs['latitude']) && $this->etreNull($obs['longitude'])) ? '' : $obs['latitude'].'/'.$obs['longitude'];
479
		$commentaire = $obs['commentaire'];
478
		$commentaire = $obs['commentaire'];
480
		$date_observation = $this->formaterDate($obs['date_observation'], '%A %d %B %Y');
479
		$date_observation = ($date_observation != '0000-00-00 00:00:00') ? $this->formaterDate($obs['date_observation'], '%A %d %B %Y') : '';
481
		$date_transmission = $this->formaterDate($obs['date_transmission']);
480
		$date_transmission = $this->formaterDate($obs['date_transmission']);
482
		$date_modification = $this->formaterDate($obs['date_modification']);
481
		$date_modification = $this->formaterDate($obs['date_modification']);
483
		$date_creation = $this->formaterDate($obs['date_creation']);
482
		$date_creation = $this->formaterDate($obs['date_creation']);
484
		$transmission = $obs['transmission'] == 1 ? "oui ($date_transmission)" : 'non';
483
		$transmission = $obs['transmission'] == 1 ? "oui ($date_transmission)" : 'non';
485
 
484
 
486
		$description = '<h2>'."Observation #$id_obs de $nom_saisi".'</h2>'.
485
		$description = '<h2>'."Observation #$id_obs de $nom_saisi".'</h2>'.
487
			'<ul>'.
486
			'<ul>'.
488
			'<li>'.'Famille : '.$famille.'</li>'.
487
			'<li>'.'Famille : '.$famille.'</li>'.
489
			'<li>'.'Nom saisi : '.$nom_saisi.'</li>'.
488
			'<li>'.'Nom saisi : '.$nom_saisi.'</li>'.
490
			'<li>'.'Nom retenu : '.$nom_retenu.'</li>'.
489
			'<li>'.'Nom retenu : '.$nom_retenu.'</li>'.
491
			'<li>'.'Observée le : '.$date_observation.'</li>'.
490
			'<li>'.'Observée le : '.$date_observation.'</li>'.
492
			'<li>'.'Lieu : '.$lieu.'</li>'.
491
			'<li>'.'Lieu : '.$lieu.'</li>'.
493
			'<li>'.'Milieu : '.$milieu.'</li>'.
492
			'<li>'.'Milieu : '.$milieu.'</li>'.
494
			(($this->etreFluxAdmin()) ? '<li>Coordonnées (Lat/Long) : '.$coordonnees.'</li>' : '').
493
			(($this->etreFluxAdmin()) ? '<li>Coordonnées (Lat/Long) : '.$coordonnees.'</li>' : '').
495
			'<li>'.'Commentaire : '.$commentaire.'</li>'.
494
			'<li>'.'Commentaire : '.$commentaire.'</li>'.
496
			'<li>'.'Mots-clés : '.$mots_cles_obs.'</li>'.
495
			'<li>'.'Mots-clés : '.$mots_cles_obs.'</li>'.
497
			(($this->etreFluxAdmin()) ? '<li>Transmis (= public) : '.$transmission.'</li>' : '').
496
			(($this->etreFluxAdmin()) ? '<li>Transmis (= public) : '.$transmission.'</li>' : '').
498
			'<li>Modifiée le : '.$date_modification.'</li>'.
497
			'<li>Modifiée le : '.$date_modification.'</li>'.
499
			'<li>Créée le : '.$date_creation.'</li>'.
498
			'<li>Créée le : '.$date_creation.'</li>'.
500
			'<li>'.'Par : '.
499
			'<li>'.'Par : '.
501
				(($this->etreFluxAdmin()) ? '<a href="mailto:'.$auteur_mail.'">'.$auteur.'</a>' : $auteur).
500
				(($this->etreFluxAdmin()) ? '<a href="mailto:'.$auteur_mail.'">'.$auteur.'</a>' : $auteur).
502
			'</li>'.
501
			'</li>'.
503
			(($this->etreFluxAdmin()) ? '<li><a href="'.$lien_correction.'">Corriger cette observation</a></li>' : '').
502
			(($this->etreFluxAdmin()) ? '<li><a href="'.$lien_correction.'">Corriger cette observation</a></li>' : '').
504
			'</ul>';
503
			'</ul>';
505
		$description = $this->nettoyerTexte($description);
504
		$description = $this->nettoyerTexte($description);
506
		return $description;
505
		return $description;
507
	}
506
	}
508
 
507
 
509
	private function creerCategorie($element) {
508
	private function creerCategorie($element) {
510
		$categorie = '';
509
		$categorie = '';
511
		$categorie = 'Observation';
510
		$categorie = 'Observation';
512
		$categorie = $this->nettoyerTexte($categorie);
511
		$categorie = $this->nettoyerTexte($categorie);
513
		return $categorie;
512
		return $categorie;
514
	}
513
	}
515
 
514
 
516
	private function etreFluxAdmin() {
515
	private function etreFluxAdmin() {
517
		return (isset($_GET['admin']) && $_GET['admin'] == '1') ? true : false;
516
		return (isset($_GET['admin']) && $_GET['admin'] == '1') ? true : false;
518
	}
517
	}
519
 
518
 
520
	private function creerUrlService() {
519
	private function creerUrlService() {
521
		$url_service = $this->getUrlServiceBase();
520
		$url_service = $this->getUrlServiceBase();
522
		if (count($_GET) > 0) {
521
		if (count($_GET) > 0) {
523
			$parametres_get = array();
522
			$parametres_get = array();
524
			foreach ($_GET as $cle => $valeur) {
523
			foreach ($_GET as $cle => $valeur) {
525
				$parametres_get[] = $cle.'='.$valeur;
524
				$parametres_get[] = $cle.'='.$valeur;
526
			}
525
			}
527
			$url_service .= '?'.implode('&amp;', $parametres_get);
526
			$url_service .= '?'.implode('&amp;', $parametres_get);
528
		}
527
		}
529
		return $url_service;
528
		return $url_service;
530
	}
529
	}
531
 
530
 
532
	private function getIntituleAuteur($courriel) {
531
	private function getIntituleAuteur($courriel) {
533
		$courriel = strtolower($courriel);
532
		$courriel = strtolower($courriel);
-
 
533
		if(isset($this->auteurs[$courriel])) {
534
		$intitule = $this->auteurs[$courriel];
534
			$intitule = $this->auteurs[$courriel];
-
 
535
		} else {
-
 
536
			$intitule = $courriel;
-
 
537
		}
535
		return $intitule;
538
		return $intitule;
536
	}
539
	}
537
}
540
}