Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1142 Rev 1148
Line 141... Line 141...
141
		return $stations;
141
		return $stations;
142
	}
142
	}
Line 143... Line 143...
143
 
143
 
Line 144... Line 144...
144
	public function getTout($params) {
144
	public function getTout($params) {
145
 
-
 
146
		$emplacements = null;
-
 
147
		$coordonnees_nulles = "coord_x = '000null' OR coord_x = '' ".
145
 
148
								" OR coord_y = '000null' OR coord_y = ''";
-
 
149
		$coordonnees_non_nulles = "coord_x != '000null' AND coord_x != '' ".
-
 
Line 150... Line 146...
150
								" AND coord_y != '000null' AND coord_y != ''"; 
146
		$emplacements = null;		
151
		$coordonnees_non_nulles_pas_sensible = "(".$coordonnees_non_nulles." AND mots_cles_texte NOT LIKE '%sensible%')";
-
 
152
		
147
		$concatenation_id = 'CONCAT(coord_x,coord_y, wgs84_latitude,wgs84_longitude) ';
153
		$requete =  'SELECT DISTINCT *, location AS nom, '.
-
 
154
							"IF (".$coordonnees_non_nulles_pas_sensible.", ".
-
 
155
								"'stations', ".
-
 
156
							"'communes' ".
148
		
157
							") as type_emplacement, ".
149
		$requete =  'SELECT DISTINCT *, location AS nom, '.
158
							"IF (".$coordonnees_non_nulles_pas_sensible.", ".
-
 
159
								"coord_x, ".
-
 
160
								"wgs84_latitude ".
150
								"mots_cles_texte, ".
161
							") as lat, ".
151
								"coord_x, ".
162
							"IF (".$coordonnees_non_nulles_pas_sensible.", ".
-
 
163
								"coord_y, ".
152
								"wgs84_latitude, ".
164
								"wgs84_longitude ".
-
 
165
							") as lng, ".
-
 
166
							"IF (".$coordonnees_non_nulles_pas_sensible.", ".
-
 
167
								'CONCAT("'.self::MARQUEUR_STATION.':",coord_x,"|",coord_y), '.
153
								"coord_y, ".
168
								'CONCAT("'.self::MARQUEUR_COMMUNE.':",wgs84_latitude,"|",wgs84_longitude) '.
154
								"wgs84_longitude, ".
169
							") as id ".
155
								$concatenation_id." as id_coord ".
170
					'FROM cel_inventory AS i '.
156
					'FROM cel_inventory AS i '.
171
                    '   LEFT JOIN locations AS l '.
157
                    '   LEFT JOIN locations AS l '.
172
                    '       ON (l.name = i.location AND l.code = i.id_location) '.
158
                    '       ON (l.name = i.location AND l.code = i.id_location) '.
173
                    "WHERE transmission = '1' ".
-
 
174
					" AND (".
-
 
175
						"(".($this->construireWhereRectangleStationOR() != null ? $this->construireWhereRectangleStationOR().' AND ' : '').
-
 
176
							" (mots_cles_texte IS NULL OR mots_cles_texte NOT LIKE '%sensible%') ".
-
 
177
						")".
-
 
178
						" OR ".
159
                    "WHERE transmission = '1' ".
179
						" ( ".
-
 
180
							"(".($this->construireWhereRectangleCommuneOR() != null ? $this->construireWhereRectangleCommuneOR().' AND ' : '').
-
 
181
								"(".$coordonnees_nulles.")".
-
 
182
							")".
160
					" AND (".
183
						" ) ".
161
					$this->construireWhereRectangleStationOR()." OR ".
184
					") ".
162
					$this->construireWhereRectangleCommuneOR().") ".
185
					$this->construireWhereDept().
163
					$this->construireWhereDept().
186
                    $this->construireWhereCommune().
164
                    $this->construireWhereCommune().
187
                    $this->construireWhereUtilisateur().
165
                    $this->construireWhereUtilisateur().
188
					$this->construireWhereNumTaxon().
166
					$this->construireWhereNumTaxon().
189
					$this->construireWhereNomTaxon().
167
					$this->construireWhereNomTaxon().
190
					$this->construireWhereDate().
168
					$this->construireWhereDate().
191
					$this->construireWhereCommentaire().
-
 
192
					$this->construireWhereProjet().
169
					$this->construireWhereCommentaire().
193
					$this->construireWhereTag().' LIMIT 0,20000';
170
					$this->construireWhereProjet().
194
		
171
					$this->construireWhereTag().' GROUP BY id_coord';
195
		$resultats_emplacements = $this->executerRequete($requete);
172
		$resultats_emplacements = $this->executerRequete($requete);
Line 210... Line 187...
210
		$requete =  'SELECT COUNT(*) AS nb '.
187
		$requete =  'SELECT COUNT(*) AS nb '.
211
					'FROM cel_inventory AS i '.
188
					'FROM cel_inventory AS i '.
212
                    '   LEFT JOIN locations AS l '.
189
                    '   LEFT JOIN locations AS l '.
213
                    '       ON (l.name = i.location AND l.code = i.id_location) '.
190
                    '       ON (l.name = i.location AND l.code = i.id_location) '.
214
                    "WHERE transmission = '1' ".
191
                    "WHERE transmission = '1' ".
215
					" AND (".
192
					" AND ".
216
						"(".($this->construireWhereRectangleStationOR() != null ? $this->construireWhereRectangleStationOR().' AND ' : '').
193
					"(".$this->construireWhereRectangleStationOR()." OR ".
217
							" (mots_cles_texte IS NULL OR mots_cles_texte NOT LIKE '%sensible%') ".
-
 
218
						")".
-
 
219
						" OR ".
-
 
220
						" ( ".
-
 
221
							"(".($this->construireWhereRectangleCommuneOR() != null ? $this->construireWhereRectangleCommuneOR().' Or ' : '').
-
 
222
							" mots_cles_texte LIKE '%sensible%' ".
194
					$this->construireWhereRectangleCommuneOR().
223
							")".
-
 
224
						" ) ".
-
 
225
					") ".
-
 
226
					$this->construireWhereDept().
195
					$this->construireWhereDept().
227
                    $this->construireWhereCommune().
196
                    $this->construireWhereCommune().
228
                    $this->construireWhereUtilisateur().
197
                    $this->construireWhereUtilisateur().
229
					$this->construireWhereNumTaxon().
198
					$this->construireWhereNumTaxon().
230
					$this->construireWhereNomTaxon().
199
					$this->construireWhereNomTaxon().
Line 252... Line 221...
252
			$marqueurs['points'] = CartoGroupage::creerGroupesQuadtree($emplacements, $ne['lat'], $ne['lng'], $sw['lat'], $sw['lng'], $zoom);
221
			$marqueurs['points'] = CartoGroupage::creerGroupesQuadtree($emplacements, $ne['lat'], $ne['lng'], $sw['lat'], $sw['lng'], $zoom);
Line 253... Line 222...
253
 
222
 
254
			// laisser la classe cartoGroupage compter les élements simplifie le comptage
223
			// laisser la classe cartoGroupage compter les élements simplifie le comptage
255
			// et permet de ne pas reparser le tableau pour compter les différents éléments
224
			// et permet de ne pas reparser le tableau pour compter les différents éléments
256
			$nb_elements = CartoGroupage::getNbElements();
-
 
-
 
225
			$nb_elements = CartoGroupage::getNbElements();
257
			
226
			// les bornes servent à centrer la carte dans le cas ou l'on demande des paramètres précis
258
			$marqueurs['stats']['coordmax'] = CartoGroupage::getBornes();
227
			$marqueurs['stats']['coordmax'] = CartoGroupage::getBornes();
259
			$marqueurs['stats']['stations'] = $nb_elements['stations'];
228
			$marqueurs['stats']['stations'] = $nb_elements['stations'];
260
			$marqueurs['stats']['communes'] = $nb_elements['communes'];
229
			$marqueurs['stats']['communes'] = $nb_elements['communes'];
261
			$marqueurs['stats']['observations'] = (int)$nb_total_observation;
230
			$marqueurs['stats']['observations'] = (int)$nb_total_observation;
Line 280... Line 249...
280
		if ($communes !== false) {
249
		if ($communes !== false) {
281
			foreach ($communes as $commune) {
250
			foreach ($communes as $commune) {
282
				if (is_numeric($commune['lat']) && is_numeric($commune['lng'])) {
251
				if (is_numeric($commune['lat']) && is_numeric($commune['lng'])) {
283
					extract($commune);
252
					extract($commune);
284
					$id = self::MARQUEUR_COMMUNE.':'.$lat.'|'.$lng;
253
					$id = self::MARQUEUR_COMMUNE.':'.$lat.'|'.$lng;
285
					//$this->definirLatLngMaxMin($marqueurs, $lat, $lng);
-
 
286
					$lata = round($lat, 5);
254
					$lata = round($lat, 5);
287
					$lnga = round($lng, 5);
255
					$lnga = round($lng, 5);
Line 288... Line 256...
288
 
256
 
289
					if (!isset($points[$id])) {
257
					if (!isset($points[$id])) {
Line 395... Line 363...
395
						'FROM cel_inventory AS i '.
363
						'FROM cel_inventory AS i '.
396
						'	LEFT JOIN locations AS l '.
364
						'	LEFT JOIN locations AS l '.
397
						"		ON (l.name = i.location AND l.code = i.id_location) ".
365
						"		ON (l.name = i.location AND l.code = i.id_location) ".
398
						"WHERE transmission = '1' ".
366
						"WHERE transmission = '1' ".
399
						((!$this->etreNull($this->parametres['commune'])) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
367
						((!$this->etreNull($this->parametres['commune'])) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
-
 
368
						$this->construireWhereDept().
400
						$this->construireWhereUtilisateur().
369
						$this->construireWhereUtilisateur().
401
						$this->construireWhereNumTaxon().
370
						$this->construireWhereNumTaxon().
402
						$this->construireWhereNomTaxon().
371
						$this->construireWhereNomTaxon().
403
						$this->construireWhereDate().
372
						$this->construireWhereDate().
404
						$this->construireWhereCommentaire().
373
						$this->construireWhereCommentaire().
405
						$this->construireWhereProjet().
374
						$this->construireWhereProjet().
406
						$this->construireWhereTag().
375
						$this->construireWhereTag().
407
	                    'ORDER BY nom_sel ASC '.
376
	                    'ORDER BY nom_sel ASC '.
408
	                    "LIMIT {$this->start},{$this->limit} ";
377
	                    "LIMIT {$this->start},{$this->limit} ";
409
 
-
 
410
			$resultats = $this->requeter($requete, self::SQL_RETOUR_COMPLET, self::SQL_MODE_OBJET);
378
			$resultats = $this->requeter($requete, self::SQL_RETOUR_COMPLET, self::SQL_MODE_OBJET);
411
			$requete = 'SELECT FOUND_ROWS()';
379
			$requete = 'SELECT FOUND_ROWS()';
412
			$total = (int) $this->requeter($requete, self::SQL_RETOUR_COLONNE);
380
			$total = (int) $this->requeter($requete, self::SQL_RETOUR_COLONNE);
413
		}
381
		}