Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1484 Rev 1497
Line 87... Line 87...
87
		imagesavealpha($img, true);
87
		imagesavealpha($img, true);
Line 88... Line 88...
88
 
88
 
89
		return array('type' => 'png', 'img' => $img);
89
		return array('type' => 'png', 'img' => $img);
Line 90... Line -...
90
	}
-
 
91
 
-
 
92
	/**
-
 
93
	 * Les stations de la carte par défaut
-
 
94
	 */
-
 
95
	public function getStations($params) {
-
 
96
		$stations = null;
-
 
97
		$requete =  'SELECT wgs84_latitude AS lat, wgs84_longitude AS lng, location AS nom '.
-
 
98
                    'FROM cel_obs AS co '.
-
 
99
                    '   LEFT JOIN cel_zones_geo AS l '.
-
 
100
                    '       ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) '.
-
 
101
                    "WHERE transmission = '1' ".
-
 
102
					" AND (( ".
-
 
103
					"		(latitude = '' OR latitude IS NULL OR latitude = '000null') ".
-
 
104
					" 		AND (longitude = '' OR longitude IS NULL OR longitude = '000null') ".
-
 
105
					"	) OR mots_cles_texte LIKE '%sensible%') ".
-
 
106
					$this->construireWhereRectangleCommune().
-
 
107
					$this->construireWhereDept().
-
 
108
                    $this->construireWhereCommune().
-
 
109
                    $this->construireWhereUtilisateur().
-
 
110
					$this->construireWhereNumTaxon().
-
 
111
					$this->construireWhereNomTaxon().
-
 
112
					$this->construireWhereDate().
-
 
113
					$this->construireWhereCommentaire().
-
 
114
					$this->construireWherePhotosSeulement().
-
 
115
					$this->construireWhereProjet().
-
 
116
					$this->construireWhereTag();
-
 
117
 
-
 
118
		$resultats_communes = $this->requeter($requete);
-
 
119
 
-
 
120
		$requete =  'SELECT latitude AS lat, longitude  AS lng, location AS nom '.
-
 
121
					'FROM cel_obs AS co '.
-
 
122
                    '   LEFT JOIN cel_zones_geo AS l '.
-
 
123
                    '       ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) '.
-
 
124
                    "WHERE transmission = '1' ".
-
 
125
					" AND latitude != '' AND latitude IS NOT NULL AND latitude != '000null' ".
-
 
126
					" AND longitude != '' AND longitude IS NOT NULL AND longitude != '000null' ".
-
 
127
					" AND (mots_cles_texte IS NULL OR mots_cles_texte NOT LIKE '%sensible%') ".
-
 
128
					$this->construireWhereRectangleStation().
-
 
129
					$this->construireWhereDept().
-
 
130
                    $this->construireWhereCommune().
-
 
131
                    $this->construireWhereUtilisateur().
-
 
132
					$this->construireWhereNumTaxon().
-
 
133
					$this->construireWhereNomTaxon().
-
 
134
					$this->construireWhereDate().
-
 
135
					$this->construireWhereCommentaire().
-
 
136
					$this->construireWherePhotosSeulement().
-
 
137
					$this->construireWhereProjet().
-
 
138
					$this->construireWhereTag();
-
 
139
 
-
 
140
		$resultats_stations = $this->requeter($requete);
-
 
141
		$stations = $this->traiterStations($resultats_communes, $resultats_stations);
-
 
142
 
-
 
143
		return $stations;
-
 
144
	}
90
	}
Line 145... Line 91...
145
 
91
 
146
	public function getTout($params) {
92
	public function getTout($params) {
Line 165... Line 111...
165
					$this->construireWhereDept().
111
					$this->construireWhereDept().
166
                    $this->construireWhereCommune().
112
                    $this->construireWhereCommune().
167
                    $this->construireWhereUtilisateur().
113
                    $this->construireWhereUtilisateur().
168
					$this->construireWhereNumTaxon().
114
					$this->construireWhereNumTaxon().
169
					$this->construireWhereNomTaxon().
115
					$this->construireWhereNomTaxon().
-
 
116
					$this->construireWhereReferentiel().
170
					$this->construireWhereDate().
117
					$this->construireWhereDate().
171
					$this->construireWhereCommentaire().
118
					$this->construireWhereCommentaire().
172
					$this->construireWherePhotosSeulement().
119
					$this->construireWherePhotosSeulement().
173
					$this->construireWhereProjet().
120
					$this->construireWhereProjet().
174
					$this->construireWhereTag().
121
					$this->construireWhereTag().
Line 201... Line 148...
201
					$this->construireWhereDept().
148
					$this->construireWhereDept().
202
                    $this->construireWhereCommune().
149
                    $this->construireWhereCommune().
203
                    $this->construireWhereUtilisateur().
150
                    $this->construireWhereUtilisateur().
204
					$this->construireWhereNumTaxon().
151
					$this->construireWhereNumTaxon().
205
					$this->construireWhereNomTaxon().
152
					$this->construireWhereNomTaxon().
-
 
153
					$this->construireWhereReferentiel().
206
					$this->construireWhereDate().
154
					$this->construireWhereDate().
207
					$this->construireWhereCommentaire().
155
					$this->construireWhereCommentaire().
208
					$this->construireWherePhotosSeulement().
156
					$this->construireWherePhotosSeulement().
209
					$this->construireWhereProjet().
157
					$this->construireWhereProjet().
210
					$this->construireWhereTag().
158
					$this->construireWhereTag().
Line 384... Line 332...
384
						(($this->communeEstDemandee()) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
332
						(($this->communeEstDemandee()) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
385
						$this->construireWhereDept().
333
						$this->construireWhereDept().
386
						$this->construireWhereUtilisateur().
334
						$this->construireWhereUtilisateur().
387
						$this->construireWhereNumTaxon().
335
						$this->construireWhereNumTaxon().
388
						$this->construireWhereNomTaxon().
336
						$this->construireWhereNomTaxon().
-
 
337
						$this->construireWhereReferentiel().
389
						$this->construireWhereDate().
338
						$this->construireWhereDate().
390
						$this->construireWhereCommentaire().
339
						$this->construireWhereCommentaire().
391
						$this->construireWherePhotosSeulement().
340
						$this->construireWherePhotosSeulement().
392
						$this->construireWhereProjet().
341
						$this->construireWhereProjet().
393
						$this->construireWhereTag().
342
						$this->construireWhereTag().
Line 537... Line 486...
537
					$this->construireWhereDept().
486
					$this->construireWhereDept().
538
                    $this->construireWhereCommune().
487
                    $this->construireWhereCommune().
539
                    $this->construireWhereUtilisateur().
488
                    $this->construireWhereUtilisateur().
540
					$this->construireWhereNumTaxon().
489
					$this->construireWhereNumTaxon().
541
					$this->construireWhereNomTaxon().
490
					$this->construireWhereNomTaxon().
-
 
491
					$this->construireWhereReferentiel().
542
					$this->construireWhereDate().
492
					$this->construireWhereDate().
543
					$this->construireWhereCommentaire().
493
					$this->construireWhereCommentaire().
544
					$this->construireWherePhotosSeulement().
494
					$this->construireWherePhotosSeulement().
545
					$this->construireWhereProjet().
495
					$this->construireWhereProjet().
546
					$this->construireWhereTag().
496
					$this->construireWhereTag().
Line 666... Line 616...
666
					$sql = " AND nom_ret LIKE $nom ";
616
					$sql = " AND nom_ret LIKE $nom ";
667
			}
617
			}
668
		}
618
		}
669
		return $sql;
619
		return $sql;
670
	}
620
	}
-
 
621
	
-
 
622
	private function construireWhereReferentiel() {
-
 
623
		$sql = '';
-
 
624
		extract($this->parametres);
-
 
625
		if (isset($referentiel) && !$this->etreNull($referentiel)) {
-
 
626
			$referentiel = $this->proteger($referentiel.'%');
-
 
627
			$sql = ' AND co.nom_referentiel LIKE '.$referentiel.' ';
-
 
628
		}
-
 
629
		return $sql;
-
 
630
	}
Line 671... Line 631...
671
 
631
 
672
	private function construireWhereDate() {
632
	private function construireWhereDate() {
673
		$sql = '';
633
		$sql = '';
674
		// Récupération des coordonnées depuis l'id station
634
		// Récupération des coordonnées depuis l'id station
Line 794... Line 754...
794
			$this->construireWhereDept().
754
			$this->construireWhereDept().
795
			$this->construireWhereCommune().
755
			$this->construireWhereCommune().
796
			$this->construireWhereUtilisateur().
756
			$this->construireWhereUtilisateur().
797
			$this->construireWhereNumTaxon().
757
			$this->construireWhereNumTaxon().
798
			$this->construireWhereNomTaxon().
758
			$this->construireWhereNomTaxon().
-
 
759
			$this->construireWhereReferentiel().
799
			$this->construireWhereProjet().
760
			$this->construireWhereProjet().
800
			$this->construireWhereTag().
761
			$this->construireWhereTag().
801
			'ORDER BY utilisateur ASC, ordre ASC';
762
			'ORDER BY utilisateur ASC, ordre ASC';
802
		//$this->debug[] = $requete;
763
		//$this->debug[] = $requete;
803
		//die($requete);
764
		//die($requete);
Line 1067... Line 1028...
1067
						"WHERE transmission = '1' ".
1028
						"WHERE transmission = '1' ".
1068
						$this->construireWhereCoordonnees().
1029
						$this->construireWhereCoordonnees().
1069
						$this->construireWhereUtilisateur().
1030
						$this->construireWhereUtilisateur().
1070
						$this->construireWhereNumTaxon().
1031
						$this->construireWhereNumTaxon().
1071
						$this->construireWhereNomTaxon().
1032
						$this->construireWhereNomTaxon().
-
 
1033
						$this->construireWhereReferentiel().
1072
						$this->construireWhereProjet().
1034
						$this->construireWhereProjet().
1073
						(!$this->etreNull($tag_sql) ? "AND ($tag_sql) " : '').
1035
						(!$this->etreNull($tag_sql) ? "AND ($tag_sql) " : '').
1074
						'ORDER BY utilisateur ASC, ci.ordre ASC';
1036
						'ORDER BY utilisateur ASC, ci.ordre ASC';
1075
			//$this->debug[] = $requete;
1037
			//$this->debug[] = $requete;
1076
			//die($requete);
1038
			//die($requete);