Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1147 → Rev 1148

/trunk/jrest/services/CelWidgetMapPoint.php
143,45 → 143,23
 
public function getTout($params) {
 
$emplacements = null;
$coordonnees_nulles = "coord_x = '000null' OR coord_x = '' ".
" OR coord_y = '000null' OR coord_y = ''";
$coordonnees_non_nulles = "coord_x != '000null' AND coord_x != '' ".
" AND coord_y != '000null' AND coord_y != ''";
$coordonnees_non_nulles_pas_sensible = "(".$coordonnees_non_nulles." AND mots_cles_texte NOT LIKE '%sensible%')";
$emplacements = null;
$concatenation_id = 'CONCAT(coord_x,coord_y, wgs84_latitude,wgs84_longitude) ';
$requete = 'SELECT DISTINCT *, location AS nom, '.
"IF (".$coordonnees_non_nulles_pas_sensible.", ".
"'stations', ".
"'communes' ".
") as type_emplacement, ".
"IF (".$coordonnees_non_nulles_pas_sensible.", ".
"mots_cles_texte, ".
"coord_x, ".
"wgs84_latitude ".
") as lat, ".
"IF (".$coordonnees_non_nulles_pas_sensible.", ".
"wgs84_latitude, ".
"coord_y, ".
"wgs84_longitude ".
") as lng, ".
"IF (".$coordonnees_non_nulles_pas_sensible.", ".
'CONCAT("'.self::MARQUEUR_STATION.':",coord_x,"|",coord_y), '.
'CONCAT("'.self::MARQUEUR_COMMUNE.':",wgs84_latitude,"|",wgs84_longitude) '.
") as id ".
"wgs84_longitude, ".
$concatenation_id." as id_coord ".
'FROM cel_inventory AS i '.
' LEFT JOIN locations AS l '.
' ON (l.name = i.location AND l.code = i.id_location) '.
"WHERE transmission = '1' ".
" AND (".
"(".($this->construireWhereRectangleStationOR() != null ? $this->construireWhereRectangleStationOR().' AND ' : '').
" (mots_cles_texte IS NULL OR mots_cles_texte NOT LIKE '%sensible%') ".
")".
" OR ".
" ( ".
"(".($this->construireWhereRectangleCommuneOR() != null ? $this->construireWhereRectangleCommuneOR().' AND ' : '').
"(".$coordonnees_nulles.")".
")".
" ) ".
") ".
$this->construireWhereRectangleStationOR()." OR ".
$this->construireWhereRectangleCommuneOR().") ".
$this->construireWhereDept().
$this->construireWhereCommune().
$this->construireWhereUtilisateur().
190,8 → 168,7
$this->construireWhereDate().
$this->construireWhereCommentaire().
$this->construireWhereProjet().
$this->construireWhereTag().' LIMIT 0,20000';
$this->construireWhereTag().' GROUP BY id_coord';
$resultats_emplacements = $this->executerRequete($requete);
$emplacements = $this->traiterEmplacements($resultats_emplacements, $this->compterObservations($params));
return $emplacements;
212,17 → 189,9
' LEFT JOIN locations AS l '.
' ON (l.name = i.location AND l.code = i.id_location) '.
"WHERE transmission = '1' ".
" AND (".
"(".($this->construireWhereRectangleStationOR() != null ? $this->construireWhereRectangleStationOR().' AND ' : '').
" (mots_cles_texte IS NULL OR mots_cles_texte NOT LIKE '%sensible%') ".
")".
" OR ".
" ( ".
"(".($this->construireWhereRectangleCommuneOR() != null ? $this->construireWhereRectangleCommuneOR().' Or ' : '').
" mots_cles_texte LIKE '%sensible%' ".
")".
" ) ".
") ".
" AND ".
"(".$this->construireWhereRectangleStationOR()." OR ".
$this->construireWhereRectangleCommuneOR().
$this->construireWhereDept().
$this->construireWhereCommune().
$this->construireWhereUtilisateur().
254,7 → 223,7
// laisser la classe cartoGroupage compter les élements simplifie le comptage
// et permet de ne pas reparser le tableau pour compter les différents éléments
$nb_elements = CartoGroupage::getNbElements();
// les bornes servent à centrer la carte dans le cas ou l'on demande des paramètres précis
$marqueurs['stats']['coordmax'] = CartoGroupage::getBornes();
$marqueurs['stats']['stations'] = $nb_elements['stations'];
$marqueurs['stats']['communes'] = $nb_elements['communes'];
282,7 → 251,6
if (is_numeric($commune['lat']) && is_numeric($commune['lng'])) {
extract($commune);
$id = self::MARQUEUR_COMMUNE.':'.$lat.'|'.$lng;
//$this->definirLatLngMaxMin($marqueurs, $lat, $lng);
$lata = round($lat, 5);
$lnga = round($lng, 5);
 
397,6 → 365,7
" ON (l.name = i.location AND l.code = i.id_location) ".
"WHERE transmission = '1' ".
((!$this->etreNull($this->parametres['commune'])) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
$this->construireWhereDept().
$this->construireWhereUtilisateur().
$this->construireWhereNumTaxon().
$this->construireWhereNomTaxon().
406,7 → 375,6
$this->construireWhereTag().
'ORDER BY nom_sel ASC '.
"LIMIT {$this->start},{$this->limit} ";
 
$resultats = $this->requeter($requete, self::SQL_RETOUR_COMPLET, self::SQL_MODE_OBJET);
$requete = 'SELECT FOUND_ROWS()';
$total = (int) $this->requeter($requete, self::SQL_RETOUR_COLONNE);