437,16 → 437,45 |
return $retour_id_hom; |
} |
|
public function obtenirSynonymesParNumNomAvecInfosFlore($num_nom, $version='1_02') { |
|
$champs_flore = 'flore_bonnier_num, flore_bonnier_rem,'. |
'flore_cnrs_num, flore_cnrs_rem '. |
'flore_fe_num, flore_fe_rem '. |
'flore_coste_num, flore_coste_rem '. |
'flore_fh_num, flore_fh_rem '. |
'flore_fournier_num, flore_fournier_rem'; |
|
$requete = 'SELECT num_nom, nom_sci, '.$champs_flore.' '. |
'FROM bdtfx_v'.$version.' '. |
'WHERE num_nom_retenu = '. |
'('. |
'SELECT num_nom_retenu FROM bdtfx_v1_02 WHERE num_nom = "'.$num_nom.'"'. |
')'; |
|
return $this->getBdd()->recupererTous($requete); |
} |
|
public function formaterIdFlores($resultat) { |
$this->recupererTableSignification('correspondance_champs,champs_api,champs_comp,noms_projets'); |
$this->resultat_req = $resultat; |
$id = array_shift($resultat); |
$reponse['entete']['id'] = $id; |
foreach ($resultat as $flores => $valeur) { |
$synonymes_flores = $this->obtenirSynonymesParNumNomAvecInfosFlore($this->ressources[0]); |
if(is_array($synonymes_flores)) { |
foreach ($synonymes_flores as $synonyme) { |
$nom_sci = $synonyme['nom_sci']; |
$num_nom = $synonyme['num_nom']; |
unset($synonyme['nom_sci']); |
unset($synonyme['num_nom']); |
foreach ($synonyme as $flores => $valeur) { |
if ($valeur != '' && $valeur != '0') { |
$this->afficherInfosFlore($resultat, $flores, $valeur); |
$this->afficherInfosFlore($synonyme, $flores, $valeur, $nom_sci, $num_nom); |
} |
} |
} |
} |
|
if ($this->table_retour != array()) { |
$reponse['resultat'] = $this->table_retour; |
$this->table_retour = array(); |
456,32 → 485,43 |
return $reponse; |
} |
|
public function afficherInfosFlore(&$resultat, $flores, $valeur) { |
public function getNomCompletFlore($flore) { |
return Config::get($flore.'_texte'); |
} |
|
public function afficherInfosFlore(&$resultat, $flores, $valeur, $nom_sci, $num_nom) { |
$flore = substr($flores,0,strrpos($flores, '_')); |
$projet = $this->noms_projets[$flore]; |
|
//TODO voir si l'on peut factoriser les affectations à la table retour |
// et simplifier ce gros pavé |
if (strrpos($flores, 'num') !== false) { |
if (preg_match('/^([0-9]+)(?:[.]syn[^a-z]*|(.*))?$/', $valeur, $match)) { |
$this->table_retour[$flore]['id'] = $match[1]; |
$this->table_retour[$num_nom][$flore]['id'] = $match[1]; |
if ($projet == 'coste') { |
$this->table_retour[$flore]['href'] = $this->ajouterHrefAutreProjet('noms', 'nn_coste:', $match[1], $projet); |
$this->table_retour[$num_nom][$flore]['href'] = $this->ajouterHrefAutreProjet('noms', 'nn_coste:', $match[1], $projet); |
} |
if (isset($match[2]) && $match[2] != '') $this->table_retour[$flore]['cle'] = $match[2]; |
if (isset($match[2]) && $match[2] != '') $this->table_retour[$num_nom][$flore]['cle'] = $match[2]; |
$this->table_retour[$num_nom][$flore]['nom_flore'] = $this->getNomCompletFlore($flore); |
$this->table_retour[$num_nom][$flore]['nom_sci'] = $nom_sci; |
} |
if (isset($resultat[$flore.'_rem']) && !empty($resultat[$flore.'_rem'])) { |
$this->table_retour[$flore]['remarque'] = $resultat[$flore.'_rem']; |
$this->table_retour[$num_nom][$flore]['remarque'] = $resultat[$flore.'_rem']; |
$this->table_retour[$num_nom][$flore]['nom_flore'] = $this->getNomCompletFlore($flore); |
$this->table_retour[$num_nom][$flore]['nom_sci'] = $nom_sci; |
unset($resultat[$flore.'_rem']); |
} |
} elseif (strrpos($flores,'belge') !== false) { |
if (preg_match('/^([0-9]+) (R|S)?$/', $valeur, $match)) { |
if (isset($match[2])) $type = ($match[2] == 'R') ? 'taxons' : 'synonyme'; |
$this->table_retour[$flore]['page'] = $match[1]; |
$this->table_retour[$flore]['type'] = $type; |
$this->table_retour[$num_nom][$flore]['page'] = $match[1]; |
$this->table_retour[$num_nom][$flore]['type'] = $type; |
$this->table_retour[$num_nom][$flore]['nom_flore'] = $this->getNomCompletFlore($flore); |
$this->table_retour[$num_nom][$flore]['nom_sci'] = $nom_sci; |
} |
} |
} |
|
|
|
//+---------------------concerne les resultats pour des requetes de type /noms avec ou sans paramètres-------+ |
|
public function formaterNoms($resultat) { |