Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1317 → Rev 1318

/trunk/jrest/lib/RechercheInfosTaxon.php
161,6 → 161,36
return $resultat_infos_complementaires;
}
public function effectuerRequeteInfosComplementairesSurNumTax($numTax) {
$requete_infos_complementaires = "SELECT DISTINCT en_nom_genre, en_epithete_espece, en_nom_supra_generique, en_epithete_infra_generique,".
" auteur_bex.enaia_intitule_abrege AS abreviation_auteur_basio_ex ".
" , auteur_b.enaia_intitule_abrege AS abreviation_auteur_basio ".
" , auteur_mex.enaia_intitule_abrege AS abreviation_auteur_modif_ex ".
" , auteur_m.enaia_intitule_abrege AS abreviation_auteur_modif ".
" , en_epithete_espece, en_epithete_infra_specifique, enrg_abreviation_rang, en_id_nom" .
" FROM eflore_nom, eflore_nom_rang," .
" eflore_naturaliste_intitule_abreviation AS auteur_bex ".
" , eflore_naturaliste_intitule_abreviation AS auteur_b ".
" , eflore_naturaliste_intitule_abreviation AS auteur_mex ".
" , eflore_naturaliste_intitule_abreviation AS auteur_m ".
" , eflore_selection_nom ".
" WHERE esn_id_taxon = '".$numTax. "'".
" AND esn_id_version_projet_taxon = 25 ".
" AND esn_ce_statut=3 ".
" AND en_id_nom = esn_id_nom" .
" AND en_ce_rang = enrg_id_rang" .
" AND en_ce_auteur_basio_ex = auteur_bex.enaia_id_intitule_naturaliste_abrege ".
" AND en_ce_auteur_basio = auteur_b.enaia_id_intitule_naturaliste_abrege ".
" AND en_ce_auteur_modif_ex = auteur_mex.enaia_id_intitule_naturaliste_abrege ".
" AND en_ce_auteur_modif = auteur_m.enaia_id_intitule_naturaliste_abrege ".
" AND esn_id_version_projet_taxon=en_id_version_projet_nom ";
$resultat_infos_complementaires = $this->requeter($requete_infos_complementaires);
return $resultat_infos_complementaires;
}
public function rechercherInformationsComplementairesSurNom($nom_saisi) {
$value = array();
254,6 → 284,46
return $presence_taxon;
}
private function decouperNomEtRechercheEspeceOuSousEspece($identifiant_espece) {
$nameparser=new NameParser();
$nom_latin_decoupe=$nameparser->parse($identifiant_espece);
// requete sous espece (on privilegie les noms retenu cf tri par esn_ce_statut)
if (isset($nom_latin_decoupe['infra']) && $nom_latin_decoupe['infra']!="") {
$requete="SELECT DISTINCT en_id_nom, esn_ce_statut" .
" FROM eflore_nom, eflore_nom_rang, eflore_selection_nom " .
" WHERE en_id_version_projet_nom = '25' AND en_nom_genre = '".$this->proteger($nom_latin_decoupe['genus'])."' " .
" AND enrg_abreviation_rang = '".$this->proteger($nom_latin_decoupe['infra_type'])."' " .
" AND en_epithete_infra_specifique = '".$this->proteger($nom_latin_decoupe['infra'])."' " .
" AND esn_id_nom= en_id_nom ".
" AND esn_id_version_projet_taxon=en_id_version_projet_nom " .
" AND en_epithete_espece = '".$this->proteger($nom_latin_decoupe['species'])."' AND en_ce_rang = enrg_id_rang " .
" ORDER BY esn_ce_statut ".
" LIMIT 1";
}
else { // espece (on privilegie les noms retenu cf tri par esn_ce_statut)
$requete="SELECT DISTINCT en_id_nom, esn_ce_statut" .
" FROM eflore_nom, eflore_nom_rang, eflore_selection_nom " .
" WHERE en_id_version_projet_nom = '25' AND en_nom_genre = '".$this->proteger($nom_latin_decoupe['genus'])."' " .
" AND enrg_abreviation_rang = 'sp.' " .
" AND esn_id_nom= en_id_nom ".
" AND esn_id_version_projet_taxon=en_id_version_projet_nom " .
" AND en_epithete_espece = '".$this->proteger($nom_latin_decoupe['species'])."' AND en_ce_rang = enrg_id_rang " .
" ORDER BY esn_ce_statut ".
" LIMIT 1";
}
$resultat = $this->requeter($requete);
$retour = array();
if (is_array($resultat) && count($resultat) > 0) {
$retour = $resultat[0];
}
return $resultat;
}
private function formaterNom($rawnom) {
 
// Constitution du nom:
311,5 → 381,42
 
return $auteurs ;
}
function rechercherInfosSurTexteCodeOuNumTax($identifiant_espece) {
// texte libre, nom scientifique,
// ou code nomenclatural (format BDNFFnn999999)
// ou code taxonomique (format BDNFFnt999999)
$identifiant_espece=trim($identifiant_espece);
$identifiant_espece=utf8_encode($identifiant_espece);
$retour = array();
preg_match('/BDNFFnn([0-9][0-9]*)/',$identifiant_espece, $elements);
if (isset($elements[1])) {
// Numero nomenclatural
$infos_taxon = $this->rechercherInformationsComplementairesSurNumNom($elements[1]);
$retour = array("nom_sel" => $this->formaterNom($infos_taxon), "en_id_nom" => $elements[1]);
} else {
// Numero taxonomique ou nom scientifique
preg_match('/BDNFFnt([0-9][0-9]*)/', $identifiant_espece, $elements);
if (isset($elements[1])) {
// Numero taxonomique
$infos_taxon = $this->effectuerRequeteInfosComplementairesSurNumTax($elements[1]);
$retour = array("nom_sel" => $this->formaterNom($infos_taxon), "en_id_nom" => $infos_taxon['en_id_nom']);
} else {
// Nom scientifique
$id_nom = $this->decouperNomEtRechercheEspeceOuSousEspece($identifiant_espece);
// Recherche du nom associe
$infos_nom = $this->effectuerRequeteInfosComplementairesSurNumNom($id_nom['en_id_nom']);
if (is_array($infos_nom) && !empty($infos_nom)) {
$retour = array("nom_sel" => $this->formaterNom($infos_nom), "en_id_nom" => $id_nom['en_id_nom']);
} else {
$retour = array("nom_sel" => $identifiant_espece);
}
}
}
return $retour;
}
}
?>