Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 637 Rev 715
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 $flux = array();
31
	private $flux = array();
-
 
32
	private $criteres = array(
-
 
33
		'auteur' => 'identifiant', 
-
 
34
		'commune' => 'location', 
-
 
35
		'departement' => 'id_location',
-
 
36
		'taxon' => 'nom_ret',
-
 
37
		'commentaire' => 'commentaire',
-
 
38
		'date' => 'date_observation',
-
 
39
		'projet' => 'mots-cles');
32
	
40
	
33
	/**
41
	/**
34
	 * Méthode appelée avec une requête de type GET.
42
	 * Méthode appelée avec une requête de type GET.
35
	 */
43
	 */
36
	public function getElement($params = array()) {
44
	public function getElement($params = array()) {
37
		// Initialisation des variables
45
		// Initialisation des variables
38
		$this->parametres_origines = $params;
46
		$this->parametres_origines = $params;
39
		$info = array();
47
		$info = array();
40
		$contenu = '';
48
		$contenu = '';
41
		
49
		
42
		if (! $this->etreFluxAdmin() || $this->authentifierAdmin()) {
50
		if (! $this->etreFluxAdmin() || $this->authentifierAdmin()) {
43
			// Pré traitement des paramêtres
51
			// Pré traitement des paramêtres
44
			$pour_bdd = false;
52
			$pour_bdd = false;
45
			$p = $this->traiterParametres(array('service', 'format'), $params, $pour_bdd);
53
			$p = $this->traiterParametres(array('service', 'format'), $params, $pour_bdd);
46
			extract($p);
54
			extract($p);
47
			$this->parametres = $params;
55
			$this->parametres = $params;
48
			$this->squelette_dossier = dirname(__FILE__).DIRECTORY_SEPARATOR.'squelettes'.DIRECTORY_SEPARATOR;
56
			$this->squelette_dossier = dirname(__FILE__).DIRECTORY_SEPARATOR.'squelettes'.DIRECTORY_SEPARATOR;
49
					
57
					
50
			// Récupération de la liste des flux
58
			// Récupération de la liste des flux
51
			$this->chargerListeDesFlux();
59
			$this->chargerListeDesFlux();
52
			
60
			
53
			// Chargement du bon type de service demandé
61
			// Chargement du bon type de service demandé
54
			if (isset($service)) {
62
			if (isset($service)) {
55
				$this->service = $this->traiterNomService($service);
63
				$this->service = $this->traiterNomService($service);
56
				$methode = $this->getNomMethodeService();
64
				$methode = $this->getNomMethodeService();
57
				if (method_exists($this, $methode)) {
65
				if (method_exists($this, $methode)) {
58
					if (isset($format) && preg_match('/^(?:rss1|rss2|atom)$/i', $format)) {
66
					if (isset($format) && preg_match('/^(?:rss1|rss2|atom)$/i', $format)) {
59
						// Mise en minuscule de l'indication du format
67
						// Mise en minuscule de l'indication du format
60
						$this->format = strtolower($format);
68
						$this->format = strtolower($format);
61
						// Définition du fichier squelette demandé
69
						// Définition du fichier squelette demandé
62
						$this->squelette = $this->squelette_dossier.$this->format.'.tpl.xml';
70
						$this->squelette = $this->squelette_dossier.$this->format.'.tpl.xml';
63
					} else if (isset($this->flux[$this->service])) {
71
					} else if (isset($this->flux[$this->service])) {
64
						$this->format = '';
72
						$this->format = '';
65
						$this->messages[] = "Le service CEL Syndication nécessite d'indiquer en second paramètre le format : rss1, rss2 ou atom.";
73
						$this->messages[] = "Le service CEL Syndication nécessite d'indiquer en second paramètre le format : rss1, rss2 ou atom.";
66
					}
74
					}
67
	
75
	
68
					if (!isset($this->flux[$this->service]) || isset($this->format)) {
76
					if (!isset($this->flux[$this->service]) || isset($this->format)) {
69
						// Suppression des paramêtres inutile pour le reste des méthodes
77
						// Suppression des paramêtres inutile pour le reste des méthodes
70
						array_shift($this->parametres);
78
						array_shift($this->parametres);
71
						array_shift($this->parametres);
79
						array_shift($this->parametres);
72
						
80
						
73
						// Récupération du contenu à renvoyer
81
						// Récupération du contenu à renvoyer
74
						$contenu = $this->$methode();
82
						$contenu = $this->$methode();
75
					}
83
					}
76
				} else {
84
				} else {
77
					$this->messages[] = "Le type d'information demandé '$this->service' n'est pas disponible.";
85
					$this->messages[] = "Le type d'information demandé '$this->service' n'est pas disponible.";
78
				}
86
				}
79
			} else {
87
			} else {
80
				$this->messages[] = "Le service CEL Syndication Observation nécessite d'indiquer en premier paramètre le type d'information demandé.";
88
				$this->messages[] = "Le service CEL Syndication Observation nécessite d'indiquer en premier paramètre le type d'information demandé.";
81
			}
89
			}
82
		}
90
		}
83
		
91
		
84
		// Envoie sur la sortie standard
92
		// Envoie sur la sortie standard
85
		$encodage = 'utf-8';
93
		$encodage = 'utf-8';
86
		$mime = $this->getTypeMime();
94
		$mime = $this->getTypeMime();
87
		$formatage_json = $this->getFormatageJson();
95
		$formatage_json = $this->getFormatageJson();
88
		$this->envoyer($contenu, $mime, $encodage, $formatage_json);
96
		$this->envoyer($contenu, $mime, $encodage, $formatage_json);
89
	}
97
	}
90
	
98
	
91
	private function getUrlBase() {
99
	private function getUrlBase() {
92
		$url_base = sprintf($this->config['settings']['baseURLAbsolu'], get_class($this).'/');
100
		$url_base = sprintf($this->config['settings']['baseURLAbsolu'], get_class($this).'/');
93
		return $url_base;
101
		return $url_base;
94
	}
102
	}
95
	
103
	
96
	private function getUrlServiceBase() {
104
	private function getUrlServiceBase() {
97
		$url_service = $this->getUrlBase().implode('/', $this->parametres_origines);
105
		$url_service = $this->getUrlBase().implode('/', $this->parametres_origines);
98
		return $url_service;
106
		return $url_service;
99
	}
107
	}
100
	
108
	
101
	private function traiterNomService($nom) {
109
	private function traiterNomService($nom) {
102
		$nom = strtolower($nom);
110
		$nom = strtolower($nom);
103
		return $nom;
111
		return $nom;
104
	}
112
	}
105
	
113
	
106
	private function getNomMethodeService() {
114
	private function getNomMethodeService() {
107
		$methode = '';
115
		$methode = '';
108
		$service_formate = str_replace(' ', '', ucwords(implode(' ', explode('-', $this->service))));
116
		$service_formate = str_replace(' ', '', ucwords(implode(' ', explode('-', $this->service))));
109
		$methode = 'getService'.$service_formate;
117
		$methode = 'getService'.$service_formate;
110
		return $methode;
118
		return $methode;
111
	}
119
	}
112
	
120
	
113
	private function getTypeMime() {
121
	private function getTypeMime() {
114
		$mime = '';
122
		$mime = '';
115
		$test = isset($this->format) ? $this->format : $this->service; 
123
		$test = isset($this->format) ? $this->format : $this->service; 
116
		switch ($test) {
124
		switch ($test) {
117
			case 'atom' :
125
			case 'atom' :
118
				$mime = 'application/atom+xml';
126
				$mime = 'application/atom+xml';
119
				break;
127
				break;
120
			case 'rss1' :
128
			case 'rss1' :
121
			case 'rss2' :
129
			case 'rss2' :
122
				$mime = 'application/rss+xml';
130
				$mime = 'application/rss+xml';
123
				break;
131
				break;
124
			case 'opml' :
132
			case 'opml' :
125
				$mime = 'text/x-opml';
133
				$mime = 'text/x-opml';
126
				break;
134
				break;
127
			default:
135
			default:
128
				$mime = 'text/html';
136
				$mime = 'text/html';
129
		}
137
		}
130
		return $mime;
138
		return $mime;
131
	}
139
	}
132
	
140
	
133
	private function getFormatageJson() {
141
	private function getFormatageJson() {
134
		$json = false;
142
		$json = false;
135
		switch ($this->service) {
143
		switch ($this->service) {
136
			case 'liste-des-flux' :
144
			case 'liste-des-flux' :
137
				$json = true;
145
				$json = true;
138
				break;
146
				break;
139
			default:
147
			default:
140
				$json = false;
148
				$json = false;
141
		}
149
		}
142
		return $json;
150
		return $json;
143
	}
151
	}
144
	
152
	
145
	private function getFlux($nom) {
153
	private function getFlux($nom) {
146
		return isset($this->flux[$nom]) ? $this->flux[$nom] : array();
154
		return isset($this->flux[$nom]) ? $this->flux[$nom] : array();
147
	}
155
	}
148
 
156
 
149
	private function setFlux($nom, $titre, $description) {
157
	private function setFlux($nom, $titre, $description) {
150
		$url_base = $this->getUrlBase();
158
		$url_base = $this->getUrlBase();
151
		$formats = array('atom', 'rss2', 'rss1');
159
		$formats = array('atom', 'rss2', 'rss1');
152
		$flux = array();
160
		$flux = array();
153
		foreach ($formats as $format) {
161
		foreach ($formats as $format) {
154
			$url = $url_base.$nom.'/'.$format;
162
			$url = $url_base.$nom.'/'.$format;
155
			$flux[$format] = $url;
163
			$flux[$format] = $url;
156
		}
164
		}
157
		$this->flux[$nom] = array('titre' => $titre, 'description' => $description, 'urls' => $flux);
165
		$this->flux[$nom] = array('titre' => $titre, 'description' => $description, 'urls' => $flux);
158
	}
166
	}
159
	
167
	
160
	private function chargerListeDesFlux() {
168
	private function chargerListeDesFlux() {
161
		$this->setFlux('par-defaut', 'Flux de syndication des observations publiques du CEL', 
169
		$this->setFlux('par-defaut', 'Flux de syndication des observations publiques du CEL', 
162
			'Ce flux fournit des informations sur les observations du CEL.');
170
			'Ce flux fournit des informations sur les observations du CEL.');
163
		$this->setFlux('par-mots-cles', 'Flux de syndication des observations publiques du CEL filtrées par mots clés', 
171
		$this->setFlux('par-mots-cles', 'Flux de syndication des observations publiques du CEL filtrées par mots clés', 
164
			"Ce flux fournit des informations sur les observations du CEL filtrées par mots-clés. Il nécessite d'être 
172
			"Ce flux fournit des informations sur les observations du CEL filtrées par mots-clés. Il nécessite d'être 
165
			paramétré en indiquant en dernier position de l'url le mot-clé à rechercher.");
173
			paramétré en indiquant en dernier position de l'url le mot-clé à rechercher.");
166
		$this->setFlux('par-commune','Flux de syndication des observations publiques du CEL filtrées par commune',
174
		$this->setFlux('par-commune','Flux de syndication des observations publiques du CEL filtrées par commune',
167
			"Ce flux fournit des informations sur les observations du CEL filtrées par commune. Il nécessite d'être 
175
			"Ce flux fournit des informations sur les observations du CEL filtrées par commune. Il nécessite d'être 
168
			paramétré en indiquant en dernier position de l'url le nom de la commune à rechercher.");
176
			paramétré en indiquant en dernier position de l'url le nom de la commune à rechercher.");
169
	}
177
	}
170
	
178
	
171
	private function getServiceListeDesFlux() {
179
	private function getServiceListeDesFlux() {
172
		return $this->flux;
180
		return $this->flux;
173
	}
181
	}
174
	
182
	
175
	private function getServiceOpml() {
183
	private function getServiceOpml() {
176
		$donnees = array();
184
		$donnees = array();
177
		$id = 1;
185
		$id = 1;
178
		foreach ($this->flux as $flux_nom => $flux){
186
		foreach ($this->flux as $flux_nom => $flux){
179
			$info = array();
187
			$info = array();
180
			$info['type'] = 'atom';
188
			$info['type'] = 'atom';
181
			$info['titre'] = $flux['titre'];
189
			$info['titre'] = $flux['titre'];
182
			$info['texte'] = "CEL - Obs - $flux_nom";
190
			$info['texte'] = "CEL - Obs - $flux_nom";
183
			$info['description'] = $flux['description'];
191
			$info['description'] = $flux['description'];
184
			$info['url_xml'] = $this->getUrlBase().$flux_nom.'/atom';
192
			$info['url_xml'] = $this->getUrlBase().$flux_nom.'/atom';
185
			$info['url_html'] = $this->config['settings']['aideCelUrl'].'FluxSyndication';
193
			$info['url_html'] = $this->config['settings']['aideCelUrl'].'FluxSyndication';
186
			$donnees['liste_flux'][] = $info;
194
			$donnees['liste_flux'][] = $info;
187
		}
195
		}
188
		
196
		
189
		$this->squelette = $this->squelette_dossier.'opml.tpl.xml';
197
		$this->squelette = $this->squelette_dossier.'opml.tpl.xml';
190
		$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
198
		$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
191
		return $contenu;
199
		return $contenu;
192
	}
200
	}
193
	
201
	
194
	private function getServiceParDefaut() {
202
	private function getServiceParDefaut() {
195
		// Construction de la requête
203
		// Construction de la requête
196
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' * '.
204
		$requete = 	(isset($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' * '.
197
			'FROM cel_inventory '.
205
			'FROM cel_inventory '.
198
			(($this->etreFluxAdmin()) ? '' : 'WHERE transmission = 1 ').
206
			(($this->etreFluxAdmin()) ? '' : 'WHERE transmission = 1 ').
199
			'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'date_modification DESC').' '.
207
			'ORDER BY '.(isset($this->orderby) && (!is_null($this->orderby)) ? $this->orderby  : 'date_modification DESC').' '.
200
			"LIMIT $this->start,$this->limit ";
208
			"LIMIT $this->start,$this->limit ";
201
		
209
		
202
		$elements = $this->executerRequete($requete);
210
		$elements = $this->executerRequete($requete);
203
		
211
		
204
		// Création du contenu
212
		// Création du contenu
205
		$contenu = $this->executerService($elements);
213
		$contenu = $this->executerService($elements);
206
		return $contenu;
214
		return $contenu;
207
	}
215
	}
208
	
216
	
209
	private function getServiceParMotsCles() {
217
	private function getServiceParMotsCles() {
210
		$contenu = '';
218
		$contenu = '';
211
		$mot_cle = $this->parametres[0];
219
		$mot_cle = $this->parametres[0];
212
 
220
 
213
		if (isset($mot_cle)) {
221
		if (isset($mot_cle)) {
214
			$mot_cle_encode = $this->bdd->quote($this->encoderMotCle($mot_cle));
222
			$mot_cle_encode = $this->bdd->quote($this->encoderMotCle($mot_cle));
215
 
223
 
216
			// Construction de la requête
224
			// Construction de la requête
217
			$requete = 	'SELECT * '.
225
			$requete = 	'SELECT * '.
218
				'FROM cel_mots_cles_obs '.
226
				'FROM cel_mots_cles_obs '.
219
				"WHERE cmc_id_mot_cle_general = $mot_cle_encode ";
227
				"WHERE cmc_id_mot_cle_general = $mot_cle_encode ";
220
			$elements = $this->executerRequete($requete);
228
			$elements = $this->executerRequete($requete);
221
			
229
			
222
			if ($elements != false && count($elements) > 0) {
230
			if ($elements != false && count($elements) > 0) {
223
				// Pré-construction du where de la requête
231
				// Pré-construction du where de la requête
224
				$tpl_where = '(mots_cles LIKE "%%%s%%" AND identifiant = %s )';
232
				$tpl_where = '(mots_cles LIKE "%%%s%%" AND identifiant = %s )';
225
				$requete_where = array();
233
				$requete_where = array();
226
				foreach ($elements as $occurence) {
234
				foreach ($elements as $occurence) {
227
					$requete_where[] = sprintf($tpl_where, $occurence['cmc_id_mot_cle_utilisateur'], $this->bdd->quote($occurence['cmc_id_proprietaire']));
235
					$requete_where[] = sprintf($tpl_where, $occurence['cmc_id_mot_cle_utilisateur'], $this->bdd->quote($occurence['cmc_id_proprietaire']));
228
				}
236
				}
229
				
237
				
230
				// Construction de la requête
238
				// Construction de la requête
231
				$requete = 	'SELECT * '.
239
				$requete = 	'SELECT * '.
232
					'FROM cel_inventory '.
240
					'FROM cel_inventory '.
233
					'WHERE '.implode(" \nOR ", $requete_where).' '.
241
					'WHERE '.implode(" \nOR ", $requete_where).' '.
234
					'	'.(($this->etreFluxAdmin()) ? '' : 'AND transmission = 1 ').
242
					'	'.(($this->etreFluxAdmin()) ? '' : 'AND transmission = 1 ').
235
					'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'date_modification, date_creation DESC').' '.
243
					'ORDER BY '.(isset($this->orderby) && (!is_null($this->orderby)) ? $this->orderby  : 
-
 
244
						'date_modification, date_creation DESC').' '.
236
					"LIMIT $this->start,$this->limit ";
245
					"LIMIT $this->start,$this->limit ";
237
				$elements = $this->executerRequete($requete);
246
				$elements = $this->executerRequete($requete);
238
				
247
				
239
				// Création du contenu
248
				// Création du contenu
240
				$contenu = $this->executerService($elements);
249
				$contenu = $this->executerService($elements);
241
			} else {
250
			} else {
242
				$this->messages[] = "Aucune observation ne correspond à ce mot clé.";
251
				$this->messages[] = "Aucune observation ne correspond à ce mot clé.";
243
			}
252
			}
244
		} else {
253
		} else {
245
			$this->messages[] = "Le service demandé nécessite d'indiquer un mot-clé en dernier paramêtre.";
254
			$this->messages[] = "Le service demandé nécessite d'indiquer un mot-clé en dernier paramêtre.";
246
		}
255
		}
247
		return $contenu;
256
		return $contenu;
248
	}
257
	}
249
	
258
	
250
	private function getServiceParCommune() {
259
	private function getServiceParCommune() {
251
		$contenu = '';
260
		$contenu = '';
252
		$commune = $this->parametres[0];
261
		$commune = $this->parametres[0];
253
		if (isset($commune)) {
262
		if (isset($commune)) {
254
			$commune = $this->bdd->quote($commune);
263
			$commune = $this->bdd->quote($commune);
255
			
264
			
256
			// Construction de la requête
265
			// Construction de la requête
257
			$requete = 	(($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' * '.
266
			$requete = 	(isset($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' * '.
258
				'FROM cel_inventory '.
267
				'FROM cel_inventory '.
259
				"WHERE location = $commune ".
268
				"WHERE location = $commune ".
260
				'	'.(($this->etreFluxAdmin()) ? '' : 'AND transmission = 1 ').
269
				'	'.(($this->etreFluxAdmin()) ? '' : 'AND transmission = 1 ').
261
				'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'date_modification DESC, location ASC').' '.
270
				'ORDER BY '.(isset($this->orderby) && (!is_null($this->orderby)) ? $this->orderby  : 'date_modification DESC, location ASC').' '.
262
				"LIMIT $this->start,$this->limit ";
271
				"LIMIT $this->start,$this->limit ";
263
			
272
			
264
			$elements = $this->executerRequete($requete);
273
			$elements = $this->executerRequete($requete);
265
			
274
			
266
			// Création du contenu
275
			// Création du contenu
267
			$contenu = $this->executerService($elements);
276
			$contenu = $this->executerService($elements);
268
		} else {
277
		} else {
269
			$this->messages[] = "Le service demandé nécessite d'indiquer une nom de commune en dernier paramêtre.";
278
			$this->messages[] = "Le service demandé nécessite d'indiquer une nom de commune en dernier paramêtre.";
270
		}
279
		}
271
		return $contenu;
280
		return $contenu;
272
	}
281
	}
-
 
282
	
-
 
283
	private function getServiceMultiCriteres() {
-
 
284
		$contenu = '';
-
 
285
		if (isset($_GET['debut'])) $this->start = $_GET['debut'];		
-
 
286
		if (isset($_GET['limite'])) $this->limite = $_GET['limite'];
-
 
287
		
-
 
288
		// Construction de la requête
-
 
289
		$requete = (isset($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' * '.
-
 
290
				'FROM cel_inventory '.
-
 
291
				'WHERE transmission = 1 '.
-
 
292
			'	AND ';
-
 
293
		
-
 
294
		if ($this->estUneRechercheGenerale()) {
-
 
295
			$chaine_requete = $_GET['recherche'];
-
 
296
			$requete .= $this->creerSousRequeteRechercheGenerale($chaine_requete);
-
 
297
		} else {
-
 
298
			$criteres = $this->traiterCriteresMultiples($_GET) ;
-
 
299
			if (!empty($criteres)) {
-
 
300
				$requete .= $this->creerSousRequeteRechercheParCriteres($criteres);
-
 
301
			}	
-
 
302
		}
-
 
303
		$requete = rtrim($requete, 'AND ');
-
 
304
		$requete .= 'ORDER BY '.(isset($this->orderby) && (!is_null($this->orderby)) ? $this->orderby  : 
-
 
305
			'date_modification DESC, location ASC').' '.
-
 
306
				"LIMIT $this->start,$this->limit ";
-
 
307
		
-
 
308
		$elements = $this->executerRequete($requete);//echo $requete;
-
 
309
 
-
 
310
		// Création du contenu
-
 
311
		if ($elements != false && count($elements) > 0) {
-
 
312
			$contenu = $this->executerService($elements);
-
 
313
		} else {
-
 
314
			$this->messages[] = "Aucune observation disponible.";
-
 
315
		}
-
 
316
        
-
 
317
        return $contenu;
-
 
318
	}
-
 
319
	
-
 
320
	private function creerSousRequeteRechercheParCriteres($criteres) {
-
 
321
		$requete = '';
-
 
322
		foreach ($criteres as $pair) {
-
 
323
			$nom_valeur = explode("=",$pair);
-
 
324
			if (sizeof($nom_valeur) != 0) {
-
 
325
				switch ($nom_valeur[0]) {
-
 
326
					case "ci_limite" : $this->limite = $this->bdd->quote($nom_valeur[1]); break;
-
 
327
					case "commentaire" : $mots_comment_liste = explode(" " , $nom_valeur[1]);
-
 
328
						foreach($mots_comment_liste as $mot_comment) {
-
 
329
							$mot_comment = trim($mot_comment) ;
-
 
330
							$requete .= $nom_valeur[0].' LIKE '.$this->bdd->quote('%'.$mot_comment.'%').' AND ';
-
 
331
						}
-
 
332
						break;
-
 
333
					case "date_observation" : 
-
 
334
						$nom_valeur[1] = str_replace('/', '-', $nom_valeur[1]);
-
 
335
						if (preg_match('/(^[0-9]{2})-([0-9]{2})-([0-9]{4}$)/', $nom_valeur[1], $matches)) {
-
 
336
							$nom_valeur[1] = $matches[3].'-'.$matches[2].'-'.$matches[1];
-
 
337
						}
-
 
338
						$requete .= $nom_valeur[0].'='.$this->bdd->quote($nom_valeur[1]).' AND '; break;
-
 
339
					case "nom_ret" : 
-
 
340
						if ($nom_valeur[1] == "indetermine") $nom_valeur[1] = 'null';						
-
 
341
						$requete .= ' ('.$nom_valeur[0].' LIKE "%'.$nom_valeur[1].'%" OR nom_sel LIKE "%'.
-
 
342
							$nom_valeur[1].'%") AND '; break;
-
 
343
					case "mots-cles" : $requete .= $this->creerSousRequeteMotsCles($nom_valeur[1]); break; 		
-
 
344
					default : $requete .= $nom_valeur[0].' = "'.$nom_valeur[1].'" AND '; break;
-
 
345
				}
-
 
346
			}
-
 
347
		}
-
 
348
		$requete = rtrim($requete,' AND ');
-
 
349
		return $requete;
-
 
350
	}
-
 
351
	
-
 
352
	private function creerSousRequeteMotsCles($mot_cle) {
-
 
353
		$requete = 'mots_cles like "inexistant" OR';
-
 
354
		if (preg_match('/.*,.*/', $mot_cle)) {
-
 
355
			$requete = $this->creerSousRequeteMotsClesOu($mot_cle);
-
 
356
		} else if (preg_match('/.*ET.*/', $mot_cle)) {
-
 
357
			$requete = $this->creerSousRequeteMotsClesEt($mot_cle);
-
 
358
		} else {		
-
 
359
			// Construction de la requête
-
 
360
			$prerequete = 	'SELECT * '.
-
 
361
				'FROM cel_mots_cles_obs '.
-
 
362
				'WHERE cmc_id_mot_cle_general = '.$this->bdd->quote($this->encoderMotCle($mot_cle)); 
-
 
363
			$elements = $this->executerRequete($prerequete);
-
 
364
			if ($elements != false && count($elements) > 0) {
-
 
365
				$requete = '';
-
 
366
				foreach ($elements as $occurence) {
-
 
367
					$requete .= '(mots_cles LIKE "%'.$occurence['cmc_id_mot_cle_utilisateur'].'%" AND identifiant = '.
-
 
368
						$this->bdd->quote($occurence['cmc_id_proprietaire']).' ) OR ';	
-
 
369
				}
-
 
370
			}
-
 
371
		}
-
 
372
		$requete = rtrim($requete,' OR ').' AND ';
-
 
373
		return $requete;
-
 
374
	}
-
 
375
	
-
 
376
	private function creerSousRequeteMotsClesOu($mot_cle) {	
-
 
377
		$requete = 'mots_cles like "inexistant" OR';	
-
 
378
		$tab_mots_cles = explode(',', $mot_cle);
-
 
379
		$where = '';
-
 
380
		foreach ($tab_mots_cles as $mot) {
-
 
381
			$where .= 'cmc_id_mot_cle_general = '.$this->bdd->quote($this->encoderMotCle($mot)).' OR ';
-
 
382
		}
-
 
383
		$where = rtrim($where,' OR ');
-
 
384
		
-
 
385
		// Construction de la requête
-
 
386
		$prerequete = 	"SELECT cmc_id_mot_cle_utilisateur, cmc_id_proprietaire FROM cel_mots_cles_obs WHERE $where "; 
-
 
387
		$elements = $this->executerRequete($prerequete);//print_r($elements);
-
 
388
		if ($elements != false && count($elements) > 0) {
-
 
389
			$requete = '';
-
 
390
			foreach ($elements as $occurence) {
-
 
391
				$requete .= '(mots_cles LIKE "%'.$occurence['cmc_id_mot_cle_utilisateur'].'%" AND identifiant = '.
-
 
392
					$this->bdd->quote($occurence['cmc_id_proprietaire']).' ) OR ';
-
 
393
			}
-
 
394
		}
-
 
395
		return $requete;
-
 
396
	}
-
 
397
	
-
 
398
	private function creerSousRequeteMotsClesEt($mot_cle) {
-
 
399
		$requete = 'mots_cles like "inexistant" OR';
-
 
400
		$where = '';
-
 
401
		$champs = 'a.cmc_id_proprietaire , ';
-
 
402
		$table = '';
-
 
403
		$i = "a"; $j = "a";
-
 
404
		
-
 
405
		$tab_mots_cles = explode("ET", $mot_cle); 
-
 
406
		foreach ($tab_mots_cles as $mot) {
-
 
407
			$champs .= "$i.cmc_id_mot_cle_utilisateur as $i , ";
-
 
408
			$table .= "cel_mots_cles_obs $i , ";
-
 
409
			$where .= "$i.cmc_id_mot_cle_general = ".$this->bdd->quote($this->encoderMotCle($mot)).' AND ';
-
 
410
			if ($i !== "a") {
-
 
411
				$where .= " $i.cmc_id_proprietaire = ".$j.".cmc_id_proprietaire AND ";
-
 
412
				$j++;
-
 
413
			}
-
 
414
			$i++;
-
 
415
		}
-
 
416
		$where = rtrim($where,' AND '); $champs = rtrim($champs,' , '); $table = rtrim($table,' , ');
-
 
417
		
-
 
418
		// Construction de la requête
-
 
419
		$prerequete = 	"SELECT $champs FROM $table WHERE $where "; 
-
 
420
		$elements = $this->executerRequete($prerequete);//print_r($elements);
-
 
421
		if ($elements != false && count($elements) > 0) {
-
 
422
			$requete = '';
-
 
423
			foreach ($elements as $occurence) {
-
 
424
				$requete = ' (';
-
 
425
				for ($j = 'a'; $j < $i; $j++) {
-
 
426
					$requete .= 'mots_cles like "%'.$occurence[$j].'%" AND ';
-
 
427
				}
-
 
428
				$requete .= ' identifiant = '.$this->bdd->quote($occurence['cmc_id_proprietaire']).' ) OR ';
-
 
429
			}
-
 
430
		}
-
 
431
		return $requete;
-
 
432
	}		
-
 
433
	
-
 
434
	private function traiterCriteresMultiples($tableau_criteres) {
-
 
435
		$tableau_criteres_pour_bdd = array();
-
 
436
				
-
 
437
		foreach($tableau_criteres as $nom_critere => $valeur_critere) {
-
 
438
			if (isset($this->criteres[$nom_critere])) {
-
 
439
				$tableau_criteres_pour_bdd[] = $this->criteres[$nom_critere].'='.$valeur_critere;
-
 
440
			}
-
 
441
		}
-
 
442
		return $tableau_criteres_pour_bdd;
-
 
443
	}
-
 
444
	
-
 
445
	private function creerSousRequeteRechercheGenerale($chaine_requete) {
-
 
446
		$requete = '';
-
 
447
		if (trim($chaine_requete) != '') {	
-
 
448
			$chaine_requete = strtolower($chaine_requete);
-
 
449
			$chaine_requete = str_replace(' ', '_', $chaine_requete);
-
 
450
			$requete = ' ('.
-
 
451
				'nom_ret LIKE "'.$chaine_requete.'%"'.
-
 
452
				' OR '.
-
 
453
				'nom_sel LIKE "'.$chaine_requete.'%"'.
-
 
454
				' OR '.
-
 
455
				'location LIKE "'.$chaine_requete.'%" '.
-
 
456
				' OR '.
-
 
457
				'id_location LIKE "'.$chaine_requete.'%" '.
-
 
458
				' OR '.
-
 
459
				'identifiant LIKE "'.$chaine_requete.'%" '.
-
 
460
				') ';
-
 
461
		}
-
 
462
		return $requete;
-
 
463
	}
-
 
464
	
-
 
465
	private function estUneRechercheGenerale() {
-
 
466
		return isset($_GET['recherche']);
-
 
467
	}
273
	
468
	
274
	private function executerService($elements) {
469
	private function executerService($elements) {
275
		$contenu = '';
470
		$contenu = '';
276
		if (is_array($elements)) {
471
		if (is_array($elements)) {
277
			// Prétraitement des données
472
			// Prétraitement des données
278
			$donnees = $this->construireDonneesCommunesAuFlux($elements);
473
			$donnees = $this->construireDonneesCommunesAuFlux($elements);
279
			
474
			
280
			foreach ($elements as $element) {
475
			foreach ($elements as $element) {
281
				$donnees['items'][] = $this->construireDonneesCommunesAuxItems($element);
476
				$donnees['items'][] = $this->construireDonneesCommunesAuxItems($element);
282
			}
477
			}
283
			
478
			
284
			// Création du contenu à partir d'un template PHP
479
			// Création du contenu à partir d'un template PHP
285
			if (isset($this->squelette)) {
480
			if (isset($this->squelette)) {
286
				$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
481
				$contenu = Cel::traiterSquelettePhp($this->squelette, $donnees);
287
			}
482
			}
288
		}		
483
		}		
289
		return $contenu;
484
		return $contenu;
290
	}
485
	}
291
	
486
	
292
	private function construireDonneesCommunesAuFlux($observations) {
487
	private function construireDonneesCommunesAuFlux($observations) {
293
		$donnees = $this->getFlux($this->service);
488
		$donnees = $this->getFlux($this->service);
294
		$donnees['guid'] = $this->getUrlServiceBase();
489
		$donnees['guid'] = $this->getUrlServiceBase();
295
		$donnees['lien_service'] = $this->creerUrlService();
490
		$donnees['lien_service'] = $this->creerUrlService();
296
		$donnees['lien_cel'] = $this->config['settings']['celUrlAbsolu'];
491
		$donnees['lien_cel'] = $this->config['settings']['baseURLAbsolu'];
297
		$donnees['editeur'] = $this->config['settings']['editeur'];
492
		$donnees['editeur'] = $this->config['settings']['editeur'];
298
		$derniere_info_en_date = reset($observations);
493
		$derniere_info_en_date = reset($observations);
299
		$date_modification_timestamp = strtotime($derniere_info_en_date['date_modification']);
494
		$date_modification_timestamp = strtotime($derniere_info_en_date['date_modification']);
300
		$donnees['date_maj_RSS'] = date(DATE_RSS, $date_modification_timestamp);
495
		$donnees['date_maj_RSS'] = date(DATE_RSS, $date_modification_timestamp);
301
		$donnees['date_maj_ATOM'] = date(DATE_ATOM, $date_modification_timestamp);
496
		$donnees['date_maj_ATOM'] = date(DATE_ATOM, $date_modification_timestamp);
302
		$donnees['date_maj_W3C'] = date(DATE_W3C, $date_modification_timestamp);
497
		$donnees['date_maj_W3C'] = date(DATE_W3C, $date_modification_timestamp);
303
		$donnees['annee_courante'] = date('Y');
498
		$donnees['annee_courante'] = date('Y');
304
		$donnees['generateur'] = 'CEL - Jrest - CelSyndicationObservation';
499
		$donnees['generateur'] = 'CEL - Jrest - CelSyndicationObservation';
305
		preg_match('/([0-9]+)/', '$Revision$', $match);
500
		$donnees['generateur_version'] = (preg_match('/([0-9]+)/', '$Revision$', $match)) ?  $match[1] : '0';
306
		$donnees['generateur_version'] = $match[1];
-
 
307
		return $donnees; 
501
		return $donnees; 
308
	}
502
	}
309
	
503
	
310
	private function construireDonneesCommunesAuxItems($observation) {
504
	private function construireDonneesCommunesAuxItems($observation) {
311
		$item = array();
505
		$item = array();
312
		$date_modification_timestamp = $this->convertirDateHeureMysqlEnTimestamp($observation['date_modification']);
506
		$date_modification_timestamp = $this->convertirDateHeureMysqlEnTimestamp($observation['date_modification']);
313
		$item['date_maj_simple'] = strftime('%A %d %B %Y à %H:%M', $date_modification_timestamp);
507
		$item['date_maj_simple'] = strftime('%A %d %B %Y à %H:%M', $date_modification_timestamp);
314
		$item['date_maj_RSS'] = date(DATE_RSS, $date_modification_timestamp);
508
		$item['date_maj_RSS'] = date(DATE_RSS, $date_modification_timestamp);
315
		$item['date_maj_ATOM'] = date(DATE_ATOM, $date_modification_timestamp);
509
		$item['date_maj_ATOM'] = date(DATE_ATOM, $date_modification_timestamp);
316
		$item['date_maj_W3C'] = date(DATE_W3C, $date_modification_timestamp);
510
		$item['date_maj_W3C'] = date(DATE_W3C, $date_modification_timestamp);
317
		$item['date_creation_simple'] = strftime('%A %d %B %Y à %H:%M', strtotime($observation['date_creation']));
511
		$item['date_creation_simple'] = strftime('%A %d %B %Y à %H:%M', strtotime($observation['date_creation']));
318
		$item['titre'] = $this->creerTitre($observation);
512
		$item['titre'] = $this->creerTitre($observation);
319
		$item['guid'] = $this->creerGuidItem($observation);
513
		$item['guid'] = $this->creerGuidItem($observation);
320
		$item['lien'] = $this->creerLienItem($observation);
514
		$item['lien'] = $this->creerLienItem($observation);
321
		$item['categorie'] = $this->creerCategorie($item);
515
		$item['categorie'] = $this->creerCategorie($item);
322
		$item['description'] = $this->creerDescription($this->protegerCaracteresHtmlDansChamps($observation), $item);
516
		$item['description'] = $this->creerDescription($this->protegerCaracteresHtmlDansChamps($observation), $item);
323
		$item['description_encodee'] = htmlspecialchars($this->creerDescription($observation, $item));
517
		$item['description_encodee'] = htmlspecialchars($this->creerDescription($observation, $item));
324
		$item['modifier_par'] = $this->creerAuteur($observation['identifiant'], $this->etreFluxAdmin());
518
		$item['modifier_par'] = $this->creerAuteur($observation['identifiant'], $this->etreFluxAdmin());
325
		return $item;
519
		return $item;
326
	}
520
	}
327
	
521
	
328
	private function creerTitre($obs) {
522
	private function creerTitre($obs) {
329
		$nom_plante = $obs['nom_sel'].' [nn'.$obs['num_nom_sel'].']';
523
		$nom_plante = $obs['nom_sel'].' [nn'.$obs['num_nom_sel'].']';
330
		$lieu = $obs['location'].' ('.$obs['id_location'].')';
524
		$lieu = $obs['location'].' ('.$obs['id_location'].')';
331
		$utilisateur = $this->creerAuteur($obs['identifiant'], $this->etreFluxAdmin());
525
		$utilisateur = $this->creerAuteur($obs['identifiant'], $this->etreFluxAdmin());
332
		$titre = "$nom_plante à $lieu par $utilisateur";
526
		$titre = "$nom_plante à $lieu par $utilisateur";
333
		$titre = $this->nettoyerTexte($titre);
527
		$titre = $this->nettoyerTexte($titre);
334
		return $titre;
528
		return $titre;
335
	}
529
	}
336
	
530
	
337
	private function creerGuidItem($element) {
531
	private function creerGuidItem($element) {
338
		$guid = sprintf($this->config['settings']['guidObsTpl'], 'obs'.$element['id']);
532
		$guid = sprintf($this->config['settings']['guidObsTpl'], 'obs'.$element['id']);
339
		return $guid;
533
		return $guid;
340
	}
534
	}
341
	
535
	
342
	private function creerLienItem($element) {
536
	private function creerLienItem($element) {
343
		$lien = null;
537
		$lien = null;
344
		if ($element['num_nom_sel'] != 0) {
538
		if ($element['num_nom_sel'] != 0) {
345
			$lien = sprintf($this->config['settings']['efloreUrlTpl'], urlencode($element['num_nom_sel']), 'cel');
539
			$lien = sprintf($this->config['settings']['efloreUrlTpl'], urlencode($element['num_nom_sel']), 'cel');
346
		}
540
		}
347
		return $lien;
541
		return $lien;
348
	}
542
	}
349
	
543
	
350
	private function creerDescription($obs, $item) {
544
	private function creerDescription($obs, $item) {
351
		$id_obs = $obs['id'];
545
		$id_obs = $obs['id'];
352
		$famille = $obs['famille'];
546
		$famille = $obs['famille'];
353
		$nom_saisi = $obs['nom_sel'];
547
		$nom_saisi = $obs['nom_sel'];
354
		$nom_retenu = $obs['nom_ret'];
548
		$nom_retenu = $obs['nom_ret'];
355
		$auteur = $this->creerAuteur($obs['identifiant'], $this->etreFluxAdmin());
549
		$auteur = $this->creerAuteur($obs['identifiant'], $this->etreFluxAdmin());
356
		$mots_cles_obs = $this->decoderMotsClesObs($obs['identifiant'], $obs['mots_cles']);
550
		$mots_cles_obs = $this->decoderMotsClesObs($obs['identifiant'], $obs['mots_cles']);
357
		$lien_correction = sprintf($this->config['settings']['phpEditUrlTpl'], $obs['id']);
551
		$lien_correction = sprintf($this->config['settings']['phpEditUrlTpl'], $obs['id']);
358
		$lieu = $obs['location'].' ('.$obs['id_location'].') > '.$obs['lieudit'].' > '.$obs['station'];
552
		$lieu = $obs['location'].' ('.$obs['id_location'].') > '.$obs['lieudit'].' > '.$obs['station'];
359
		$milieu = $obs['milieu'];
553
		$milieu = $obs['milieu'];
360
		$coordonnees = ($this->etreNull($obs['coord_x']) && $this->etreNull($obs['coord_y'])) ? '' : $obs['coord_x'].'/'.$obs['coord_y'];
554
		$coordonnees = ($this->etreNull($obs['coord_x']) && $this->etreNull($obs['coord_y'])) ? '' : $obs['coord_x'].'/'.$obs['coord_y'];
361
		$commentaire = $obs['commentaire'];
555
		$commentaire = $obs['commentaire'];
362
		$date_observation = $this->formaterDate($obs['date_observation'], '%A %d %B %Y');
556
		$date_observation = $this->formaterDate($obs['date_observation'], '%A %d %B %Y');
363
		$date_transmission = $this->formaterDate($obs['date_transmission']);
557
		$date_transmission = $this->formaterDate($obs['date_transmission']);
364
		$date_modification = $this->formaterDate($obs['date_modification']);
558
		$date_modification = $this->formaterDate($obs['date_modification']);
365
		$date_creation = $this->formaterDate($obs['date_creation']);
559
		$date_creation = $this->formaterDate($obs['date_creation']);
366
		$transmission = $obs['transmission'] == 1 ? "oui ($date_transmission)" : 'non';
560
		$transmission = $obs['transmission'] == 1 ? "oui ($date_transmission)" : 'non';
367
		
561
		
368
		$description = '<h2>'."Observation #$id_obs de $nom_saisi".'</h2>'.
562
		$description = '<h2>'."Observation #$id_obs de $nom_saisi".'</h2>'.
369
			'<ul>'.
563
			'<ul>'.
370
			'<li>'.'Famille : '.$famille.'</li>'.
564
			'<li>'.'Famille : '.$famille.'</li>'.
371
			'<li>'.'Nom saisi : '.$nom_saisi.'</li>'.
565
			'<li>'.'Nom saisi : '.$nom_saisi.'</li>'.
372
			'<li>'.'Nom retenu : '.$nom_retenu.'</li>'.
566
			'<li>'.'Nom retenu : '.$nom_retenu.'</li>'.
373
			'<li>'.'Observée le : '.$date_observation.'</li>'.
567
			'<li>'.'Observée le : '.$date_observation.'</li>'.
374
			'<li>'.'Lieu : '.$lieu.'</li>'.
568
			'<li>'.'Lieu : '.$lieu.'</li>'.
375
			'<li>'.'Milieu : '.$milieu.'</li>'.
569
			'<li>'.'Milieu : '.$milieu.'</li>'.
376
			(($this->etreFluxAdmin()) ? '<li>Coordonnées (Lat/Long) : '.$coordonnees.'</li>' : '').
570
			(($this->etreFluxAdmin()) ? '<li>Coordonnées (Lat/Long) : '.$coordonnees.'</li>' : '').
377
			'<li>'.'Commentaire : '.$commentaire.'</li>'.
571
			'<li>'.'Commentaire : '.$commentaire.'</li>'.
378
			'<li>'.'Mots-clés : '.implode(', ', $mots_cles_obs).'</li>'.
572
			'<li>'.'Mots-clés : '.implode(', ', $mots_cles_obs).'</li>'.
379
			(($this->etreFluxAdmin()) ? '<li>Transmis (= public) : '.$transmission.'</li>' : '').
573
			(($this->etreFluxAdmin()) ? '<li>Transmis (= public) : '.$transmission.'</li>' : '').
380
			'<li>Modifiée le : '.$date_modification.'</li>'.
574
			'<li>Modifiée le : '.$date_modification.'</li>'.
381
			'<li>Créée le : '.$date_creation.'</li>'.
575
			'<li>Créée le : '.$date_creation.'</li>'.
382
			(($this->etreFluxAdmin()) ? '<li><a href="'.$lien_correction.'">Corriger cette observation</a></li>' : '').
576
			(($this->etreFluxAdmin()) ? '<li><a href="'.$lien_correction.'">Corriger cette observation</a></li>' : '').
383
			'</ul>';
577
			'</ul>';
384
		$description = $this->nettoyerTexte($description);
578
		$description = $this->nettoyerTexte($description);
385
		return $description;
579
		return $description;
386
	}
580
	}
387
	
581
	
388
	private function creerCategorie($element) {
582
	private function creerCategorie($element) {
389
		$categorie = '';
583
		$categorie = '';
390
		$categorie = 'Observation';
584
		$categorie = 'Observation';
391
		$categorie = $this->nettoyerTexte($categorie);
585
		$categorie = $this->nettoyerTexte($categorie);
392
		return $categorie;
586
		return $categorie;
393
	}
587
	}
394
	
588
	
395
	private function etreFluxAdmin() {
589
	private function etreFluxAdmin() {
396
		return ($_GET['admin'] == '1') ? true : false;
590
		return (isset($_GET['admin']) && $_GET['admin'] == '1') ? true : false;
397
	}
591
	}
398
	
592
	
399
	private function creerUrlService() {
593
	private function creerUrlService() {
400
		$url_service = $this->getUrlServiceBase();
594
		$url_service = $this->getUrlServiceBase();
401
		if (count($_GET) > 0) {
595
		if (count($_GET) > 0) {
402
			$parametres_get = array();
596
			$parametres_get = array();
403
			foreach ($_GET as $cle => $valeur) {
597
			foreach ($_GET as $cle => $valeur) {
404
				$parametres_get[] = $cle.'='.$valeur;
598
				$parametres_get[] = $cle.'='.$valeur;
405
			}
599
			}
406
			$url_service .= '?'.implode('&amp;', $parametres_get);
600
			$url_service .= '?'.implode('&amp;', $parametres_get);
407
		}
601
		}
408
		return $url_service;
602
		return $url_service;
409
	}
603
	}
410
}	
604
}