Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2959 Rev 3227
Line 40... Line 40...
40
		parent::__construct($config);
40
		parent::__construct($config);
41
		$this->setReferentiel($code_referentiel);
41
		$this->setReferentiel($code_referentiel);
42
	}
42
	}
Line 43... Line 43...
43
 
43
 
-
 
44
	public function setReferentiel($code_referentiel = 'bdtfx') {
-
 
45
		$sousref = array("apdfna" => array("apd", "fna"),
-
 
46
				"apdfta" => array("apd", "fta"),
-
 
47
				"apdfsa" => array("apd", "fsa"),
-
 
48
				"taxref", "vascan"); 
-
 
49
		if (array_key_exists($code_referentiel, $sousref)) {
-
 
50
			$this->code_referentiel = $sousref[$code_referentiel][0];
-
 
51
			$this->formaterUrlsServicesSousRef($this->config, $sousref[$code_referentiel][1]);
44
	public function setReferentiel($code_referentiel = 'bdtfx') {
52
		} else {
45
		$this->code_referentiel = $code_referentiel;
53
			$this->code_referentiel = $code_referentiel;
-
 
54
			$this->formaterUrlsServices($this->config);
46
		$this->formaterUrlsServices($this->config);
55
		} 
Line 47... Line 56...
47
	}
56
	}
48
 
57
 
49
	private function formaterUrlsServices($config) {
58
	private function formaterUrlsServices($config) {
-
 
59
		$this->url_service_nom = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_nom']);
-
 
60
		$this->url_service_taxon = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_taxon']);
-
 
61
		$this->url_service_nom_m = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_nom'])."?";
-
 
62
		$this->url_service_taxon_m = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_taxon'])."?";
-
 
63
		$this->url_service_chorologie_obs = $config['eflore']['url_service_chorologie_obs'];
-
 
64
		$this->config = $config;
-
 
65
	}
-
 
66
	
-
 
67
	private function formaterUrlsServicesSousRef($config, $sousref) {
-
 
68
		$this->url_service_nom = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_nom']);
-
 
69
		$this->url_service_taxon = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_taxon']);
50
		$this->url_service_nom = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_nom']);
70
		$this->url_service_nom_m = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_nom'])."?masque.ref=".$sousref."&";
51
		$this->url_service_taxon = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_taxon']);
71
		$this->url_service_taxon_m = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_taxon'])."?masque.ref=".$sousref."&";
52
		$this->url_service_chorologie_obs = $config['eflore']['url_service_chorologie_obs'];
72
		$this->url_service_chorologie_obs = $config['eflore']['url_service_chorologie_obs'];
Line 53... Line 73...
53
		$this->config = $config;
73
		$this->config = $config;
54
	}
74
	}
55
 
75
 
56
	public function rechercherGenreEspeceSurPrefixe($genre = null, $espece = null) {
76
	public function rechercherGenreEspeceSurPrefixe($genre = null, $espece = null) {
57
		$liste_genre_espece = array();
77
		$liste_genre_espece = array();
58
		$this->masque_recherche = trim(trim($genre).' '.trim($espece,' *'));
78
		$this->masque_recherche = trim(trim($genre).' '.trim($espece,' *'));
59
		$masque = urlencode($this->masque_recherche);
79
		$masque = urlencode($this->masque_recherche);
60
		if(self::DEBUG) error_log("CEL fetch: " . $this->url_service_nom.'?masque='.$masque.'&recherche=etendue&retour.format=min&navigation.limite=50&ns.structure=au');
80
		if(self::DEBUG) error_log("CEL fetch: " . $this->url_service_nom_m.'masque='.$masque.'&recherche=etendue&retour.format=min&navigation.limite=50&ns.structure=au');
61
		$urlService = $this->url_service_nom.'?masque='.$masque.'&recherche=etendue&retour.format=min&navigation.limite=50&ns.structure=au,an';
81
		$urlService = $this->url_service_nom_m.'masque='.$masque.'&recherche=etendue&retour.format=min&navigation.limite=50&ns.structure=au,an';
62
		$requete = @file_get_contents($urlService);
82
		$requete = @file_get_contents($urlService);
63
		if($requete != '') {
83
		if($requete != '') {