Line 33... |
Line 33... |
33 |
// TODO : supprimer le TRIM quand les obs seront reliées correctements aux localisations (sur le code INSEE par exemple)
|
33 |
// TODO : supprimer le TRIM quand les obs seront reliées correctements aux localisations (sur le code INSEE par exemple)
|
34 |
class CelWidgetMapPoint extends Cel {
|
34 |
class CelWidgetMapPoint extends Cel {
|
35 |
const MARQUEUR_GROUPE = 'GROUPE';
|
35 |
const MARQUEUR_GROUPE = 'GROUPE';
|
36 |
const MARQUEUR_COMMUNE = 'COMMUNE';
|
36 |
const MARQUEUR_COMMUNE = 'COMMUNE';
|
37 |
const MARQUEUR_STATION = 'STATION';
|
37 |
const MARQUEUR_STATION = 'STATION';
|
38 |
private $standard = "AND donnees_standard = 1";
|
38 |
private $standard = "1";
|
- |
|
39 |
private $table_export = "cel_export";
|
Line 39... |
Line 40... |
39 |
|
40 |
|
40 |
/**
|
41 |
/**
|
41 |
* Méthode appelée avec une requête de type GET.
|
42 |
* Méthode appelée avec une requête de type GET.
|
42 |
*/
|
43 |
*/
|
Line 46... |
Line 47... |
46 |
$this->parametres = array();
|
47 |
$this->parametres = array();
|
47 |
}
|
48 |
}
|
48 |
extract($this->parametres);
|
49 |
extract($this->parametres);
|
49 |
//Chronometre::chrono("Avant groupage");
|
50 |
//Chronometre::chrono("Avant groupage");
|
50 |
if (isset($this->parametres['standard']) && $this->parametres['standard'] == 0) {
|
51 |
if (isset($this->parametres['standard']) && $this->parametres['standard'] == 0) {
|
51 |
$this->standard = "";
|
52 |
$this->standard = "0";
|
- |
|
53 |
$this->table_export = "cel_export_total";
|
- |
|
54 |
|
52 |
}
|
55 |
}
|
Line 53... |
Line 56... |
53 |
|
56 |
|
54 |
$action = array_shift($ressources);
|
57 |
$action = array_shift($ressources);
|
55 |
if (isset($action)) {
|
58 |
if (isset($action)) {
|
Line 104... |
Line 107... |
104 |
}
|
107 |
}
|
Line 105... |
Line 108... |
105 |
|
108 |
|
Line 106... |
Line 109... |
106 |
public function getTout($params) {
|
109 |
public function getTout($params) {
|
107 |
|
110 |
|
108 |
$emplacements = null;
|
- |
|
- |
|
111 |
$emplacements = null;
|
109 |
$concatenation_id = "CONCAT(IFNULL(latitude,''),IFNULL(longitude,''), IFNULL(wgs84_latitude,''),IFNULL(wgs84_longitude,'')) ";
|
112 |
$concatenation_id = "CONCAT(IFNULL(latitude,''),IFNULL(longitude,'')) ";
|
110 |
|
113 |
$transmission = ( $this->standard == 0) ? "transmission = '1' AND " : "";
|
111 |
$requete = 'SELECT ce_zone_geo, zone_geo, station, '.
|
114 |
$requete = 'SELECT distinct ce_zone_geo, zone_geo, NULL as station, '.
|
112 |
"mots_cles_texte, ".
|
115 |
"NULL as mots_cles_texte, ".
|
113 |
"latitude, ".
|
116 |
"latitude, ".
|
114 |
"wgs84_latitude, ".
|
117 |
"NULL as wgs84_latitude, ".
|
115 |
"longitude, ".
|
118 |
"longitude, ".
|
116 |
"wgs84_longitude, ".
|
- |
|
117 |
$concatenation_id." as id_coord ".
|
119 |
"NULL as wgs84_longitude, ".
|
118 |
'FROM cel_export_total AS co '.
|
- |
|
- |
|
120 |
$concatenation_id." as id_coord ".
|
119 |
' LEFT JOIN cel_zones_geo AS zg '.
|
121 |
'FROM '.$this->table_export.' AS co '.
|
120 |
' ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
|
- |
|
121 |
"WHERE transmission = '1' ".
|
122 |
|
122 |
$this->standard.
|
123 |
"WHERE ".$transmission.
|
123 |
" AND (".
|
124 |
" (".
|
124 |
$this->construireWhereRectangleStationOR()." OR ".
|
125 |
$this->construireWhereRectangleStationOR()." ".
|
125 |
$this->construireWhereRectangleCommuneOR().") ".
|
126 |
$this->construireWhereRectangleCommuneOR().") ".
|
126 |
$this->construireWhereDept().
|
127 |
$this->construireWhereDept().
|
127 |
$this->construireWhereCommune().
|
128 |
$this->construireWhereCommune().
|
Line 135... |
Line 136... |
135 |
$this->construireWherePhotosSeulement().
|
136 |
$this->construireWherePhotosSeulement().
|
136 |
$this->construireWhereProjet().
|
137 |
$this->construireWhereProjet().
|
137 |
$this->construireWhereTag().
|
138 |
$this->construireWhereTag().
|
138 |
$this->construireWhereNombreDeJours().
|
139 |
$this->construireWhereNombreDeJours().
|
139 |
$this->construireWhereAnnee().
|
140 |
$this->construireWhereAnnee().
|
140 |
$this->construireWhereGroupeZoneGeo().
|
141 |
$this->construireWhereGroupeZoneGeo();
|
141 |
' GROUP BY id_coord';
|
- |
|
Line 142... |
Line 142... |
142 |
|
142 |
|
143 |
$resultats_emplacements = Cel::db()->requeter($requete);
|
143 |
$resultats_emplacements = Cel::db()->requeter($requete);
|
144 |
$emplacements = $this->traiterEmplacements($resultats_emplacements, $this->compterObservations($params));
|
144 |
$emplacements = $this->traiterEmplacements($resultats_emplacements, $this->compterObservations($params));
|
145 |
return $emplacements;
|
145 |
return $emplacements;
|
Line 153... |
Line 153... |
153 |
}
|
153 |
}
|
Line 154... |
Line 154... |
154 |
|
154 |
|
Line 155... |
Line 155... |
155 |
private $nb_obs = 0;
|
155 |
private $nb_obs = 0;
|
- |
|
156 |
|
156 |
|
157 |
private function compterObservations($params) {
|
157 |
private function compterObservations($params) {
|
- |
|
158 |
$requete = 'SELECT COUNT(*) as nb '.
|
158 |
$transmission = ( $this->standard == 0) ? "transmission = '1' AND " : "";
|
159 |
'FROM cel_export_total AS co '.
|
- |
|
160 |
' LEFT JOIN cel_zones_geo AS zg '.
|
159 |
$requete = 'SELECT COUNT(*) as nb '.
|
161 |
' ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
|
- |
|
162 |
"WHERE transmission = '1' ".
|
160 |
'FROM '.$this->table_export.' AS co '.
|
163 |
$this->standard.
|
161 |
"WHERE ".$transmission.
|
164 |
" AND (".
|
162 |
" (".
|
165 |
$this->construireWhereRectangleStationOR()." OR ".
|
163 |
$this->construireWhereRectangleStationOR()." OR ".
|
166 |
$this->construireWhereRectangleCommuneOR().") ".
|
164 |
$this->construireWhereRectangleCommuneOR().") ".
|
167 |
$this->construireWhereDept().
|
165 |
$this->construireWhereDept().
|
Line 342... |
Line 340... |
342 |
* Données pour l'affichage des obs d'une station
|
340 |
* Données pour l'affichage des obs d'une station
|
343 |
*/
|
341 |
*/
|
344 |
public function getObservations($params) {
|
342 |
public function getObservations($params) {
|
345 |
$resultats = array();
|
343 |
$resultats = array();
|
346 |
$total = 0;
|
344 |
$total = 0;
|
- |
|
345 |
$transmission = ( $this->standard == 0) ? "transmission = '1' " : " 1 ";
|
- |
|
346 |
|
347 |
if (isset($this->parametres['station']) && !$this->etreNull($this->parametres['station'])) {
|
347 |
if (isset($this->parametres['station']) && !$this->etreNull($this->parametres['station'])) {
|
348 |
$requete = 'SELECT SQL_CALC_FOUND_ROWS id_observation, ce_utilisateur, courriel_utilisateur, pseudo_utilisateur as nom_utilisateur, "" as prenom_utilisateur, '.
|
348 |
$requete = 'SELECT SQL_CALC_FOUND_ROWS id_observation, ce_utilisateur, courriel_utilisateur, pseudo_utilisateur as nom_utilisateur, "" as prenom_utilisateur, '.
|
349 |
' nom_sel, nom_ret, nom_sel_nn, nom_ret_nn, "" as nt, famille, '.
|
349 |
' nom_sel, nom_ret, nom_sel_nn, nom_ret_nn, "" as nt, famille, '.
|
350 |
' lieudit, zone_geo, date_observation, milieu, commentaire, '.
|
350 |
' lieudit, zone_geo, date_observation, milieu, commentaire, '.
|
351 |
' utm_secteur, utm_x, utm_y, code, date_transmission, nom_referentiel '.
|
351 |
' null as utm_secteur, null as utm_x, null as utm_y, ce_zone_geo as code, date_transmission, nom_referentiel '.
|
352 |
'FROM cel_export_total AS co '.
|
352 |
'FROM '.$this->table_export.' AS co '.
|
353 |
' LEFT JOIN cel_zones_geo AS zg '.
|
- |
|
354 |
" ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) ".
|
- |
|
355 |
"WHERE transmission = '1' ".
|
353 |
"WHERE ".$transmission.
|
356 |
$this->standard.
|
- |
|
357 |
(($this->communeEstDemandee()) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
|
354 |
(($this->communeEstDemandee()) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
|
358 |
$this->construireWhereDept().
|
355 |
$this->construireWhereDept().
|
359 |
$this->construireWherePays().
|
356 |
$this->construireWherePays().
|
360 |
$this->construireWhereUtilisateur().
|
357 |
$this->construireWhereUtilisateur().
|
361 |
$this->construireWhereNumTaxonAvecSousTaxons().
|
358 |
$this->construireWhereNumTaxonAvecSousTaxons().
|
Line 494... |
Line 491... |
494 |
/**
|
491 |
/**
|
495 |
* Liste des taxons présents sur la carte
|
492 |
* Liste des taxons présents sur la carte
|
496 |
*/
|
493 |
*/
|
497 |
public function getTaxons($params) {
|
494 |
public function getTaxons($params) {
|
498 |
$json = null;
|
495 |
$json = null;
|
499 |
|
- |
|
- |
|
496 |
$transmission = ( $this->standard == 0) ? "transmission = '1' AND " : "";
|
500 |
$requete = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT nom_ret, nom_ret_nn, nt, famille '.
|
497 |
$requete = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT nom_ret, nom_ret_nn, nt, famille '.
|
501 |
'FROM cel_export_total AS co '.
|
498 |
'FROM '.$this->table_export.' AS co '.
|
502 |
' LEFT JOIN cel_zones_geo AS zg '.
|
- |
|
503 |
' ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
|
- |
|
504 |
"WHERE transmission = '1' ".
|
499 |
"WHERE ".$transmission.
|
505 |
$this->standard.
|
- |
|
506 |
" AND nom_ret != '' ".
|
500 |
" nom_ret != '' ".
|
507 |
$this->construireWhereDept().
|
501 |
$this->construireWhereDept().
|
508 |
$this->construireWhereCommune().
|
502 |
$this->construireWhereCommune().
|
509 |
$this->construireWherePays().
|
503 |
$this->construireWherePays().
|
510 |
$this->construireWhereUtilisateur().
|
504 |
$this->construireWhereUtilisateur().
|
511 |
$this->construireWhereNumTaxon().
|
505 |
$this->construireWhereNumTaxon().
|
Line 557... |
Line 551... |
557 |
extract($this->decomposerParametreStation());
|
551 |
extract($this->decomposerParametreStation());
|
558 |
if (isset($type)) {
|
552 |
if (isset($type)) {
|
559 |
if ($type == self::MARQUEUR_COMMUNE) {
|
553 |
if ($type == self::MARQUEUR_COMMUNE) {
|
560 |
$lat = Cel::db()->proteger($lat.'%');
|
554 |
$lat = Cel::db()->proteger($lat.'%');
|
561 |
$lng = Cel::db()->proteger($lng.'%');
|
555 |
$lng = Cel::db()->proteger($lng.'%');
|
562 |
$sql = " AND wgs84_latitude LIKE $lat AND wgs84_longitude LIKE $lng ";
|
556 |
//$sql = " AND wgs84_latitude LIKE $lat AND wgs84_longitude LIKE $lng ";
|
563 |
} else if ($type == self::MARQUEUR_STATION) {
|
557 |
} else if ($type == self::MARQUEUR_STATION) {
|
564 |
$lat = Cel::db()->proteger($lat.'%');
|
558 |
$lat = Cel::db()->proteger($lat.'%');
|
565 |
$lng = Cel::db()->proteger($lng.'%');
|
559 |
$lng = Cel::db()->proteger($lng.'%');
|
566 |
$sql = " AND (latitude LIKE $lat AND longitude LIKE $lng) ";
|
560 |
$sql = " AND (latitude LIKE $lat AND longitude LIKE $lng) ";
|
567 |
}
|
561 |
}
|
Line 575... |
Line 569... |
575 |
extract($this->decomposerParametreStation());
|
569 |
extract($this->decomposerParametreStation());
|
576 |
if (isset($type)) {
|
570 |
if (isset($type)) {
|
577 |
if ($type == self::MARQUEUR_COMMUNE) {
|
571 |
if ($type == self::MARQUEUR_COMMUNE) {
|
578 |
$lat = Cel::db()->proteger($lat);
|
572 |
$lat = Cel::db()->proteger($lat);
|
579 |
$lng = Cel::db()->proteger($lng);
|
573 |
$lng = Cel::db()->proteger($lng);
|
580 |
$sql = " AND wgs84_latitude LIKE $lat AND wgs84_longitude LIKE $lng ";
|
574 |
//$sql = " AND wgs84_latitude LIKE $lat AND wgs84_longitude LIKE $lng ";
|
581 |
} else if ($type == self::MARQUEUR_STATION) {
|
575 |
} else if ($type == self::MARQUEUR_STATION) {
|
582 |
$lat = Cel::db()->proteger($lat.'%');
|
576 |
$lat = Cel::db()->proteger($lat.'%');
|
583 |
$lng = Cel::db()->proteger($lng.'%');
|
577 |
$lng = Cel::db()->proteger($lng.'%');
|
584 |
$sql = " AND (latitude LIKE $lat AND longitude LIKE $lng) ";
|
578 |
$sql = " AND (latitude LIKE $lat AND longitude LIKE $lng) ";
|
585 |
}
|
579 |
}
|
Line 645... |
Line 639... |
645 |
|
639 |
|
646 |
private function construireWhereReferentiel() {
|
640 |
private function construireWhereReferentiel() {
|
647 |
$sql = '';
|
641 |
$sql = '';
|
648 |
extract($this->parametres);
|
642 |
extract($this->parametres);
|
649 |
if (isset($referentiel) && !$this->etreNull($referentiel)) {
|
643 |
if (isset($referentiel) && !$this->etreNull($referentiel)) {
|
650 |
$referentiel = Cel::db()->proteger($referentiel.'%');
|
644 |
$referentiel = Cel::db()->proteger($referentiel);
|
651 |
$sql = ' AND co.nom_referentiel LIKE '.$referentiel.' ';
|
645 |
$sql = ' AND co.nom_referentiel = '.$referentiel.' ';
|
652 |
}
|
646 |
}
|
653 |
return $sql;
|
647 |
return $sql;
|
Line 654... |
Line 648... |
654 |
}
|
648 |
}
|
Line 756... |
Line 750... |
756 |
/**
|
750 |
/**
|
757 |
* Récupération des identifiant d'utilisateur et des ordres des observations correspondant à une date.
|
751 |
* Récupération des identifiant d'utilisateur et des ordres des observations correspondant à une date.
|
758 |
* Retour sous forme de tableau : array[identifiant] = array(ordre, ordre...);
|
752 |
* Retour sous forme de tableau : array[identifiant] = array(ordre, ordre...);
|
759 |
*/
|
753 |
*/
|
760 |
private function obtenirObsLieesImg($type, $param) {
|
754 |
private function obtenirObsLieesImg($type, $param) {
|
- |
|
755 |
$transmission = ( $this->standard == 0) ? "transmission = '1' AND " : "";
|
761 |
// Construction de la requête
|
756 |
// Construction de la requête
|
762 |
$requete = 'SELECT DISTINCT co.id_obs, co.ce_utilisateur AS utilisateur '.
|
757 |
$requete = 'SELECT DISTINCT co.id_obs, co.ce_utilisateur AS utilisateur '.
|
763 |
'FROM cel_export_total AS co '.
|
758 |
'FROM '.$this->table_export.' AS co '.
|
764 |
' LEFT JOIN cel_zones_geo AS zg '.
|
759 |
' LEFT JOIN cel_zones_geo AS zg '.
|
765 |
' ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
|
760 |
' ON (zg.nom = co.zone_geo AND zg.code = co.ce_zone_geo) '.
|
766 |
"WHERE co.transmission = '1' and co.images != null".
|
761 |
"WHERE ".$transmission." co.images != null".
|
767 |
$this->standard.
|
- |
|
768 |
($type == 'date.creation' ? " AND co.date_creation LIKE $param " : '').
|
762 |
($type == 'date.creation' ? " AND co.date_creation LIKE $param " : '').
|
769 |
($type == 'commentaire.obs' ? " AND co.commentaire LIKE $param " : '').
|
763 |
($type == 'commentaire.obs' ? " AND co.commentaire LIKE $param " : '').
|
770 |
($type == 'commentaire.*' ? " AND co.commentaire LIKE $param " : '').
|
764 |
($type == 'commentaire.*' ? " AND co.commentaire LIKE $param " : '').
|
771 |
$this->construireWhereCoordonnees().
|
765 |
$this->construireWhereCoordonnees().
|
772 |
$this->construireWhereDept().
|
766 |
$this->construireWhereDept().
|
Line 777... |
Line 771... |
777 |
$this->construireWhereNomTaxon().
|
771 |
$this->construireWhereNomTaxon().
|
778 |
$this->construireWhereReferentiel().
|
772 |
$this->construireWhereReferentiel().
|
779 |
$this->construireWhereProjet().
|
773 |
$this->construireWhereProjet().
|
780 |
$this->construireWhereTag().
|
774 |
$this->construireWhereTag().
|
781 |
$this->construireWhereGroupeZoneGeo().
|
775 |
$this->construireWhereGroupeZoneGeo().
|
782 |
'ORDER BY utilisateur ASC, ordre ASC';
|
776 |
'ORDER BY utilisateur ASC';
|
783 |
//$this->debug[] = $requete;
|
777 |
//$this->debug[] = $requete;
|
784 |
//die($requete);
|
778 |
//die($requete);
|
785 |
$resultats = Cel::db()->requeter($requete);
|
779 |
$resultats = Cel::db()->requeter($requete);
|
Line 786... |
Line 780... |
786 |
|
780 |
|
787 |
$observations = null;
|
781 |
$observations = null;
|
788 |
if ($resultats != false) {
|
782 |
if ($resultats != false) {
|
789 |
$observations = array();
|
783 |
$observations = array();
|
790 |
foreach ($resultats as $occurence) {
|
784 |
foreach ($resultats as $occurence) {
|
791 |
$utilisateur = $occurence['utilisateur'];
|
785 |
$utilisateur = $occurence['utilisateur'];
|
792 |
$ordre = $occurence['ordre'];
|
786 |
$ordre = $occurence['id_obs'];
|
793 |
if (!array_key_exists($utilisateur, $observations)) {
|
787 |
if (!array_key_exists($utilisateur, $observations)) {
|
794 |
$observations[$utilisateur] = array();
|
788 |
$observations[$utilisateur] = array();
|
795 |
}
|
789 |
}
|
796 |
if (!array_key_exists($ordre, $observations[$utilisateur])) {
|
790 |
if (!array_key_exists($ordre, $observations[$utilisateur])) {
|
Line 877... |
Line 871... |
877 |
$lngMin = $sw['lng'];
|
871 |
$lngMin = $sw['lng'];
|
Line 878... |
Line 872... |
878 |
|
872 |
|
879 |
$latMax = $ne['lat'];
|
873 |
$latMax = $ne['lat'];
|
Line 880... |
Line 874... |
880 |
$lngMax = $ne['lng'];
|
874 |
$lngMax = $ne['lng'];
|
881 |
|
875 |
|
882 |
$sql = "AND wgs84_longitude != 0 AND wgs84_latitude != 0 ".
|
876 |
/*$sql = "AND wgs84_longitude != 0 AND wgs84_latitude != 0 ".
|
883 |
" AND wgs84_latitude BETWEEN $latMin AND $latMax ".
|
877 |
" AND wgs84_latitude BETWEEN $latMin AND $latMax ".
|
884 |
" AND wgs84_longitude BETWEEN $lngMin AND $lngMax ";
|
878 |
" AND wgs84_longitude BETWEEN $lngMin AND $lngMax ";*/
|
885 |
}
|
879 |
}
|
Line 886... |
Line 880... |
886 |
return $sql;
|
880 |
return $sql;
|
Line 896... |
Line 890... |
896 |
$lngMin = $sw['lng'];
|
890 |
$lngMin = $sw['lng'];
|
Line 897... |
Line 891... |
897 |
|
891 |
|
898 |
$latMax = $ne['lat'];
|
892 |
$latMax = $ne['lat'];
|
Line 899... |
Line 893... |
899 |
$lngMax = $ne['lng'];
|
893 |
$lngMax = $ne['lng'];
|
900 |
|
894 |
|
901 |
$sql = "( wgs84_longitude != 0 AND wgs84_latitude != 0 ".
|
895 |
/*$sql = "( wgs84_longitude != 0 AND wgs84_latitude != 0 ".
|
Line 902... |
Line 896... |
902 |
" AND wgs84_latitude BETWEEN $latMin AND $latMax ".
|
896 |
" AND wgs84_latitude BETWEEN $latMin AND $latMax ".
|
903 |
" AND wgs84_longitude BETWEEN $lngMin AND $lngMax )";
|
897 |
" AND wgs84_longitude BETWEEN $lngMin AND $lngMax )";*/
|
904 |
|
898 |
|
905 |
/*$sql = " MBRWithin(point_commune, GeomFromText('POLYGON((".$latMin.' '.$lngMin.','.
|
899 |
/*$sql = " MBRWithin(point_commune, GeomFromText('POLYGON((".$latMin.' '.$lngMin.','.
|
Line 977... |
Line 971... |
977 |
|
971 |
|
978 |
|
972 |
|
979 |
private function construireWherePhotosSeulement() {
|
973 |
private function construireWherePhotosSeulement() {
|
980 |
$sql = '';
|
974 |
$sql = '';
|
981 |
if (isset($this->parametres['photos']) && $this->parametres['photos'] == 1) {
|
975 |
if (isset($this->parametres['photos']) && $this->parametres['photos'] == 1) {
|
982 |
$sql = 'AND co.id_observation IN (SELECT DISTINCT ce_observation FROM cel_images_export) ';
|
976 |
$sql = ' AND co.images is not null ';
|
983 |
}
|
977 |
}
|
Line 984... |
Line 978... |
984 |
return $sql;
|
978 |
return $sql;
|
Line 1019... |
Line 1013... |
1019 |
if (isset($this->parametres['num_nom_ret']) && !$this->etreNull($num_nom_ret)) {
|
1013 |
if (isset($this->parametres['num_nom_ret']) && !$this->etreNull($num_nom_ret)) {
|
1020 |
$sous_taxons = $this->obtenirSousTaxons($this->parametres['num_nom_ret']);
|
1014 |
$sous_taxons = $this->obtenirSousTaxons($this->parametres['num_nom_ret']);
|
1021 |
$num_nom_retenu = Cel::db()->proteger($num_nom_ret);
|
1015 |
$num_nom_retenu = Cel::db()->proteger($num_nom_ret);
|
1022 |
if(!empty($sous_taxons)) {
|
1016 |
if(!empty($sous_taxons)) {
|
1023 |
$sql_in_sous_tax = implode(',', $sous_taxons);
|
1017 |
$sql_in_sous_tax = implode(',', $sous_taxons);
|
1024 |
$sql = " AND (nom_sel_nn IN (".$sql_in_sous_tax.") OR ".
|
1018 |
$sql = " AND (nom_sel_nn IN (".$num_nom_retenu.', '.$sql_in_sous_tax.") OR ".
|
1025 |
"nom_ret_nn IN (".$sql_in_sous_tax.") ".
|
1019 |
"nom_ret_nn IN (".$num_nom_retenu.', '.$sql_in_sous_tax.") ".
|
1026 |
") ";
|
1020 |
") ";
|
1027 |
}
|
1021 |
}
|
1028 |
else {
|
1022 |
else {
|
1029 |
$sql = " AND nom_ret_nn = $num_nom_ret ";
|
1023 |
$sql = " AND nom_ret_nn = $num_nom_ret ";
|
1030 |
}
|
1024 |
}
|
Line 1141... |
Line 1135... |
1141 |
/**
|
1135 |
/**
|
1142 |
* Traitement de $tag pour construction du filtre dans la requête
|
1136 |
* Traitement de $tag pour construction du filtre dans la requête
|
1143 |
*/
|
1137 |
*/
|
1144 |
private function getSqlWhereObsAvecImagesTaguees($tag) {
|
1138 |
private function getSqlWhereObsAvecImagesTaguees($tag) {
|
1145 |
$sql = null;
|
1139 |
$sql = null;
|
- |
|
1140 |
$transmission = ( $this->standard == 0) ? "co.transmission = '1' " : " 1 ";
|
1146 |
if (isset($tag) && !$this->etreNull($tag)) {
|
1141 |
if (isset($tag) && !$this->etreNull($tag)) {
|
1147 |
$tag_sql = $this->getSqlWhereMotsCles($tag);
|
1142 |
$tag_sql = $this->getSqlWhereMotsCles($tag);
|
1148 |
// Construction de la requête
|
1143 |
// Construction de la requête
|
1149 |
$requete = 'SELECT DISTINCT co.id_observation AS id_obs, co.ce_utilisateur AS utilisateur '.
|
1144 |
$requete = 'SELECT DISTINCT co.id_observation AS id_obs, co.ce_utilisateur AS utilisateur '.
|
1150 |
'FROM cel_images_export ci'.
|
1145 |
'FROM cel_images_export ci'.
|
1151 |
' INNER JOIN cel_export_total AS co '.
|
1146 |
' INNER JOIN '.$this->table_export.' AS co '.
|
1152 |
' ON (ci.ce_observation = co.id_observation) '.
|
1147 |
' ON (ci.ce_observation = co.id_observation) '.
|
1153 |
' LEFT JOIN cel_zones_geo AS zg '.
|
1148 |
' LEFT JOIN cel_zones_geo AS zg '.
|
1154 |
" ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) ".
|
1149 |
" ON (zg.nom = co.zone_geo AND zg.code = co.ce_zone_geo) ".
|
1155 |
"WHERE co.transmission = '1' ".
|
1150 |
"WHERE ".$transmission.
|
1156 |
$this->standard.
|
- |
|
1157 |
$this->construireWhereCoordonnees().
|
1151 |
$this->construireWhereCoordonnees().
|
1158 |
$this->construireWhereUtilisateur().
|
1152 |
$this->construireWhereUtilisateur().
|
1159 |
$this->construireWhereNumTaxon().
|
1153 |
$this->construireWhereNumTaxon().
|
1160 |
$this->construireWhereNomTaxon().
|
1154 |
$this->construireWhereNomTaxon().
|
1161 |
$this->construireWhereReferentiel().
|
1155 |
$this->construireWhereReferentiel().
|
1162 |
$this->construireWhereProjet().
|
1156 |
$this->construireWhereProjet().
|
1163 |
(!$this->etreNull($tag_sql) ? "AND ($tag_sql) " : '').
|
1157 |
(!$this->etreNull($tag_sql) ? "AND ($tag_sql) " : '').
|
1164 |
'ORDER BY utilisateur ASC, ci.ordre ASC';
|
1158 |
'ORDER BY utilisateur ASC';
|
1165 |
//$this->debug[] = $requete;
|
1159 |
//$this->debug[] = $requete;
|
1166 |
//die($requete);
|
1160 |
//die($requete);
|
1167 |
$elements_tag = Cel::db()->requeter($requete);
|
1161 |
$elements_tag = Cel::db()->requeter($requete);
|
Line 1168... |
Line 1162... |
1168 |
|
1162 |
|