Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1783 → Rev 1784

/trunk/jrest/lib/RechercheInfosTaxonBeta.php
25,7 → 25,11
private $masque_recherche = null;
private $code_referentiel = 'bdtfx';
 
// initialisé à TRUE par rechercherInfosSurTexteCodeOuNumTax()
// si l'espèce passée a le motif <ref>:(nt|nn):<num>, eg: isfan:nt:1591
public $is_notation_spe = FALSE;
 
public function RechercheInfosTaxonBeta($config, $code_referentiel = 'bdtfx') {
parent::__construct($config);
$this->code_referentiel = $code_referentiel;
166,27 → 170,28
return $presence_taxon;
}
public function effectuerRequeteInfosComplementairesSurNumTax($numTax) {
//TODO: retourner moins de champs grâce au paramètre retour.champs
return @json_decode(file_get_contents($this->url_service_taxon."/nt:".$numTax));
}
 
/* texte libre, nom scientifique,
ou code nomenclatural (format BDNFFnn999999)
ou code taxonomique (format BDNFFnt999999)
ou code nomenclatural (format bdtfx:nn:999999)
ou code taxonomique (format bdtfx:nt:999999)
TODO: voir ce qu'on fait pour l'import de différent référentiels */
function rechercherInfosSurTexteCodeOuNumTax($identifiant_espece) {
preg_match('/BDNFFnn(\d+)/',$identifiant_espece, $elements);
// Numero nomenclatural
if (isset($elements[1]))
return $this->effectuerRequeteInfosComplementairesSurNumNom($elements[1]);
preg_match('/(' . implode('|', Cel::$referentiels_valides) .'):(nn|nt):(\d+)/i', $identifiant_espece, $elements);
if($elements) {
$this->is_notation_spe = TRUE;
list(, $ref, $type, $num) = $elements;
// Numero nomenclatural
if ($type == 'nn') {
$obj = $this->effectuerRequeteInfosComplementairesSurNumNom($num);
}
// Numero taxonomique
else {
//TODO: retourner moins de champs grâce au paramètre retour.champs
$obj = @json_decode(file_get_contents($this->url_service_taxon."/nt:".$num));
}
$obj->ref = $ref;
return $obj;
}
 
// Numero taxonomique ou nom scientifique
preg_match('/BDNFFnt(\d+)/', $identifiant_espece, $elements);
// Numero taxonomique
if (isset($elements[1]))
return $this->effectuerRequeteInfosComplementairesSurNumTax($elements[1]);
 
// Nom scientifique
return $this->rechercherInformationsComplementairesSurNom($identifiant_espece);
}