Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 639 → Rev 640

/trunk/services/modules/0.1/sptb/Statuts.php
87,16 → 87,39
return $this->bdd->recupererTous($requete);
}
private function obtenirStatuts() {
private function obtenirStatuts() {
$nn_demande = $this->parametres['masque.nn'];
$conditions_taxons = array();
$conditions_taxons = $this->obtenirNumNomTaxonsSuperieurs($nn_demande);
$conditions_taxons[] = $this->bdd->proteger($nn_demande);
$requete = "SELECT * FROM sptb_especes_v".$this->table_version.' '.
"WHERE ".
"num_nom = ".$this->bdd->proteger($this->parametres['masque.nn'])."";
"WHERE num_nom_retenu IN (".implode(', ', $conditions_taxons).") OR ".
"num_nom IN (".implode(', ', $conditions_taxons).") ";
$statuts = $this->bdd->recuperer($requete);
$statuts = $this->formaterRetour($statuts);
return $statuts;
}
private function obtenirNumNomTaxonsSuperieurs($nn_demande) {
$nn_taxons_sup = array();
// TODO: ceci ramène trop de champs alors que l'on a besoin que du numéro nomenclatural
// et il y a peut-être un meilleur moyen que ramener la hierarchie des taxons supérieurs
// mais pour le moment ça marche et c'est assez rapide
$url = $this->ajouterHrefAutreProjet('taxons', $nn_demande, '/relations/superieurs','bdtfx');
$classification = $this->consulterHref($url);
$classification = is_object($classification) ? get_object_vars($classification) : array();
if(isset($classification[$nn_demande])) {
$classification_nn_demande = get_object_vars($classification[$nn_demande]);
$tab_nn_demandes = array_keys($classification_nn_demande);
$nn_taxons_sup = array_map(array($this->bdd,'proteger'), $tab_nn_demandes);
}
return $nn_taxons_sup;
}
//+---------------------------FONCTIONS DE FORMATAGE---------------------------------------------------------+
 
private function formaterRetour($statuts_taxon) {
131,12 → 154,16
private function formaterStatutsTaxon($statuts_taxon) {
$statuts_formates = array();
unset($statuts_taxon['num_nom']);
unset($statuts_taxon['nom_sci']);
$lois_statuts = array();
foreach ($statuts_taxon as $champ => $statut) {
if($statut == "1") {
$lois_statuts[] = $champ;
if(is_array($statuts_taxon)) {
unset($statuts_taxon['num_nom']);
unset($statuts_taxon['num_nom_retenu']);
unset($statuts_taxon['nom_sci']);
foreach ($statuts_taxon as $champ => $statut) {
if($statut == "1") {
$lois_statuts[] = $champ;
}
}
}