Line 107... |
Line 107... |
107 |
}
|
107 |
}
|
Line 108... |
Line 108... |
108 |
|
108 |
|
Line 109... |
Line 109... |
109 |
public function getTout($params) {
|
109 |
public function getTout($params) {
|
110 |
|
110 |
|
111 |
$emplacements = null;
|
111 |
$emplacements = null;
|
112 |
$concatenation_id = "CONCAT(IFNULL(latitude,''),IFNULL(longitude,''), IFNULL(wgs84_latitude,''),IFNULL(wgs84_longitude,'')) ";
|
112 |
$concatenation_id = "CONCAT(IFNULL(latitude,''),IFNULL(longitude,'')) ";
|
113 |
$transmission = ( $this->standard = 0) ? "transmission = '1' AND " : "";
|
113 |
$transmission = ( $this->standard = 0) ? "transmission = '1' AND " : "";
|
114 |
$requete = 'SELECT ce_zone_geo, zone_geo, station, '.
|
114 |
$requete = 'SELECT ce_zone_geo, zone_geo, station, '.
|
115 |
"mots_cles_texte, ".
|
115 |
"mots_cles_texte, ".
|
116 |
"latitude, ".
|
116 |
"latitude, ".
|
117 |
"wgs84_latitude, ".
|
117 |
"NULL as wgs84_latitude, ".
|
118 |
"longitude, ".
|
118 |
"longitude, ".
|
119 |
"wgs84_longitude, ".
|
119 |
"NULL as wgs84_longitude, ".
|
120 |
$concatenation_id." as id_coord ".
|
- |
|
121 |
'FROM '.$this->table_export.' AS co '.
|
- |
|
- |
|
120 |
$concatenation_id." as id_coord ".
|
122 |
' LEFT JOIN cel_zones_geo AS zg '.
|
121 |
'FROM '.$this->table_export.' AS co '.
|
123 |
' ON (zg.nom = co.zone_geo AND zg.code = co.ce_zone_geo) '.
|
122 |
|
124 |
"WHERE ".$transmission.
|
123 |
"WHERE ".$transmission.
|
125 |
" (".
|
124 |
" (".
|
126 |
$this->construireWhereRectangleStationOR()." OR ".
|
125 |
$this->construireWhereRectangleStationOR()." OR ".
|
Line 158... |
Line 157... |
158 |
|
157 |
|
159 |
private function compterObservations($params) {
|
158 |
private function compterObservations($params) {
|
160 |
$transmission = ( $this->standard = 0) ? "transmission = '1' AND " : "";
|
159 |
$transmission = ( $this->standard = 0) ? "transmission = '1' AND " : "";
|
161 |
$requete = 'SELECT COUNT(*) as nb '.
|
160 |
$requete = 'SELECT COUNT(*) as nb '.
|
162 |
'FROM '.$this->table_export.' AS co '.
|
- |
|
163 |
' LEFT JOIN cel_zones_geo AS zg '.
|
- |
|
164 |
' ON (zg.nom = co.zone_geo AND zg.code = co.ce_zone_geo) '.
|
161 |
'FROM '.$this->table_export.' AS co '.
|
165 |
"WHERE ".$transmission.
|
162 |
"WHERE ".$transmission.
|
166 |
" (".
|
163 |
" (".
|
167 |
$this->construireWhereRectangleStationOR()." OR ".
|
164 |
$this->construireWhereRectangleStationOR()." OR ".
|
168 |
$this->construireWhereRectangleCommuneOR().") ".
|
165 |
$this->construireWhereRectangleCommuneOR().") ".
|
Line 352... |
Line 349... |
352 |
$requete = 'SELECT SQL_CALC_FOUND_ROWS id_observation, ce_utilisateur, courriel_utilisateur, pseudo_utilisateur as nom_utilisateur, "" as prenom_utilisateur, '.
|
349 |
$requete = 'SELECT SQL_CALC_FOUND_ROWS id_observation, ce_utilisateur, courriel_utilisateur, pseudo_utilisateur as nom_utilisateur, "" as prenom_utilisateur, '.
|
353 |
' nom_sel, nom_ret, nom_sel_nn, nom_ret_nn, "" as nt, famille, '.
|
350 |
' nom_sel, nom_ret, nom_sel_nn, nom_ret_nn, "" as nt, famille, '.
|
354 |
' lieudit, zone_geo, date_observation, milieu, commentaire, '.
|
351 |
' lieudit, zone_geo, date_observation, milieu, commentaire, '.
|
355 |
' utm_secteur, utm_x, utm_y, code, date_transmission, nom_referentiel '.
|
352 |
' utm_secteur, utm_x, utm_y, code, date_transmission, nom_referentiel '.
|
356 |
'FROM '.$this->table_export.' AS co '.
|
353 |
'FROM '.$this->table_export.' AS co '.
|
357 |
' LEFT JOIN cel_zones_geo AS zg '.
|
- |
|
358 |
" ON (zg.nom = co.zone_geo AND zg.code = co.ce_zone_geo) ".
|
- |
|
359 |
"WHERE ".$transmission.
|
354 |
"WHERE ".$transmission.
|
360 |
(($this->communeEstDemandee()) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
|
355 |
(($this->communeEstDemandee()) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
|
361 |
$this->construireWhereDept().
|
356 |
$this->construireWhereDept().
|
362 |
$this->construireWherePays().
|
357 |
$this->construireWherePays().
|
363 |
$this->construireWhereUtilisateur().
|
358 |
$this->construireWhereUtilisateur().
|
Line 500... |
Line 495... |
500 |
public function getTaxons($params) {
|
495 |
public function getTaxons($params) {
|
501 |
$json = null;
|
496 |
$json = null;
|
502 |
$transmission = ( $this->standard = 0) ? "transmission = '1' AND " : "";
|
497 |
$transmission = ( $this->standard = 0) ? "transmission = '1' AND " : "";
|
503 |
$requete = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT nom_ret, nom_ret_nn, nt, famille '.
|
498 |
$requete = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT nom_ret, nom_ret_nn, nt, famille '.
|
504 |
'FROM '.$this->table_export.' AS co '.
|
499 |
'FROM '.$this->table_export.' AS co '.
|
505 |
' LEFT JOIN cel_zones_geo AS zg '.
|
- |
|
506 |
' ON (zg.nom = co.zone_geo AND zg.code = co.ce_zone_geo) '.
|
- |
|
507 |
"WHERE ".$transmission.
|
500 |
"WHERE ".$transmission.
|
508 |
" nom_ret != '' ".
|
501 |
" nom_ret != '' ".
|
509 |
$this->construireWhereDept().
|
502 |
$this->construireWhereDept().
|
510 |
$this->construireWhereCommune().
|
503 |
$this->construireWhereCommune().
|
511 |
$this->construireWherePays().
|
504 |
$this->construireWherePays().
|
Line 559... |
Line 552... |
559 |
extract($this->decomposerParametreStation());
|
552 |
extract($this->decomposerParametreStation());
|
560 |
if (isset($type)) {
|
553 |
if (isset($type)) {
|
561 |
if ($type == self::MARQUEUR_COMMUNE) {
|
554 |
if ($type == self::MARQUEUR_COMMUNE) {
|
562 |
$lat = Cel::db()->proteger($lat.'%');
|
555 |
$lat = Cel::db()->proteger($lat.'%');
|
563 |
$lng = Cel::db()->proteger($lng.'%');
|
556 |
$lng = Cel::db()->proteger($lng.'%');
|
564 |
$sql = " AND wgs84_latitude LIKE $lat AND wgs84_longitude LIKE $lng ";
|
557 |
//$sql = " AND wgs84_latitude LIKE $lat AND wgs84_longitude LIKE $lng ";
|
565 |
} else if ($type == self::MARQUEUR_STATION) {
|
558 |
} else if ($type == self::MARQUEUR_STATION) {
|
566 |
$lat = Cel::db()->proteger($lat.'%');
|
559 |
$lat = Cel::db()->proteger($lat.'%');
|
567 |
$lng = Cel::db()->proteger($lng.'%');
|
560 |
$lng = Cel::db()->proteger($lng.'%');
|
568 |
$sql = " AND (latitude LIKE $lat AND longitude LIKE $lng) ";
|
561 |
$sql = " AND (latitude LIKE $lat AND longitude LIKE $lng) ";
|
569 |
}
|
562 |
}
|
Line 577... |
Line 570... |
577 |
extract($this->decomposerParametreStation());
|
570 |
extract($this->decomposerParametreStation());
|
578 |
if (isset($type)) {
|
571 |
if (isset($type)) {
|
579 |
if ($type == self::MARQUEUR_COMMUNE) {
|
572 |
if ($type == self::MARQUEUR_COMMUNE) {
|
580 |
$lat = Cel::db()->proteger($lat);
|
573 |
$lat = Cel::db()->proteger($lat);
|
581 |
$lng = Cel::db()->proteger($lng);
|
574 |
$lng = Cel::db()->proteger($lng);
|
582 |
$sql = " AND wgs84_latitude LIKE $lat AND wgs84_longitude LIKE $lng ";
|
575 |
//$sql = " AND wgs84_latitude LIKE $lat AND wgs84_longitude LIKE $lng ";
|
583 |
} else if ($type == self::MARQUEUR_STATION) {
|
576 |
} else if ($type == self::MARQUEUR_STATION) {
|
584 |
$lat = Cel::db()->proteger($lat.'%');
|
577 |
$lat = Cel::db()->proteger($lat.'%');
|
585 |
$lng = Cel::db()->proteger($lng.'%');
|
578 |
$lng = Cel::db()->proteger($lng.'%');
|
586 |
$sql = " AND (latitude LIKE $lat AND longitude LIKE $lng) ";
|
579 |
$sql = " AND (latitude LIKE $lat AND longitude LIKE $lng) ";
|
587 |
}
|
580 |
}
|
Line 879... |
Line 872... |
879 |
$lngMin = $sw['lng'];
|
872 |
$lngMin = $sw['lng'];
|
Line 880... |
Line 873... |
880 |
|
873 |
|
881 |
$latMax = $ne['lat'];
|
874 |
$latMax = $ne['lat'];
|
Line 882... |
Line 875... |
882 |
$lngMax = $ne['lng'];
|
875 |
$lngMax = $ne['lng'];
|
883 |
|
876 |
|
884 |
$sql = "AND wgs84_longitude != 0 AND wgs84_latitude != 0 ".
|
877 |
/*$sql = "AND wgs84_longitude != 0 AND wgs84_latitude != 0 ".
|
885 |
" AND wgs84_latitude BETWEEN $latMin AND $latMax ".
|
878 |
" AND wgs84_latitude BETWEEN $latMin AND $latMax ".
|
886 |
" AND wgs84_longitude BETWEEN $lngMin AND $lngMax ";
|
879 |
" AND wgs84_longitude BETWEEN $lngMin AND $lngMax ";*/
|
887 |
}
|
880 |
}
|
Line 888... |
Line 881... |
888 |
return $sql;
|
881 |
return $sql;
|
Line 898... |
Line 891... |
898 |
$lngMin = $sw['lng'];
|
891 |
$lngMin = $sw['lng'];
|
Line 899... |
Line 892... |
899 |
|
892 |
|
900 |
$latMax = $ne['lat'];
|
893 |
$latMax = $ne['lat'];
|
Line 901... |
Line 894... |
901 |
$lngMax = $ne['lng'];
|
894 |
$lngMax = $ne['lng'];
|
902 |
|
895 |
|
903 |
$sql = "( wgs84_longitude != 0 AND wgs84_latitude != 0 ".
|
896 |
/*$sql = "( wgs84_longitude != 0 AND wgs84_latitude != 0 ".
|
Line 904... |
Line 897... |
904 |
" AND wgs84_latitude BETWEEN $latMin AND $latMax ".
|
897 |
" AND wgs84_latitude BETWEEN $latMin AND $latMax ".
|
905 |
" AND wgs84_longitude BETWEEN $lngMin AND $lngMax )";
|
898 |
" AND wgs84_longitude BETWEEN $lngMin AND $lngMax )";*/
|
906 |
|
899 |
|
907 |
/*$sql = " MBRWithin(point_commune, GeomFromText('POLYGON((".$latMin.' '.$lngMin.','.
|
900 |
/*$sql = " MBRWithin(point_commune, GeomFromText('POLYGON((".$latMin.' '.$lngMin.','.
|