Subversion Repositories Sites.obs-saisons.fr

Rev

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

Rev 105 Rev 173
Line 48... Line 48...
48
    		$this->envoyer($erreurs);
48
    		$this->envoyer($erreurs);
49
    	}
49
    	}
Line 50... Line 50...
50
    	
50
    	
Line -... Line 51...
-
 
51
    	$id_participant = $params['id_participant'];
-
 
52
    	
-
 
53
    	if(isset($params['station_code_insee'])) {
-
 
54
    		$commune = $params['station_code_insee'];
-
 
55
    	} else {
-
 
56
    		$commune = $params['station_commune'];
51
    	$id_participant = $params['id_participant'];
57
    	}
52
    	
58
    	
53
    	$requete_creation_station = 'INSERT INTO ods_stations '.
59
    	$requete_creation_station = 'INSERT INTO ods_stations '.
54
					'(os_ce_participant, os_nom, os_ce_commune, os_latitude, os_longitude, os_altitude, os_ce_environnement, os_commentaire) '.
60
					'(os_ce_participant, os_nom, os_ce_commune, os_latitude, os_longitude, os_altitude, os_ce_environnement, os_commentaire) '.
55
					'VALUES ('.
61
					'VALUES ('.
56
							$this->proteger($id_participant).','.
62
							$this->proteger($id_participant).','.
57
							$this->proteger($params['station_nom']).','.
63
							$this->proteger($params['station_nom']).','.
58
							$this->proteger($params['station_commune']).','.
64
							$commune.','.
59
							$this->proteger($params['station_lat']).','.
65
							$this->proteger($params['station_lat']).','.
60
							$this->proteger($params['station_lon']).','.
66
							$this->proteger($params['station_lon']).','.
61
							$this->proteger($params['station_alt']).','.
67
							$this->proteger($params['station_alt']).','.
Line 98... Line 104...
98
    		return;
104
    		return;
99
    	} else {
105
    	} else {
100
    		$id_station = $uid[0];;
106
    		$id_station = $uid[0];;
101
    	}
107
    	}
Line -... Line 108...
-
 
108
    	
-
 
109
        if(isset($params['station_code_insee'])) {
-
 
110
    		$commune = $params['station_code_insee'];
-
 
111
    	} else {
-
 
112
    		$commune = $params['station_commune'];
-
 
113
    	}
102
    	
114
    	
103
        $requete_modification_station = 'UPDATE ods_stations '.
115
        $requete_modification_station = 'UPDATE ods_stations '.
104
			'SET '.
116
			'SET '.
105
			'os_nom ='.$this->proteger($params['station_nom']).','.
117
			'os_nom ='.$this->proteger($params['station_nom']).','.
106
        	'os_ce_commune ='.$this->proteger($params['station_commune']).','.
118
        	'os_ce_commune ='.$commune.','.
107
			'os_latitude ='.$this->proteger($params['station_lat']).','.
119
			'os_latitude ='.$this->proteger($params['station_lat']).','.
108
			'os_longitude ='.$this->proteger($params['station_lon']).','.
120
			'os_longitude ='.$this->proteger($params['station_lon']).','.
109
			'os_altitude ='.$this->proteger($params['station_alt']).','.
121
			'os_altitude ='.$this->proteger($params['station_alt']).','.
110
			'os_ce_environnement ='.$this->proteger($params['station_milieu']).','.
122
			'os_ce_environnement ='.$this->proteger($params['station_milieu']).','.
Line 196... Line 208...
196
    	return $infos_station_formatees;
208
    	return $infos_station_formatees;
197
    }
209
    }
Line 198... Line 210...
198
    
210
    
Line -... Line 211...
-
 
211
    private function formaterChampsStationPourEnvoi($station) {
-
 
212
    	
-
 
213
    	if(is_numeric($station['os_ce_commune'])) {
-
 
214
    		$commune = $this->obtenirInformationsCommuneParCodeInsee($station['os_ce_commune']);
-
 
215
    	} else {
-
 
216
    		$commune = $station['os_ce_commune'];
199
    private function formaterChampsStationPourEnvoi($station) {
217
    	}
200
    	
218
    	
201
    	$station_champs_formates = array(
219
    	$station_champs_formates = array(
202
		    	'id' => $station['os_id_station'],
220
		    	'id' => $station['os_id_station'],
203
		    	'nom' => $station['os_nom'],
221
		    	'nom' => $station['os_nom'],
204
				'id_commune' => $station['os_ce_commune'],
222
				'code_insee' => $station['os_ce_commune'],
205
    			'commune' => $this->obtenirInformationsCommuneParCodeInsee($station['os_ce_commune']),
223
    			'commune' => $commune,
206
				'id_milieu' => $station['os_ce_environnement'],
224
				'id_milieu' => $station['os_ce_environnement'],
207
    			'milieu' => $this->obtenirInformationsMilieuParId($station['os_ce_environnement']),
225
    			'milieu' => $this->obtenirInformationsMilieuParId($station['os_ce_environnement']),
208
				'latitude' => $station['os_latitude'],
226
				'latitude' => $station['os_latitude'],
Line 212... Line 230...
212
		    );
230
		    );
Line 213... Line 231...
213
		    
231
		    
214
		return $station_champs_formates;
232
		return $station_champs_formates;
Line 215... Line -...
215
    }
-
 
216
    
-
 
217
    private function obtenirInformationsCommuneParId($id_commune) {
-
 
218
    	
-
 
219
    	//$requete_infos_commune = 'SELECT * FROM ods_communes WHERE oc_id_commune = '.$this->proteger($id_commune);
-
 
220
    	//$infos_commune = $this->executerRequete($requete_infos_commune);
-
 
221
    	
-
 
222
    	//TODO: en attendant de stocker les ids
-
 
223
    	return $id_commune;
-
 
224
    	
-
 
225
    	//return $infos_commune;
-
 
226
    }
233
    }
Line 227... Line 234...
227
    
234
    
228
	private function obtenirInformationsCommuneParCodeInsee($code_insee_commune) {
235
	private function obtenirInformationsCommuneParCodeInsee($code_insee_commune) {
Line 229... Line 236...
229
    	
236
    	
230
    	//$requete_infos_commune = 'SELECT * FROM ods_communes WHERE oc_code_insee = '.$this->proteger($code_insee_commune);
237
    	$requete_infos_commune = 'SELECT * FROM ods_communes WHERE oc_code_insee = '.$this->proteger($code_insee_commune);
Line 231... Line 238...
231
    	//$infos_commune = $this->executerRequete($requete_infos_commune);
238
    	$infos_commune = $this->executerRequete($requete_infos_commune);
232
    	
239
    	
Line 233... Line 240...
233
		//TODO: en attendant de stocker les ids
240
		//TODO: en attendant de stocker les ids