| Line 64... |
Line 64... |
| 64 |
* Les stations de la carte par défaut
|
64 |
* Les stations de la carte par défaut
|
| 65 |
*/
|
65 |
*/
|
| 66 |
public function getStations($params) {
|
66 |
public function getStations($params) {
|
| 67 |
$json = null;
|
67 |
$json = null;
|
| 68 |
$requete = 'SELECT utm_secteur, utm_x, utm_y, wgs84_latitude AS latitude, wgs84_longitude AS longitude '.
|
68 |
$requete = 'SELECT utm_secteur, utm_x, utm_y, wgs84_latitude AS latitude, wgs84_longitude AS longitude '.
|
| 69 |
'FROM cel_obs AS co '.
|
69 |
'FROM cel_export AS co '.
|
| 70 |
' RIGHT JOIN cel_zones_geo AS zg '. // exclut les obs non localisées sur zone geo, pour obtenir un décompte cohérent
|
70 |
' RIGHT JOIN cel_zones_geo AS zg '. // exclut les obs non localisées sur zone geo, pour obtenir un décompte cohérent
|
| 71 |
' ON (zg.id_zone_geo = co.ce_zone_geo) '.
|
71 |
' ON (zg.id_zone_geo = co.ce_zone_geo) '.
|
| 72 |
"WHERE transmission = '1' ".
|
72 |
"WHERE 1 ".
|
| 73 |
$this->construireWhereDept().
|
73 |
$this->construireWhereDept().
|
| 74 |
$this->construireWhereCommune().
|
74 |
$this->construireWhereCommune().
|
| 75 |
$this->construireWherePhotosSeulement().
|
75 |
$this->construireWherePhotosSeulement().
|
| 76 |
$this->construireWhereUtilisateur().
|
76 |
$this->construireWhereUtilisateur().
|
| 77 |
$this->construireWhereNumTaxon().
|
77 |
$this->construireWhereNumTaxon().
|
| Line 138... |
Line 138... |
| 138 |
if (!$this->etreNull($this->parametres['station'])) {
|
138 |
if (!$this->etreNull($this->parametres['station'])) {
|
| 139 |
$requete = 'SELECT SQL_CALC_FOUND_ROWS id_observation, ce_utilisateur, courriel_utilisateur, '.
|
139 |
$requete = 'SELECT SQL_CALC_FOUND_ROWS id_observation, ce_utilisateur, courriel_utilisateur, '.
|
| 140 |
' nom_sel, nom_ret, nom_sel_nn, nom_ret_nn, nt, famille, '.
|
140 |
' nom_sel, nom_ret, nom_sel_nn, nom_ret_nn, nt, famille, '.
|
| 141 |
' lieudit, zone_geo, date_observation, milieu, commentaire, '.
|
141 |
' lieudit, zone_geo, date_observation, milieu, commentaire, '.
|
| 142 |
' utm_secteur, utm_x, utm_y, id_zone_geo, date_transmission, nom_referentiel '.
|
142 |
' utm_secteur, utm_x, utm_y, id_zone_geo, date_transmission, nom_referentiel '.
|
| 143 |
'FROM cel_obs AS co '.
|
143 |
'FROM cel_export AS co '.
|
| 144 |
' LEFT JOIN cel_zones_geo AS zg '.
|
144 |
' LEFT JOIN cel_zones_geo AS zg '.
|
| 145 |
" ON (zg.id_zone_geo = co.ce_zone_geo) ".
|
145 |
" ON (zg.id_zone_geo = co.ce_zone_geo) ".
|
| 146 |
"WHERE transmission = '1' ".
|
146 |
"WHERE 1 ".
|
| 147 |
$this->construireWhereCoordonnees().
|
147 |
$this->construireWhereCoordonnees().
|
| 148 |
$this->construireWherePhotosSeulement().
|
148 |
$this->construireWherePhotosSeulement().
|
| 149 |
$this->construireWhereUtilisateur().
|
149 |
$this->construireWhereUtilisateur().
|
| 150 |
$this->construireWhereNumTaxon().
|
150 |
$this->construireWhereNumTaxon().
|
| 151 |
$this->construireWhereNomTaxon().
|
151 |
$this->construireWhereNomTaxon().
|
| Line 277... |
Line 277... |
| 277 |
*/
|
277 |
*/
|
| 278 |
public function getTaxons($params) {
|
278 |
public function getTaxons($params) {
|
| 279 |
$json = null;
|
279 |
$json = null;
|
| Line 280... |
Line 280... |
| 280 |
|
280 |
|
| 281 |
$requete = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT nom_ret, nom_ret_nn, nt, famille '.
|
281 |
$requete = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT nom_ret, nom_ret_nn, nt, famille '.
|
| 282 |
'FROM cel_obs AS co '.
|
282 |
'FROM cel_export AS co '.
|
| 283 |
' LEFT JOIN cel_zones_geo AS zg '.
|
283 |
' LEFT JOIN cel_zones_geo AS zg '.
|
| 284 |
' ON (zg.id_zone_geo = co.ce_zone_geo) '.
|
284 |
' ON (zg.id_zone_geo = co.ce_zone_geo) '.
|
| 285 |
"WHERE transmission = '1' ".
|
285 |
"WHERE ".
|
| 286 |
" AND nom_ret != '' ".
|
286 |
" nom_ret != '' ".
|
| 287 |
$this->construireWhereDept().
|
287 |
$this->construireWhereDept().
|
| 288 |
$this->construireWhereCommune().
|
288 |
$this->construireWhereCommune().
|
| 289 |
$this->construireWherePhotosSeulement().
|
289 |
$this->construireWherePhotosSeulement().
|
| 290 |
$this->construireWhereUtilisateur().
|
290 |
$this->construireWhereUtilisateur().
|
| Line 508... |
Line 508... |
| 508 |
* Retour sous forme de tableau : array[identifiant] = array(ordre, ordre...);
|
508 |
* Retour sous forme de tableau : array[identifiant] = array(ordre, ordre...);
|
| 509 |
*/
|
509 |
*/
|
| 510 |
private function obtenirObsLieesImg($type, $param) {
|
510 |
private function obtenirObsLieesImg($type, $param) {
|
| 511 |
// Construction de la requête
|
511 |
// Construction de la requête
|
| 512 |
$requete = 'SELECT DISTINCT id_observation AS id_obs, co.ce_utilisateur AS utilisateur '.
|
512 |
$requete = 'SELECT DISTINCT id_observation AS id_obs, co.ce_utilisateur AS utilisateur '.
|
| 513 |
'FROM cel_images AS ci'.
|
513 |
'FROM cel_images_export AS ci'.
|
| 514 |
' INNER JOIN cel_obs AS co '.
|
514 |
' INNER JOIN cel_export AS co '.
|
| 515 |
' ON ci.ce_observation = co.id_observation '.
|
515 |
' ON ci.ce_observation = co.id_observation '.
|
| 516 |
' LEFT JOIN cel_zones_geo AS zg '.
|
516 |
' LEFT JOIN cel_zones_geo AS zg '.
|
| 517 |
' ON (zg.id_zone_geo = co.ce_zone_geo) '.
|
517 |
' ON (zg.id_zone_geo = co.ce_zone_geo) '.
|
| 518 |
"WHERE co.transmission = '1' ".
|
518 |
"WHERE '' ".
|
| 519 |
($type == 'date.photo' ? " AND (date_prise_de_vue LIKE ".str_replace('-', ':', $param).") " : '').
|
519 |
($type == 'date.photo' ? " AND (date_prise_de_vue LIKE ".str_replace('-', ':', $param).") " : '').
|
| 520 |
($type == 'date.ajout' ? " AND ci.date_creation LIKE $param " : '').
|
520 |
($type == 'date.ajout' ? " AND ci.date_creation LIKE $param " : '').
|
| 521 |
($type == 'date.liaison' ? " AND ci.date_liaison LIKE $param " : '').
|
521 |
($type == 'date.liaison' ? " AND ci.date_liaison LIKE $param " : '').
|
| 522 |
// TODO: recherche sur le xml
|
522 |
// TODO: recherche sur le xml
|
| 523 |
//($type == 'commentaire.meta' ? " AND ci.commentaire LIKE $param " : '').
|
523 |
//($type == 'commentaire.meta' ? " AND ci.commentaire LIKE $param " : '').
|
| Line 599... |
Line 599... |
| 599 |
}
|
599 |
}
|
| Line 600... |
Line 600... |
| 600 |
|
600 |
|
| 601 |
private function construireWherePhotosSeulement() {
|
601 |
private function construireWherePhotosSeulement() {
|
| 602 |
$sql = '';
|
602 |
$sql = '';
|
| 603 |
if (isset($this->parametres['photos']) && $this->parametres['photos'] == 1) {
|
603 |
if (isset($this->parametres['photos']) && $this->parametres['photos'] == 1) {
|
| 604 |
$sql = 'AND co.id_observation IN (SELECT DISTINCT ce_observation FROM cel_images) ';
|
604 |
$sql = 'AND co.id_observation IN (SELECT DISTINCT ce_observation FROM cel_images_export) ';
|
| 605 |
}
|
605 |
}
|
| 606 |
return $sql;
|
606 |
return $sql;
|
| Line 668... |
Line 668... |
| 668 |
$sql = null;
|
668 |
$sql = null;
|
| 669 |
if (isset($tag) && !$this->etreNull($tag)) {
|
669 |
if (isset($tag) && !$this->etreNull($tag)) {
|
| 670 |
$tag_sql = $this->getSqlWhereMotsCles($tag);
|
670 |
$tag_sql = $this->getSqlWhereMotsCles($tag);
|
| 671 |
// Construction de la requête
|
671 |
// Construction de la requête
|
| 672 |
$requete = 'SELECT DISTINCT co.id_observation AS id_obs, ci.ce_utilisateur AS utilisateur '.
|
672 |
$requete = 'SELECT DISTINCT co.id_observation AS id_obs, ci.ce_utilisateur AS utilisateur '.
|
| 673 |
'FROM cel_images AS ci '.
|
673 |
'FROM cel_images_export AS ci '.
|
| 674 |
' INNER JOIN cel_obs AS co '.
|
674 |
' INNER JOIN cel_export AS co '.
|
| 675 |
' ON (ci.ce_observation = co.id_observation) '.
|
675 |
' ON (ci.ce_observation = co.id_observation) '.
|
| 676 |
' LEFT JOIN cel_zones_geo AS zg '.
|
676 |
' LEFT JOIN cel_zones_geo AS zg '.
|
| 677 |
" ON (zg.id_zone_geo = co.ce_zone_geo) ".
|
677 |
" ON (zg.id_zone_geo = co.ce_zone_geo) ".
|
| 678 |
"WHERE co.transmission = '1' ".
|
678 |
"WHERE 1 ".
|
| 679 |
$this->construireWhereCoordonnees().
|
679 |
$this->construireWhereCoordonnees().
|
| 680 |
$this->construireWhereUtilisateur().
|
680 |
$this->construireWhereUtilisateur().
|
| 681 |
$this->construireWhereNumTaxon().
|
681 |
$this->construireWhereNumTaxon().
|
| 682 |
$this->construireWhereNomTaxon().
|
682 |
$this->construireWhereNomTaxon().
|
| 683 |
$this->construireWhereProjet().
|
683 |
$this->construireWhereProjet().
|