| 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 395... |
Line 364... |
| 395 |
'FROM cel_inventory AS i '.
|
364 |
'FROM cel_inventory AS i '.
|
| 396 |
' LEFT JOIN locations AS l '.
|
365 |
' LEFT JOIN locations AS l '.
|
| 397 |
" ON (l.name = i.location AND l.code = i.id_location) ".
|
366 |
" ON (l.name = i.location AND l.code = i.id_location) ".
|
| 398 |
"WHERE transmission = '1' ".
|
367 |
"WHERE transmission = '1' ".
|
| 399 |
((!$this->etreNull($this->parametres['commune'])) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
|
368 |
((!$this->etreNull($this->parametres['commune'])) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
|
| - |
|
369 |
$this->construireWhereDept().
|
| 400 |
$this->construireWhereUtilisateur().
|
370 |
$this->construireWhereUtilisateur().
|
| 401 |
$this->construireWhereNumTaxon().
|
371 |
$this->construireWhereNumTaxon().
|
| 402 |
$this->construireWhereNomTaxon().
|
372 |
$this->construireWhereNomTaxon().
|
| 403 |
$this->construireWhereDate().
|
373 |
$this->construireWhereDate().
|
| 404 |
$this->construireWhereCommentaire().
|
374 |
$this->construireWhereCommentaire().
|
| 405 |
$this->construireWhereProjet().
|
375 |
$this->construireWhereProjet().
|
| 406 |
$this->construireWhereTag().
|
376 |
$this->construireWhereTag().
|
| 407 |
'ORDER BY nom_sel ASC '.
|
377 |
'ORDER BY nom_sel ASC '.
|
| 408 |
"LIMIT {$this->start},{$this->limit} ";
|
378 |
"LIMIT {$this->start},{$this->limit} ";
|
| 409 |
|
- |
|
| 410 |
$resultats = $this->requeter($requete, self::SQL_RETOUR_COMPLET, self::SQL_MODE_OBJET);
|
379 |
$resultats = $this->requeter($requete, self::SQL_RETOUR_COMPLET, self::SQL_MODE_OBJET);
|
| 411 |
$requete = 'SELECT FOUND_ROWS()';
|
380 |
$requete = 'SELECT FOUND_ROWS()';
|
| 412 |
$total = (int) $this->requeter($requete, self::SQL_RETOUR_COLONNE);
|
381 |
$total = (int) $this->requeter($requete, self::SQL_RETOUR_COLONNE);
|
| 413 |
}
|
382 |
}
|
| Line 614... |
Line 583... |
| 614 |
$lat = $this->proteger($lat);
|
583 |
$lat = $this->proteger($lat);
|
| 615 |
$lng = $this->proteger($lng);
|
584 |
$lng = $this->proteger($lng);
|
| 616 |
$sql = " AND (coord_x = $lat AND coord_y = $lng) ";
|
585 |
$sql = " AND (coord_x = $lat AND coord_y = $lng) ";
|
| 617 |
}
|
586 |
}
|
| 618 |
}
|
587 |
}
|
| 619 |
$sql .= ' AND mots_cles_texte NOT LIKE %sensible%';
|
588 |
$sql .= ' AND mots_cles_texte NOT LIKE "%sensible%" ';
|
| 620 |
return $sql;
|
589 |
return $sql;
|
| 621 |
}
|
590 |
}
|
| Line 622... |
Line 591... |
| 622 |
|
591 |
|
| 623 |
private function construireWhereCommentaire() {
|
592 |
private function construireWhereCommentaire() {
|