Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2414 Rev 2522
Line 25... Line 25...
25
class CodeInseeCommune extends Script {
25
class CodeInseeCommune extends Script {
Line 26... Line 26...
26
 
26
 
27
	protected $tableauTaxon;
27
	protected $tableauTaxon;
28
	protected $dao;
28
	protected $dao;
-
 
29
	protected $observations;
-
 
30
	
Line 29... Line 31...
29
	protected $observations;
31
	protected $url_service_geo_tpl;
Line 30... Line 32...
30
 
32
 
31
	protected $mode_verbeux = false;
33
	protected $mode_verbeux = false;
32
 
34
 
Line 33... Line 35...
33
	// Paramêtres autorisées lors de l'appel au script en ligne de commande
35
	// Paramêtres autorisées lors de l'appel au script en ligne de commande
-
 
36
	protected $parametres_autorises = array(
-
 
37
		'-n' => array(true, true, 'Nom du fichier ou du dossier à traiter'));
Line 34... Line 38...
34
	protected $parametres_autorises = array(
38
 
35
		'-n' => array(true, true, 'Nom du fichier ou du dossier à traiter'));
39
	public function executer() {
36
 
40
		
37
	public function executer() {
41
		$this->url_service_geo_tpl = Config::get('urlZoneGeoTpl');
Line 147... Line 151...
147
		$this->dao->testerActiviteConnection();
151
		$this->dao->testerActiviteConnection();
148
		$this->dao->modifierCodeInseeEtZoneGeo($coordonnee_a_traiter);
152
		$this->dao->modifierCodeInseeEtZoneGeo($coordonnee_a_traiter);
149
	}
153
	}
Line 150... Line 154...
150
 
154
 
-
 
155
	private function chercherInfosCommune($projet, $latitude, $longitude) {
151
	private function chercherInfosCommune($projet, $latitude, $longitude) {
156
		
152
		$url_service = "www.tela-botanica.org/service:eflore:0.1/{$projet}/nom-commune".
157
		$noms_params = array('{projet}', '{latitude}', '{longitude}');
153
			"?lat={$latitude}&lon={$longitude}";
158
		$valeurs_params = array($projet, $latitude, $longitude);
-
 
159
		
154
 
160
		$url_service = str_replace($noms_params, $valeurs_params, $this->url_service_geo_tpl);
-
 
161
		$url_service = str_replace(',', '.', $url_service);
155
		$url_service = str_replace(',', '.', $url_service);
162
 
156
		$ch = curl_init($url_service);
163
		$ch = curl_init($url_service);
157
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
164
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
Line 158... Line 165...
158
		$reponse = curl_exec($ch);
165
		$reponse = curl_exec($ch);