Subversion Repositories eFlore/Applications.moissonnage

Compare Revisions

Ignore whitespace Rev 31 → Rev 34

/trunk/services/bibliotheque/Referentiel.php
39,6 → 39,7
private $nomCourt;
private $taxon;
private $bdd = null;
private $nomsChampsBdtfx = array('nn' => 'num_nom_retenu', 'nt' => 'num_taxonomique', 'ns' => 'nom_sci');
private $nomsChampsBdtxa = array('nn' => 'num_nom_retenu', 'nt' => 'num_tax', 'ns' => 'nom_sci');
private $champs;
87,46 → 88,30
if (is_null($this->bdd)) {
$this->bdd = new Bdd();
}
$nomBdd = Config::get('bdd_eflore');
if (is_null($nomBdd)) {
$nomBdd = Config::get('bdd_nom');
}
$nomBdd = Config::get('bdd_nom');
$this->bdd->requeter("USE ".$nomBdd);
return $this->bdd;
}
public function recupererTaxonsSousEspeces($listeNn = null) {
public function recupererSynonymesEtSousEspeces() {
$sousTaxons = array();
if (!is_null($this->taxon) && $this->taxon['rang'] == Config::get('rang.espece')) {
if (is_null($listeNn)) {
$listeNn = $this->taxon['nn'];
}
if (!is_null($this->taxon) && $this->taxon['rang'] >= Config::get('rang.espece')) {
$requete =
"SELECT ".$this->champs['nn']." AS nn, ".$this->champs['nt']." AS nt, ".
$this->champs['ns']." AS nom, rang FROM ".$this->nomComplet." WHERE ".
"num_tax_sup IN ({$listeNn}) AND num_nom=".$this->champs['nn'];
$resultats = $this->getBdd()->recupererTous($requete);
$nouvelleListeNn = '';
foreach ($resultats as $sousTaxon) {
$sousTaxons[] = $sousTaxon;
$nouvelleListeNn .= (strlen($nouvelleListeNn) == 0 ? '' : ',') . $sousTaxon['nn'];
}
// recherche de sous taxons au niveau inferieur (parcours recursif de la methode)
if (count($resultats) > 0) {
$sousTaxons = array_merge($sousTaxons, $this->recupererTaxonsSousEspeces($nouvelleListeNn));
}
"SELECT ".$this->champs['nn']." AS nn, ".$this->champs['nt']." AS nt, ".
$this->champs['ns']." AS nom, rang FROM ".$this->nomComplet. " WHERE ".
$this->champs['nt']."=".$this->taxon['nt']." OR hierarchie LIKE '%-".$this->champs['nn']."-%'";
$sousTaxons = $this->getBdd()->recupererTous($requete);
}
return $sousTaxons;
}
public function recupererTaxonsFamilles() {
public function recupererGenres() {
$sousTaxons = array();
if (!is_null($this->taxon) && $this->taxon['rang'] == Config::get('rang.genre')) {
if (!is_null($this->taxon) && $this->taxon['rang'] == Config::get('rang.famille')) {
$requete =
"SELECT ".$this->champs['nn']." AS nn, ".$this->champs['nt']." AS nt, ".
$this->champs['ns']." AS nom, rang FROM ".$this->nomComplet." WHERE ".
"num_tax_sup=".$this->taxon['nn']." AND num_nom=".$this->champs['nn'];
"SELECT ".$this->champs['nn']." AS nn, ".$this->champs['nt']." AS nt, ".
$this->champs['ns']." AS nom, rang FROM ".$this->nomComplet. " WHERE ".
"num_tax_sup=".$this->taxon['nn']." AND num_nom=".$this->champs['nn'];
$sousTaxons = $this->getBdd()->recupererTous($requete);
}
return $sousTaxons;
149,10 → 134,13
return $tableau;
}
public function obtenirNumeroNomenclatural($nomScientifique) {
public function obtenirNumeroNomenclatural($nomScientifique, $numeroNomenclatural = null) {
$aProteger = $this->getBdd()->proteger(trim($nomScientifique) . '%');
$requete = "SELECT ".$this->champs['nn']." AS nn FROM ".$this->nomComplet." ".
"WHERE ".$this->champs['ns']." LIKE ".$aProteger;
if (!is_null($numeroNomenclatural) || strlen($numeroNomenclatural) > 0) {
$requete .= " OR ".$this->champs['nn']."={$numeroNomenclatural}";
}
$taxon = $this->getBdd()->recuperer($requete);
if ($taxon == false) {
$taxon = null;
163,4 → 151,5
}
}
 
?>