23,10 → 23,7 |
if (strlen($donnees['nom']) < 3) { |
$donnees['information'] = 'Veuillez saisir un radical contenant au moins 3 caractères alphabétiques !'; |
} else { |
$noms = ($donnees['type_nom'] == 'nom_vernaculaire') |
? new NomsVernaculaires(Config::get(Registre::get('parametres.referentiel').'.referentielVerna')) |
: new Noms(Registre::get('parametres.referentiel')); |
$presence = $this->rechercherNom($noms); |
$presence = $this->rechercherNom(); |
if ($presence == '') { |
$donnees['information'] = 'Nom inconnu'; |
} elseif ($presence != 'ok') { |
36,22 → 33,22 |
} |
Registre::set('donneesMoteur', $donnees); |
$this->executerAction('RechercheSimple', 'executerForm'); |
if ($presence == 'ok') { |
if (Registre::get('resultats')) { |
$this->executerAction('Resultat', 'executerResultat'); |
} |
} |
|
// regarde si il y a des résultats correspondant au nom recherché sinon recherche un nom approché |
private function rechercherNom($noms) { |
// $noms classe métier nom ou nom |
private function rechercherNom() { |
$noms = ($this->type_nom == 'nom_vernaculaire') |
? new NomsVernaculaires(Config::get(Registre::get('parametres.referentiel').'.referentielVerna')) |
: new Noms(Registre::get('parametres.referentiel')); |
$approche = ''; |
$res = $noms->getRechercheEtendue($this->nom); |
$form = I18n::get('Recherche-form-nom'); |
if ($res == false || $res['entete']['total'] == 0) { // recherche nom approché |
$res = $noms->getRechercheFloue($this->nom); |
if (!($res == false || $res['entete']['total'] == 0)) { |
$nom_proche = array_shift($res['resultat']); |
$approche = ($this->type_nom == 'nom_vernaculaire') ? $nom_proche['nom'] : $nom_proche['nom_sci']; |
} |
$approche = $this->rechercherNomApproche($noms); |
} elseif ($res['entete']['total'] == 1 || $this->submit == $form['fiche']) { // renvoie à la fiche |
$ids = array_keys($res['resultat']); |
$url = $this->obtenirUrlFiche($ids[0]); |
60,10 → 57,23 |
$res['type'] = $this->type_nom; |
Registre::set('resultats', $res); |
$approche = 'ok'; |
if ($res['entete']['total'] < 16) { // si moins de 16 noms affiche en plus un nom approché |
$approche = $this->rechercherNomApproche($noms); |
} |
} |
return $approche; |
} |
|
private function rechercherNomApproche($noms) { |
$approche = ''; |
$res = $noms->getRechercheFloue($this->nom); |
if (!($res == false || $res['entete']['total'] == 0)) { |
$nom_proche = array_shift($res['resultat']); |
$approche = ($this->type_nom == 'nom_vernaculaire') ? $nom_proche['nom'] : $nom_proche['nom_sci']; |
} |
return $approche; |
} |
|
private function capturerParametres() { |
if (isset($_GET['nom'])) { |
$this->nom = $_GET['nom']; |