Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1032 Rev 1033
Line 68... Line 68...
68
	 * Les icones des groupes de stations
68
	 * Les icones des groupes de stations
69
	 */
69
	 */
70
	public function getIconeGroupe($params) {
70
	public function getIconeGroupe($params) {
71
		extract($this->parametres);
71
		extract($this->parametres);
Line 72... Line 72...
72
 
72
 
73
		//TODO: changer ceci pour une adresse indiquée dans un fichier de config
73
		$chemin_marqueur = sprintf($this->config['settings']['cheminCelMarkerObsTpl'], $type);
Line 74... Line 74...
74
		$img = imagecreatefrompng("/home/aurelien/web/cel_GWT2/widget/documents/icones/carto/groupe/g$type.png");
74
		$img = imagecreatefrompng($chemin_marqueur);
75
 
75
 
76
		$noir = imagecolorallocate($img, 0, 0, 0);
76
		$noir = imagecolorallocate($img, 0, 0, 0);
77
		$texte = (String) $nbre;
77
		$texte = (String) $nbre;
Line 147... Line 147...
147
								"'stations', ".
147
								"'stations', ".
148
							"'communes' ".
148
							"'communes' ".
149
							") as type_emplacement, ".
149
							") as type_emplacement, ".
150
							"IF ((coord_x != '000null' AND coord_x != '' ".
150
							"IF ((coord_x != '000null' AND coord_x != '' ".
151
								" AND coord_y != '000null' AND coord_y != ''), ".
151
								" AND coord_y != '000null' AND coord_y != ''), ".
152
								"ROUND(coord_x,5), ".
152
								"coord_x, ".
153
								"ROUND(wgs84_latitude,5) ".
153
								"wgs84_latitude ".
154
							") as lat, ".
154
							") as lat, ".
155
							"IF ((coord_x != '000null' AND coord_x != '' ".
155
							"IF ((coord_x != '000null' AND coord_x != '' ".
156
								" AND coord_y != '000null' AND coord_y != ''), ".
156
								" AND coord_y != '000null' AND coord_y != ''), ".
157
								"ROUND(coord_y,5), ".
157
								"coord_y, ".
158
								"ROUND(wgs84_longitude,5) ".
158
								"wgs84_longitude ".
159
							") as lng, ".
159
							") as lng, ".
160
							"IF ((coord_x != '000null' AND coord_x != '' ".
160
							"IF ((coord_x != '000null' AND coord_x != '' ".
161
								" AND coord_y != '000null' AND coord_y != ''), ".
161
								" AND coord_y != '000null' AND coord_y != ''), ".
162
								'CONCAT("'.self::MARQUEUR_STATION.':",ROUND(coord_x,5),"|",ROUND(coord_y,5)), '.
162
								'CONCAT("'.self::MARQUEUR_STATION.':",coord_x,"|",coord_y), '.
163
								'CONCAT("'.self::MARQUEUR_COMMUNE.':",ROUND(wgs84_latitude,5),"|",ROUND(wgs84_longitude,5)) '.
163
								'CONCAT("'.self::MARQUEUR_COMMUNE.':",wgs84_latitude,"|",wgs84_longitude) '.
164
							") as id ".
164
							") as id ".
165
					'FROM cel_inventory AS i '.
165
					'FROM cel_inventory AS i '.
166
                    '   LEFT JOIN locations AS l '.
166
                    '   LEFT JOIN locations AS l '.
167
                    '       ON (l.name = i.location AND l.code = i.id_location) '.
167
                    '       ON (l.name = i.location AND l.code = i.id_location) '.
168
                    "WHERE transmission = '1' ".
168
                    "WHERE transmission = '1' ".
169
					" AND (".
169
					" AND (".
170
						"(".$this->construireWhereRectangleStationOR().
170
						"(".($this->construireWhereRectangleStationOR() != null ? $this->construireWhereRectangleStationOR().' AND ' : '').
171
							" AND (mots_cles_texte IS NULL OR mots_cles_texte NOT LIKE '%sensible%') ".
171
							" (mots_cles_texte IS NULL OR mots_cles_texte NOT LIKE '%sensible%') ".
172
						")".
172
						")".
173
						" OR ".
173
						" OR ".
174
						" ( ".
174
						" ( ".
175
							$this->construireWhereRectangleCommuneOR().
175
							"(".($this->construireWhereRectangleCommuneOR() != null ? $this->construireWhereRectangleCommuneOR().' Or ' : '').
176
							" OR mots_cles_texte LIKE '%sensible%' ".
176
							" mots_cles_texte LIKE '%sensible%' ".
-
 
177
							")".
177
						" ) ".
178
						" ) ".
178
					") ".
179
					") ".
179
					$this->construireWhereDept().
180
					$this->construireWhereDept().
180
                    $this->construireWhereCommune().
181
                    $this->construireWhereCommune().
181
                    $this->construireWhereUtilisateur().
182
                    $this->construireWhereUtilisateur().
Line 184... Line 185...
184
					$this->construireWhereDate().
185
					$this->construireWhereDate().
185
					$this->construireWhereCommentaire().
186
					$this->construireWhereCommentaire().
186
					$this->construireWhereProjet().
187
					$this->construireWhereProjet().
187
					$this->construireWhereTag();
188
					$this->construireWhereTag();
Line -... Line 189...
-
 
189
 
188
 
190
 
189
		$resultats_emplacements = $this->executerRequete($requete);
191
		$resultats_emplacements = $this->executerRequete($requete);
Line 190... Line 192...
190
		$emplacements = $this->traiterEmplacements($resultats_emplacements);
192
		$emplacements = $this->traiterEmplacements($resultats_emplacements);
Line 359... Line 361...
359
						$this->construireWhereCommentaire().
361
						$this->construireWhereCommentaire().
360
						$this->construireWhereProjet().
362
						$this->construireWhereProjet().
361
						$this->construireWhereTag().
363
						$this->construireWhereTag().
362
	                    'ORDER BY nom_sel ASC '.
364
	                    'ORDER BY nom_sel ASC '.
363
	                    "LIMIT {$this->start},{$this->limit} ";
365
	                    "LIMIT {$this->start},{$this->limit} ";
364
			//die($requete);
-
 
365
			$resultats = $this->requeter($requete, self::SQL_RETOUR_COMPLET, self::SQL_MODE_OBJET);
-
 
Line -... Line 366...
-
 
366
 
366
 
367
			$resultats = $this->requeter($requete, self::SQL_RETOUR_COMPLET, self::SQL_MODE_OBJET);
367
			$requete = 'SELECT FOUND_ROWS()';
368
			$requete = 'SELECT FOUND_ROWS()';
368
			$total = (int) $this->requeter($requete, self::SQL_RETOUR_COLONNE);
369
			$total = (int) $this->requeter($requete, self::SQL_RETOUR_COLONNE);
Line 369... Line 370...
369
		}
370
		}
Line 543... Line 544...
543
		extract($this->decomposerParametreStation());
544
		extract($this->decomposerParametreStation());
544
		if (isset($type)) {
545
		if (isset($type)) {
545
			if ($type == self::MARQUEUR_COMMUNE) {
546
			if ($type == self::MARQUEUR_COMMUNE) {
546
				$lat = $this->proteger($lat);
547
				$lat = $this->proteger($lat);
547
				$lng = $this->proteger($lng);
548
				$lng = $this->proteger($lng);
548
				$sql = " AND (wgs84_latitude = $lat AND wgs84_longitude = $lng) ";
549
				$sql = " AND (ROUND(wgs84_latitude,5) = ROUND($lat,5) AND ROUND(wgs84_longitude,5) = ROUND($lng,5)) ";
549
			}  else if ($type == self::MARQUEUR_STATION) {
550
			}  else if ($type == self::MARQUEUR_STATION) {
550
				$lat = $this->proteger($lat);
551
				$lat = $this->proteger($lat);
551
				$lng = $this->proteger($lng);
552
				$lng = $this->proteger($lng);
552
				$sql = " AND (coord_x = $lat AND coord_y = $lng) ";
553
				$sql = " AND (coord_x = $lat AND coord_y = $lng) ";
553
			}
554
			}
Line 1121... Line 1122...
1121
	private function decomposerParametreStation() {
1122
	private function decomposerParametreStation() {
1122
		$station_infos = array();
1123
		$station_infos = array();
1123
		if (isset($this->parametres['station'])) {
1124
		if (isset($this->parametres['station'])) {
1124
			$station = $this->parametres['station'];
1125
			$station = $this->parametres['station'];
1125
			$this->debug[] = $station;
1126
			$this->debug[] = $station;
1126
			list($type, $coord) = explode(':', $station);
1127
			@list($type, $coord) = explode(':', $station);
1127
			list($lat, $lng) = explode('|', $coord);
1128
			@list($lat, $lng) = explode('|', $coord);
Line 1128... Line 1129...
1128
 
1129
 
1129
			$station_infos = array('type' => $type, 'lat' => $lat, 'lng' => $lng);
1130
			$station_infos = array('type' => $type, 'lat' => $lat, 'lng' => $lng);
1130
		}
1131
		}
1131
		return $station_infos;
1132
		return $station_infos;