Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 499 Rev 519
Line 18... Line 18...
18
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
18
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
19
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
19
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
20
 * @version $Id$
20
 * @version $Id$
21
 * @copyright © 2010, Jean-Pascal MILCENT
21
 * @copyright © 2010, Jean-Pascal MILCENT
22
 */
22
 */
-
 
23
// TODO : supprimer le TRIM quand les obs seront reliées correctements aux localisations (sur le code INSEE par exemple)
23
class CelWidgetMap extends Cel {
24
class CelWidgetMap extends Cel {
Line 24... Line 25...
24
	
25
	
25
	/**
26
	/**
26
	 * Méthode appelée avec une requête de type GET.
27
	 * Méthode appelée avec une requête de type GET.
Line 63... Line 64...
63
		extract($parametres);
64
		extract($parametres);
Line 64... Line 65...
64
		
65
		
65
		$requete =  'SELECT sector, x_utm, y_utm '.
66
		$requete =  'SELECT sector, x_utm, y_utm '.
66
                    'FROM cel_inventory AS i '.
67
                    'FROM cel_inventory AS i '.
67
                    '   LEFT JOIN locations AS l '.
68
                    '   LEFT JOIN locations AS l '.
68
                    '       ON (l.name = i.location AND l.code = i.id_location) '.
69
                    "       ON (l.name = i.location AND l.code = TRIM(LEADING '0' FROM i.id_location)) ".
69
                    "WHERE transmission = '1' ".
70
                    "WHERE transmission = '1' ".
70
                    (isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '' ).
71
                    (isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '' ).
71
                    (isset($dept) ? " AND l.insee_code LIKE '$dept%' " : '').
72
                    (isset($dept) ? " AND l.insee_code LIKE '$dept%' " : '').
72
                    (isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
73
                    (isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
Line 134... Line 135...
134
		// Vérification que la clé passée dans l'url est correspond à celle attendue
135
		// Vérification que la clé passée dans l'url est correspond à celle attendue
135
		if ($cle == $this->config['jrest_admin']['cleCarto']) {
136
		if ($cle == $this->config['jrest_admin']['cleCarto']) {
136
			$requete =  'SELECT sector, x_utm, y_utm, coord_x, coord_y, ref_geo '.
137
			$requete =  'SELECT sector, x_utm, y_utm, coord_x, coord_y, ref_geo '.
137
	                    'FROM cel_inventory AS i '.
138
	                    'FROM cel_inventory AS i '.
138
	                    '   LEFT JOIN locations AS l '.
139
	                    '   LEFT JOIN locations AS l '.
139
	                    '       ON (l.name = i.location AND l.code = i.id_location) '.
140
	                    "       ON (l.name = i.location AND l.code = TRIM(LEADING '0' FROM i.id_location)) ".
140
	                    "WHERE transmission = '1' ".
141
	                    "WHERE transmission = '1' ".
141
	                    (isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '' ).
142
	                    (isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '' ).
142
	                    (isset($dept) ? " AND l.insee_code LIKE '$dept%' " : '').
143
	                    (isset($dept) ? " AND l.insee_code LIKE '$dept%' " : '').
143
	                    (isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
144
	                    (isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
144
	                    (isset($projet) ? ' AND ('.$this->getSqlWhereProjet($projet).') ' : '' );
145
	                    (isset($projet) ? ' AND ('.$this->getSqlWhereProjet($projet).') ' : '' );
Line 214... Line 215...
214
		$requete = 	'SELECT identifiant, nom_sel, nom_ret, num_nom_sel, num_nom_ret, num_taxon, famille, '.
215
		$requete = 	'SELECT identifiant, nom_sel, nom_ret, num_nom_sel, num_nom_ret, num_taxon, famille, '.
215
					'	lieudit, location, date_observation, milieu, commentaire, '.
216
					'	lieudit, location, date_observation, milieu, commentaire, '.
216
					'	sector, x_utm, y_utm, insee_code '.
217
					'	sector, x_utm, y_utm, insee_code '.
217
					'FROM cel_inventory AS i '.
218
					'FROM cel_inventory AS i '.
218
					'	LEFT JOIN locations AS l '.
219
					'	LEFT JOIN locations AS l '.
219
					'		ON (l.name = i.location AND l.code = i.id_location) '.
220
					"		ON (l.name = i.location AND l.code = TRIM(LEADING '0' FROM i.id_location)) ".
220
					"WHERE transmission = '1' ".
221
					"WHERE transmission = '1' ".
221
					(($type == 'UTM') ? "	AND (sector = '$secteur' AND x_utm = '$x_utm' AND y_utm = '$y_utm' ) " : '').
222
					(($type == 'UTM') ? "	AND (sector = '$secteur' AND x_utm = '$x_utm' AND y_utm = '$y_utm' ) " : '').
222
					(($type == 'LngLat') ? "	AND (coord_x = '$coord_x' AND coord_y = '$coord_y' ) " : '').
223
					(($type == 'LngLat') ? "	AND (coord_x = '$coord_x' AND coord_y = '$coord_y' ) " : '').
223
					(isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '').
224
					(isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '').
224
					(isset($dept) ? " AND l.insee_code LIKE '$dept%' " : '').
225
					(isset($dept) ? " AND l.insee_code LIKE '$dept%' " : '').
Line 250... Line 251...
250
		}
251
		}
Line 251... Line 252...
251
 
252
 
252
		$requete = 	'SELECT nom_sel, num_nom_sel, nom_ret, num_nom_ret, num_taxon, famille '.
253
		$requete = 	'SELECT nom_sel, num_nom_sel, nom_ret, num_nom_ret, num_taxon, famille '.
253
					'FROM cel_inventory AS i '.
254
					'FROM cel_inventory AS i '.
254
					'	LEFT JOIN locations AS l '.
255
					'	LEFT JOIN locations AS l '.
255
					'		ON (l.name = i.location AND l.code = i.id_location) '.
256
					"		ON (l.name = i.location AND l.code = TRIM(LEADING '0' FROM i.id_location)) ".
256
					"WHERE transmission = '1' ".
257
					"WHERE transmission = '1' ".
257
					(isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '').
258
					(isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '').
258
					(isset($dept) ? " AND l.insee_code LIKE '$dept%' " : '').
259
					(isset($dept) ? " AND l.insee_code LIKE '$dept%' " : '').
259
                    (isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
260
                    (isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).