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 != '') {
|
Line 166... |
Line 186... |
166 |
|
186 |
|
167 |
public function effectuerRequeteInfosComplementairesSurNumNom($num_nom, $ref = NULL) {
|
187 |
public function effectuerRequeteInfosComplementairesSurNumNom($num_nom, $ref = NULL) {
|
168 |
if($ref && isset($this->config['eflore']['api_host'])) {
|
188 |
if($ref && isset($this->config['eflore']['api_host'])) {
|
169 |
if(self::DEBUG) error_log("CEL fetch: " .$this->config['eflore']['api_host'] . '/');
|
189 |
if(self::DEBUG) error_log("CEL fetch: " .$this->config['eflore']['api_host'] . '/');
|
170 |
return @json_decode(file_get_contents($this->config['eflore']['api_host'] . '/' .
|
190 |
return @json_decode(file_get_contents($this->config['eflore']['api_host'] . '/' .
|
171 |
$ref . '/' .
|
191 |
$this->code_referentiel . '/' .
|
172 |
'noms' . '/' .
|
192 |
'noms' . '/' .
|
173 |
$num_nom .
|
193 |
$num_nom .
|
174 |
'?retour.champs=' . implode(',', array('nom_sci,auteur',
|
194 |
'?retour.champs=' . implode(',', array('nom_sci,auteur',
|
175 |
'id',
|
195 |
'id',
|
Line 259... |
Line 279... |
259 |
$retour = $resultat->resultat;
|
279 |
$retour = $resultat->resultat;
|
260 |
}
|
280 |
}
|
261 |
}
|
281 |
}
|
262 |
return $retour;
|
282 |
return $retour;
|
263 |
}
|
283 |
}
|
264 |
}
|
- |
|
265 |
|
284 |
}
|
- |
|
285 |
|