Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 70 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 70 Rev 74
Line 31... Line 31...
31
		$donnees['i18n'] = I18n::get('Recherche-form-nom');
31
		$donnees['i18n'] = I18n::get('Recherche-form-nom');
Line 32... Line 32...
32
		
32
		
33
		return $this->getVue('form_nom', $donnees);
33
		return $this->getVue('form_nom', $donnees);
Line 34... Line 34...
34
	}
34
	}
35
	
-
 
36
	public function executerRechercheNom() {
-
 
37
		$donnees['type_nom'] = $_GET['type_nom'];
-
 
38
		$donnees['nom'] = $_GET['nom'];
-
 
39
		if (strlen($donnees['nom']) < 3) {
-
 
40
			$donnees['information'] = 'Veuillez saisir un radical contenant au moins 3 caractères alphabétiques !';
-
 
41
		} else {
-
 
42
			$noms = ($donnees['type_nom'] == 'nom_vernaculaire') 
35
	
43
				? new NomsVernaculaires(Config::get('referentielVerna')) 
-
 
44
				: new Noms(Registre::get('parametres.referentiel'));
-
 
45
			$presence = $this->rechercherNom($noms);
-
 
46
			if ($presence == '') {
-
 
47
				$donnees['information'] = 'Nom inconnu';
-
 
48
			} elseif ($presence != 'ok') {
-
 
49
				$donnees['nom_approche'] = $presence;
-
 
50
				$donnees['url_nom_approche'] = $this->obtenirUrlRechercheSimple($presence, $donnees['type_nom']);
-
 
51
			}
-
 
52
		}
36
	public function executerForm() {
53
		
37
		$donnees = Registre::get('donnees');
54
		$donnees['form_nom'] = $this->executerFormulaireNom($donnees);
38
		$donnees['form_nom'] = $this->executerFormulaireNom($donnees);
Line 55... Line -...
55
		$this->afficherAccueil($donnees);
-
 
56
	}
-
 
57
	
-
 
58
	// regarde si il y a des résultats correspondant au nom recherché sinon recherche un nom approché
-
 
59
	private function rechercherNom($noms) {
-
 
60
		$approche = '';
-
 
61
		$res = $noms->getRechercheEtendue($_GET['nom']);
-
 
62
		$form = I18n::get('Recherche-form-nom');
-
 
63
		if ($res == false || $res['entete']['total'] == 0) { // recherche nom approché
-
 
64
			$res = $noms->getRechercheFloue($_GET['nom']);
-
 
65
			if (!($res == false || $res['entete']['total'] == 0)) {
-
 
66
				$nom_proche = array_shift($res['resultat']);
-
 
67
				$approche = ($_GET['type_nom'] == 'nom_vernaculaire') ? $nom_proche['nom'] : $nom_proche['nom_sci'];
-
 
68
			}
-
 
69
		} elseif ($res['entete']['total'] == 1 || urldecode($_GET['submit']) == $form['fiche']) { // renvoie à la fiche
-
 
70
			$ids = array_keys($res['resultat']);
-
 
71
			$url = $this->obtenirUrlFiche($ids[0]);
-
 
72
			$this->redirigerVers($url);
-
 
73
		} else { // affiche les résultats
-
 
74
			$approche = 'ok';
39
		$this->afficherAccueil($donnees);
Line 75... Line 40...
75
		}
40
	}
76
		return $approche;
41
	
77
	}
42