Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 53 → Rev 54

/trunk/modules/recherche_simple/RechercheSimple.php
35,15 → 35,21
}
public function executerRechercheNom() {
if ($_GET['eflore_nom'] == '') {
if (strlen($_GET['eflore_nom']) < 3) {
$donnees['information'] = 'Veuillez saisir un radical contenant au moins 3 caractères alphabétiques !';
} elseif ($_GET['eflore_type_nom'] == 'nom_vernaculaire') {
$noms = new NomsVernaculaires(Config::get('referentielVerna'));
$donnees['nom_approche'] = $this->rechercherNom($noms);
} else {
$noms = new Noms(Registre::get('parametres.referentiel'));
$donnees['nom_approche'] = $this->rechercherNom($noms);
$noms = ($_GET['eflore_type_nom'] == 'nom_vernaculaire')
? new NomsVernaculaires(Config::get('referentielVerna'))
: new Noms(Registre::get('parametres.referentiel'));
$presence = $this->rechercherNom($noms);
if ($presence == '') {
$donnees['information'] = 'Nom inconnu';
} elseif ($presence != 'ok') {
$donnees['nom_approche'] = $presence;
}
}
if (isset($donnees)) {
$donnees['eflore_type_nom'] = $_GET['eflore_type_nom'];
$donnees['i18n'] = I18n::get('Recherche-accueil');
51,29 → 57,31
$donnees['i18n'] = I18n::get('Recherche-form-nom');
$donnees['url_js'] = Config::get('url_js');
$donnees['nom'] = $_GET['eflore_nom'];
$donnees['form_nom'] = $this->getVue('form_nom', $donnees);
$this->setSortie(self::RENDU_CORPS, $this->getVue('recherche_accueil', $donnees));
} else {
print_r($_GET['eflore_nom']);
// envoyerResultat;
}
}
public function rechercherNom($noms) {
$noms_approches = '';
private function rechercherNom($noms) {
$approche = '';
$res = $noms->getRechercheEtendue($_GET['eflore_nom']); //print_r($res);
if ($res == false || $res->entete->total == 0) {
$res = $noms->getRechercheFloue($_GET['eflore_nom']);
if (!($res == false || $res->entete->total == 0)) {
$res = (array) $res->resultat;
$noms_appr = array_shift($res); //print_r($noms_appr);
/*foreach ($res->resultat as $id=>$nom) {
$noms_approches[$id]['nom'] = ($_GET['eflore_type_nom'] == 'nom_vernaculaire') ? $nom->nom : $nom->nom_sci;
$noms_approches[$id]['url'] = $nom->href;
}*/
$liste = (array) $res->resultat;
$nom_proche = array_shift($liste);
$approche = ($_GET['eflore_type_nom'] == 'nom_vernaculaire') ? $nom_proche->nom : $nom_proche->nom_sci;
}
} else {
$approche = 'ok';
}
return $noms_approches;
return $approche;
}
}
?>
/trunk/modules/recherche_simple/squelettes/form_nom.tpl.html
6,7 → 6,7
<tr>
<td>
<label for="eflore_nom"><?=($eflore_type_nom == 'nom_scientifique') ? $i18n['ns'] : $i18n['nv'];?></label>
<input id="eflore_nom" name="eflore_nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" />
<input id="eflore_nom" name="eflore_nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" <?php if(isset($nom)) echo 'value="'.$nom.'"';?> />
</td>
<td>
<ul>
32,7 → 32,7
</form>
 
<?php if (isset($nom_approche)) : ?>
<p id="efr-ortho-approche"> <span class="erreur"><?=$i18n['orthographe'];?></span><a href="<?=$nom_approche_url;?>"><?php print_r($nom_approche);?></a></p>
<p id="efr-ortho-approche"> <span class="erreur"><?=$i18n['orthographe'];?></span><a href="<?=$nom_approche;?>"><?=$nom_approche;?></a></p>
<?php endif; ?>
<?php if (isset($information)) : ?>
<p id="information"><?=$information?></p>