Subversion Repositories eFlore/Applications.cel

Rev

Rev 3600 | Rev 3602 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3600 Rev 3601
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";
-
 
39
	
38
	/**
40
	/**
39
	 * Méthode appelée avec une requête de type GET.
41
	 * Méthode appelée avec une requête de type GET.
40
	 */
42
	 */
41
	public function getElement($ressources) {
43
	public function getElement($ressources) {
42
		$retour = null;
44
		$retour = null;
43
		if($this->parametres == null) {
45
		if($this->parametres == null) {
44
			$this->parametres = array();
46
			$this->parametres = array();
45
		}
47
		}
46
		extract($this->parametres);
48
		extract($this->parametres);
47
		//Chronometre::chrono("Avant groupage");
49
		//Chronometre::chrono("Avant groupage");
-
 
50
		if (isset($this->parametres['standard']) && $this->parametres['standard'] = 0) {
-
 
51
		    $this->standard = "";
-
 
52
		}
Line 48... Line 53...
48
 
53
 
49
		$action = array_shift($ressources);
54
		$action = array_shift($ressources);
50
		if (isset($action)) {
55
		if (isset($action)) {
51
			$methode = $this->traiterNomMethodeGet($action);
56
			$methode = $this->traiterNomMethodeGet($action);
Line 112... Line 117...
112
								$concatenation_id." as id_coord ".
117
								$concatenation_id." as id_coord ".
113
					'FROM cel_export_total AS co '.
118
					'FROM cel_export_total AS co '.
114
                    '   LEFT JOIN cel_zones_geo AS zg '.
119
                    '   LEFT JOIN cel_zones_geo AS zg '.
115
                    '       ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
120
                    '       ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
116
                    "WHERE transmission = '1' ".
121
                    "WHERE transmission = '1' ".
-
 
122
                    $this->standard.
117
					" AND (".
123
					" AND (".
118
					$this->construireWhereRectangleStationOR()." OR ".
124
					$this->construireWhereRectangleStationOR()." OR ".
119
					$this->construireWhereRectangleCommuneOR().") ".
125
					$this->construireWhereRectangleCommuneOR().") ".
120
					$this->construireWhereDept().
126
					$this->construireWhereDept().
121
                    $this->construireWhereCommune().
127
                    $this->construireWhereCommune().
Line 152... Line 158...
152
		$requete =  'SELECT COUNT(*) as nb '.
158
		$requete =  'SELECT COUNT(*) as nb '.
153
					'FROM cel_export_total AS co '.
159
					'FROM cel_export_total AS co '.
154
                    '   LEFT JOIN cel_zones_geo AS zg '.
160
                    '   LEFT JOIN cel_zones_geo AS zg '.
155
                    '       ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
161
                    '       ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
156
                    "WHERE transmission = '1' ".
162
                    "WHERE transmission = '1' ".
-
 
163
                    $this->standard.
157
					" AND (".
164
					" AND (".
158
					$this->construireWhereRectangleStationOR()." OR ".
165
					$this->construireWhereRectangleStationOR()." OR ".
159
					$this->construireWhereRectangleCommuneOR().") ".
166
					$this->construireWhereRectangleCommuneOR().") ".
160
					$this->construireWhereDept().
167
					$this->construireWhereDept().
161
                    $this->construireWhereCommune().
168
                    $this->construireWhereCommune().
Line 344... Line 351...
344
						'	utm_secteur, utm_x, utm_y, code, date_transmission, nom_referentiel '.
351
						'	utm_secteur, utm_x, utm_y, code, date_transmission, nom_referentiel '.
345
						'FROM cel_export_total AS co '.
352
						'FROM cel_export_total AS co '.
346
						'	LEFT JOIN cel_zones_geo AS zg '.
353
						'	LEFT JOIN cel_zones_geo AS zg '.
347
						"		ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) ".
354
						"		ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) ".
348
						"WHERE transmission = '1' ".
355
						"WHERE transmission = '1' ".
-
 
356
						$this->standard.
349
						(($this->communeEstDemandee()) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
357
						(($this->communeEstDemandee()) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
350
						$this->construireWhereDept().
358
						$this->construireWhereDept().
351
						$this->construireWherePays().
359
						$this->construireWherePays().
352
						$this->construireWhereUtilisateur().
360
						$this->construireWhereUtilisateur().
353
						$this->construireWhereNumTaxonAvecSousTaxons().
361
						$this->construireWhereNumTaxonAvecSousTaxons().
Line 492... Line 500...
492
		$requete = 	'SELECT SQL_CALC_FOUND_ROWS DISTINCT nom_ret, nom_ret_nn, nt, famille '.
500
		$requete = 	'SELECT SQL_CALC_FOUND_ROWS DISTINCT nom_ret, nom_ret_nn, nt, famille '.
493
					'FROM cel_export_total AS co '.
501
					'FROM cel_export_total AS co '.
494
					'	LEFT JOIN cel_zones_geo AS zg '.
502
					'	LEFT JOIN cel_zones_geo AS zg '.
495
					'		ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
503
					'		ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
496
					"WHERE transmission = '1' ".
504
					"WHERE transmission = '1' ".
-
 
505
					$this->standard.
497
					"	AND nom_ret != '' ".
506
					"	AND nom_ret != '' ".
498
					$this->construireWhereDept().
507
					$this->construireWhereDept().
499
                    $this->construireWhereCommune().
508
                    $this->construireWhereCommune().
500
                    $this->construireWherePays().
509
                    $this->construireWherePays().
501
                    $this->construireWhereUtilisateur().
510
                    $this->construireWhereUtilisateur().
Line 573... Line 582...
573
				$lat = Cel::db()->proteger($lat.'%');
582
				$lat = Cel::db()->proteger($lat.'%');
574
				$lng = Cel::db()->proteger($lng.'%');
583
				$lng = Cel::db()->proteger($lng.'%');
575
				$sql = " AND (latitude LIKE $lat AND longitude LIKE $lng) ";
584
				$sql = " AND (latitude LIKE $lat AND longitude LIKE $lng) ";
576
			}
585
			}
577
		}
586
		}
578
		$sql .= ' AND (mots_cles_texte IS NULL OR mots_cles_texte NOT LIKE "%sensible%" ) ';
587
		$sql .= ' AND (localite_floutage IS NULL OR localite_floutage = "précise" ) ';
579
		return $sql;
588
		return $sql;
580
	}
589
	}
Line 581... Line 590...
581
 
590
 
582
	private function construireWhereCommentaire() {
591
	private function construireWhereCommentaire() {
Line 752... Line 761...
752
		// Construction de la requête
761
		// Construction de la requête
753
		$requete = 	'SELECT DISTINCT co.id_obs, co.ce_utilisateur AS utilisateur '.
762
		$requete = 	'SELECT DISTINCT co.id_obs, co.ce_utilisateur AS utilisateur '.
754
			'FROM cel_export_total AS co '.
763
			'FROM cel_export_total AS co '.
755
			'	LEFT JOIN cel_zones_geo AS zg '.
764
			'	LEFT JOIN cel_zones_geo AS zg '.
756
			'		ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
765
			'		ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
757
			"WHERE co.transmission = '1' and co.images != null".
766
			"WHERE co.transmission = '1'  and co.images != null".
-
 
767
			$this->standard.
758
			($type == 'date.creation' ? " AND co.date_creation LIKE $param " : '').
768
			($type == 'date.creation' ? " AND co.date_creation LIKE $param " : '').
759
			($type == 'commentaire.obs' ? "	AND co.commentaire LIKE $param " : '').
769
			($type == 'commentaire.obs' ? "	AND co.commentaire LIKE $param " : '').
760
			($type == 'commentaire.*' ? " AND co.commentaire LIKE $param " : '').
770
			($type == 'commentaire.*' ? " AND co.commentaire LIKE $param " : '').
761
			$this->construireWhereCoordonnees().
771
			$this->construireWhereCoordonnees().
762
			$this->construireWhereDept().
772
			$this->construireWhereDept().
Line 1141... Line 1151...
1141
						'	INNER JOIN cel_obs AS co '.
1151
						'	INNER JOIN cel_obs AS co '.
1142
						'		ON (ci.ce_observation = co.id_observation) '.
1152
						'		ON (ci.ce_observation = co.id_observation) '.
1143
						'	LEFT JOIN cel_zones_geo AS zg '.
1153
						'	LEFT JOIN cel_zones_geo AS zg '.
1144
						"		ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) ".
1154
						"		ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) ".
1145
						"WHERE co.transmission = '1' ".
1155
						"WHERE co.transmission = '1' ".
-
 
1156
						$this->standard.
1146
						$this->construireWhereCoordonnees().
1157
						$this->construireWhereCoordonnees().
1147
						$this->construireWhereUtilisateur().
1158
						$this->construireWhereUtilisateur().
1148
						$this->construireWhereNumTaxon().
1159
						$this->construireWhereNumTaxon().
1149
						$this->construireWhereNomTaxon().
1160
						$this->construireWhereNomTaxon().
1150
						$this->construireWhereReferentiel().
1161
						$this->construireWhereReferentiel().