Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 294 → Rev 295

/trunk/services/modules/0.1/bdtfx/Taxons.php
385,11 → 385,17
public function formaterIdSuperieur($resultat, $version) {
$this->recupererTableSignification('correspondance_champs,champs_api,champs_comp');
$tab_relation = null; //si il n'existe aucune relation
$taxon_sup_traites = array();
if (($resultat) != '' ) {
//on recupere d'abord les rangs supérieurs
$sup = $resultat[0];
do {
$sup = $this->recupererIdSuperieur($sup['num_tax_sup'], $version);
if(!in_array($sup['num_nom'], $taxon_sup_traites)) {
$taxon_sup_traites[] = $sup['num_nom'];
} else {
$sup = null;
}
if ($sup['rang'] == '0') $sup['rang'] = '10'; //erreur dans la base
if (isset($sup)) $resultat[] = $sup;
} while ($sup != null);
401,37 → 407,42
$this->afficherNomHrefRetenu($tab, $num);
$this->afficherDonnees('rang', $tab['rang']);
$tab_inf[$num] = $this->table_retour;
$tab_inf[$num]['num_nom'] = $tab['num_nom'];
$this->table_retour = array();
}
$tab_relation[$this->num_nom_taxon] = $tab_inf;
}
}
return $tab_relation;
}
public function recupererIdSuperieur($id, $version) {
$req = 'SELECT num_nom, num_nom_retenu, num_tax_sup, rang FROM '
$req = 'SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci FROM '
.$version.' WHERE num_nom = '.$this->getBdd()->proteger($id);
$res = $this->getBdd()->recupererTous($req);
if ($res) {
$resultat = $res[0];
} else {
$resultat = 'null'; //on return null si il n'y a pas de taxon superieur
$resultat = null; //on return null si il n'y a pas de taxon superieur
}
return $resultat;
}
public function formaterIdInferieur($resultat) {
$this->recupererTableSignification('champs_api,champs_comp,correspondance_champs');
$tab_tax_inf = $this->recupererListeTaxonInf($resultat);
// Attention à l'ordre, on doit d'abord récupérer correpondance_champs avant champs_api
$this->recupererTableSignification('correspondance_champs,champs_api,champs_comp');
$tab_relation = null;
//on commence le formatage
if (($resultat) != '' ) {
if (($resultat) != array()) {
foreach ($resultat as $tab) {
$this->resultat_req = $tab;
$this->afficherNomHrefRetenu($tab, $num_nom);
$num = $tab['num_nom'];
$this->afficherNomHrefRetenu($tab, $num);
$this->afficherDonnees('rang', $tab['rang']);
$tab_inf[$num] = $this->table_retour;
$this->table_retour = array(); //on vide le tableau table_retour
$tab_inf[$num]['nom_sci'] = $tab['nom_sci'];
$tab_inf[$num]['num_nom'] = $tab['num_nom'];
$this->table_retour = array();
}
$tab_relation[$this->num_nom_taxon] = $tab_inf;
}
461,7 → 472,7
if ($res) {
$resultat = $res;
} else {
$resultat = array(); //on return un tableau vide s'il n'y a pas de taxon inférieurs
$resultat = array(); //on retourne un tableau vide s'il n'y a pas de taxon inférieurs
}
return $resultat;
}