Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 3226 → Rev 3227

/trunk/jrest/bibliotheque/RechercheInfosTaxonBeta.php
42,23 → 42,43
}
 
public function setReferentiel($code_referentiel = 'bdtfx') {
$this->code_referentiel = $code_referentiel;
$this->formaterUrlsServices($this->config);
$sousref = array("apdfna" => array("apd", "fna"),
"apdfta" => array("apd", "fta"),
"apdfsa" => array("apd", "fsa"),
"taxref", "vascan");
if (array_key_exists($code_referentiel, $sousref)) {
$this->code_referentiel = $sousref[$code_referentiel][0];
$this->formaterUrlsServicesSousRef($this->config, $sousref[$code_referentiel][1]);
} else {
$this->code_referentiel = $code_referentiel;
$this->formaterUrlsServices($this->config);
}
}
 
private function formaterUrlsServices($config) {
$this->url_service_nom = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_nom']);
$this->url_service_taxon = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_taxon']);
$this->url_service_nom_m = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_nom'])."?";
$this->url_service_taxon_m = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_taxon'])."?";
$this->url_service_chorologie_obs = $config['eflore']['url_service_chorologie_obs'];
$this->config = $config;
}
private function formaterUrlsServicesSousRef($config, $sousref) {
$this->url_service_nom = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_nom']);
$this->url_service_taxon = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_taxon']);
$this->url_service_nom_m = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_nom'])."?masque.ref=".$sousref."&";
$this->url_service_taxon_m = str_replace('{referentiel}', $this->code_referentiel ,$config['eflore']['url_service_taxon'])."?masque.ref=".$sousref."&";
$this->url_service_chorologie_obs = $config['eflore']['url_service_chorologie_obs'];
$this->config = $config;
}
 
public function rechercherGenreEspeceSurPrefixe($genre = null, $espece = null) {
$liste_genre_espece = array();
$this->masque_recherche = trim(trim($genre).' '.trim($espece,' *'));
$masque = urlencode($this->masque_recherche);
if(self::DEBUG) error_log("CEL fetch: " . $this->url_service_nom.'?masque='.$masque.'&recherche=etendue&retour.format=min&navigation.limite=50&ns.structure=au');
$urlService = $this->url_service_nom.'?masque='.$masque.'&recherche=etendue&retour.format=min&navigation.limite=50&ns.structure=au,an';
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');
$urlService = $this->url_service_nom_m.'masque='.$masque.'&recherche=etendue&retour.format=min&navigation.limite=50&ns.structure=au,an';
$requete = @file_get_contents($urlService);
if($requete != '') {
$requete = json_decode($requete);