Subversion Repositories eFlore/Applications.cel

Rev

Rev 837 | Rev 915 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 837 Rev 841
Line 74... Line 74...
74
		$this->dept = (isset($dept) ? $dept : '*');
74
		$this->dept = (isset($dept) ? $dept : '*');
75
		$this->commune = (isset($commune) ? $commune : '*');
75
		$this->commune = (isset($commune) ? $commune : '*');
76
		$this->num_taxon = (isset($num_taxon) ? $num_taxon : '*');
76
		$this->num_taxon = (isset($num_taxon) ? $num_taxon : '*');
77
		$this->station = (isset($station) ? $station : null);
77
		$this->station = (isset($station) ? $station : null);
78
		$this->format = (isset($format) ? $format : null);
78
		$this->format = (isset($format) ? $format : null);
-
 
79
		$this->start = (isset($start) ? $start : null);
-
 
80
		$this->limit = (isset($limit) ? $limit : null);
79
	}
81
	}
Line 80... Line 82...
80
 
82
 
81
	/**
83
	/**
82
	 * Carte par défaut
84
	 * Carte par défaut
Line 121... Line 123...
121
		$url = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::SERVICE_CARTO_NOM);
123
		$url = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::SERVICE_CARTO_NOM);
122
		if ($action) {
124
		if ($action) {
123
			$url .= "/$action";
125
			$url .= "/$action";
Line 124... Line 126...
124
			
126
			
125
			$parametres_retenus = array();
127
			$parametres_retenus = array();
126
			$parametres_a_tester = array('station', 'utilisateur', 'projet', 'dept', 'commune', 'num_taxon');
128
			$parametres_a_tester = array('station', 'utilisateur', 'projet', 'dept', 'commune', 'num_taxon', 'start', 'limit');
127
			foreach ($parametres_a_tester as $param) {
129
			foreach ($parametres_a_tester as $param) {
128
				if ($this->$param != null && $this->$param != '*') {
130
				if (isset($this->$param) && $this->$param != '*') {
129
					$parametres_retenus[$param] = $this->$param;
131
					$parametres_retenus[$param] = $this->$param;
130
				}
132
				}
131
			}
133
			}
132
			if (count($parametres_retenus) > 0) {
134
			if (count($parametres_retenus) > 0) {
Line 135... Line 137...
135
					$parametres_url[] = $cle.'='.$valeur;
137
					$parametres_url[] = $cle.'='.$valeur;
136
				}
138
				}
137
				$url .= '?'.implode('&', $parametres_url);
139
				$url .= '?'.implode('&', $parametres_url);
138
			}
140
			}
139
		}
141
		}
140
		$this->debug[] = $url;
-
 
141
		// Prendre en compte param "station"
-
 
142
		return $url; 
142
		return $url; 
143
	}
143
	}
Line 144... Line 144...
144
	
144
	
145
	private function chargerTaxons() {
145
	private function chargerTaxons() {
Line 200... Line 200...
200
	}
200
	}
Line 201... Line 201...
201
	
201
	
202
	/**
202
	/**
203
	 * Tableau des observations d'une station
203
	 * Tableau des observations d'une station
204
	 */
204
	 */
205
	public function executerObservations() {
205
	public function executerStation() {
206
		$widget = null;
206
		$widget = null;
207
		$observations = $this->chargerObservations();
207
		$observations = $this->chargerObservations();
Line 208... Line 208...
208
		$nbre_obs = $this->chargerObservationsNbre();
208
		$nbre_obs = $this->chargerObservationsNbre();
Line 230... Line 230...
230
		$widget['donnees']['nbre_obs_total'] = $nbre_obs;
230
		$widget['donnees']['nbre_obs_total'] = $nbre_obs;
Line 231... Line 231...
231
		
231
		
232
		return $widget;
232
		return $widget;
Line -... Line 233...
-
 
233
	}
-
 
234
	
-
 
235
	
-
 
236
	/**
-
 
237
	 * Tableau des observations d'une station
-
 
238
	 */
-
 
239
	public function executerObservations() {
-
 
240
		$widget = null;
-
 
241
		$observations = $this->chargerObservations();
-
 
242
		$nbre_obs = $this->chargerObservationsNbre();
-
 
243
				
-
 
244
		// Création des infos du widget
-
 
245
		if (isset($observations['commune'])) {
-
 
246
			$commune = $observations['commune'];
-
 
247
			unset($observations['commune']);
-
 
248
			$widget['donnees']['commune'] = $commune;
-
 
249
		}
-
 
250
		
-
 
251
		$obs_ids = null;
-
 
252
		if (isset($observations['ids'])) {
-
 
253
			$obs_ids = $observations['ids'];
-
 
254
			unset($observations['ids']);
-
 
255
		}
-
 
256
		$widget['squelette'] = $this->choisirFormatSortie(count($observations)).'_contenu';
-
 
257
		
-
 
258
		if ($widget['squelette'] == 'obs_liste_contenu' && $obs_ids != null && count($obs_ids) > 0) {
-
 
259
			$widget['donnees']['images'] = $this->chargerImages($obs_ids);
-
 
260
		}
-
 
261
		$widget['donnees']['observations'] = $observations;
-
 
262
		
-
 
263
		return $widget;
233
	}
264
	}
Line 234... Line 265...
234
	
265
	
Line 235... Line 266...
235
	private function chargerPagination($url_tpl, $nbre) {
266
	private function chargerPagination($url_tpl, $nbre) {
Line 245... Line 276...
245
	}
276
	}
Line 246... Line 277...
246
	
277
	
247
	private function chargerObservations() {
278
	private function chargerObservations() {
248
		// Récupération des données au format Json
279
		// Récupération des données au format Json
-
 
280
		$url = $this->contruireUrlServiceCarto('observations');
249
		$url = $this->contruireUrlServiceCarto('observations');
281
		$this->debug[] = $url;
250
		$json = $this->getDao()->consulter($url);
282
		$json = $this->getDao()->consulter($url);
Line 251... Line 283...
251
		$donnees = json_decode($json);
283
		$donnees = json_decode($json);
252
		
284
		
Line 299... Line 331...
299
	
331
	
300
	private function chargerImages($obs_ids) {
332
	private function chargerImages($obs_ids) {
301
		// Récupération des données au format Json
333
		// Récupération des données au format Json
302
		$service = 'CelImage/liste-ids?obsId='.implode(',', $obs_ids);
334
		$service = 'CelImage/liste-ids?obsId='.implode(',', $obs_ids);
303
		$url = sprintf($this->config['chemins']['baseURLServicesCelTpl'], $service);
-
 
-
 
335
		$url = sprintf($this->config['chemins']['baseURLServicesCelTpl'], $service);
304
		$this->debug[] = $url;
336
		
305
		$json = $this->getDao()->consulter($url);
337
		$json = $this->getDao()->consulter($url);
Line 306... Line 338...
306
		$donnees = json_decode($json);
338
		$donnees = json_decode($json);
307
			
339