39,6 → 39,12 |
$presence = $this->rechercherNom(); |
if ($presence == '') { // s'il n'y a pas de nom |
$donnees['message']['attention'] = 'info_sp_abs'; |
} elseif ($presence == 'sans_correspondance') { |
$res = Registre::get('resultats'); |
$id = array_keys($res['resultat']); |
$donnees['message']['nom_ss_corresp']['id'] = $id[0]; |
$nom = array_shift($res['resultat']); |
$donnees['message']['nom_ss_corresp']['nom'] = $nom['nom_sci']; |
} elseif ($presence != 'ok') { // s'il y a des noms approchés |
if (!Registre::get('resultats')) { // s'il n'y a aucun nom exact |
$donnees['message']['attention'] = 'info_sp_abs'; |
65,9 → 71,7 |
if ($res == false || $res['entete']['total'] == 0) { // recherche nom approché |
$approche = $this->rechercherNomApproche($noms); |
} elseif ($res['entete']['total'] == 1 || $this->submit == $form['fiche']) { // renvoie à la fiche |
$ids = array_keys($res['resultat']); |
$url = $this->urls->obtenirUrlFiche($ids[0], $this->type_nom, $this->nom); |
$this->redirigerVers($url); |
$approche = $this->traiterAccesFiche($res); |
} else { // affiche les résultats |
$res['type'] = $this->type_nom; |
Registre::set('resultats', $res); |
79,6 → 83,25 |
return $approche; |
} |
|
private function traiterAccesFiche($res) { |
$ids = array_keys($res['resultat']); |
if ($this->type_nom == 'nom_vernaculaire') { |
$id = explode(':',$res['resultat'][$ids[0]]['nom_retenu.code']); |
$id = $id[1]; |
} else { |
if ($res['resultat'][$ids[0]]['retenu'] == 'absent') { // dans le cas d'un nom sans correspondance |
$res['type'] = $this->type_nom; |
Registre::set('resultats', $res); |
$approche = 'sans_correspondance'; |
return $approche; |
} else { |
$id = $ids[0]; |
} |
} |
$url = $this->urls->obtenirUrlFiche($id, $this->type_nom, $this->nom); |
$this->redirigerVers($url); |
} |
|
private function rechercherNomApproche($noms) { |
$approche = ''; |
$res = $noms->getRechercheFloue($this->nom); |
94,8 → 117,8 |
|
|
private function capturerParametres() { |
if (isset($_GET['nom'])) { |
$this->nom = $_GET['nom']; |
if (isset($_REQUEST['nom'])) { |
$this->nom = $_REQUEST['nom']; |
} |
if (isset($_GET['type_nom'])) { |
$this->type_nom = $_GET['type_nom']; |