Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 53 Rev 54
Line 33... Line 33...
33
		
33
		
34
		return $this->getVue('form_nom', $donnees);
34
		return $this->getVue('form_nom', $donnees);
Line 35... Line 35...
35
	}
35
	}
36
	
36
	
37
	public function executerRechercheNom() {
37
	public function executerRechercheNom() {
38
		if ($_GET['eflore_nom'] == '') {
-
 
39
			$donnees['information'] = 'Veuillez saisir un radical contenant au moins 3 caractères alphabétiques !';
-
 
40
		} elseif ($_GET['eflore_type_nom'] == 'nom_vernaculaire') {
-
 
41
			$noms = new NomsVernaculaires(Config::get('referentielVerna'));
38
		if (strlen($_GET['eflore_nom']) < 3) {
-
 
39
			$donnees['information'] = 'Veuillez saisir un radical contenant au moins 3 caractères alphabétiques !';
-
 
40
		} else {
42
			$donnees['nom_approche'] = $this->rechercherNom($noms);
41
			$noms = ($_GET['eflore_type_nom'] == 'nom_vernaculaire') 
43
		} else {
42
				? new NomsVernaculaires(Config::get('referentielVerna')) 
-
 
43
				: new Noms(Registre::get('parametres.referentiel'));
-
 
44
			$presence = $this->rechercherNom($noms);
-
 
45
			if ($presence == '') {
-
 
46
				$donnees['information'] = 'Nom inconnu';
-
 
47
			} elseif ($presence != 'ok') {
44
			$noms = new Noms(Registre::get('parametres.referentiel'));
48
				$donnees['nom_approche'] = $presence;
-
 
49
			}
-
 
50
		}
45
			$donnees['nom_approche'] = $this->rechercherNom($noms);
51
		
46
		}
52
		
47
		if (isset($donnees)) {
53
		if (isset($donnees)) {
48
			$donnees['eflore_type_nom'] = $_GET['eflore_type_nom'];
54
			$donnees['eflore_type_nom'] = $_GET['eflore_type_nom'];
Line 49... Line 55...
49
			$donnees['i18n'] = I18n::get('Recherche-accueil');
55
			$donnees['i18n'] = I18n::get('Recherche-accueil');
50
			$donnees['referentiel_titre'] = I18n::get('Referentiels-titres.'.Config::get('referentiel'));
56
			$donnees['referentiel_titre'] = I18n::get('Referentiels-titres.'.Config::get('referentiel'));
-
 
57
			
Line 51... Line 58...
51
			
58
			$donnees['i18n'] = I18n::get('Recherche-form-nom');
52
			$donnees['i18n'] = I18n::get('Recherche-form-nom');
59
			$donnees['url_js'] = Config::get('url_js');
53
			$donnees['url_js'] = Config::get('url_js');
60
			$donnees['nom'] = $_GET['eflore_nom'];
-
 
61
			
54
			
62
			$donnees['form_nom'] = $this->getVue('form_nom', $donnees);
55
			$donnees['form_nom'] = $this->getVue('form_nom', $donnees);
63
			$this->setSortie(self::RENDU_CORPS, $this->getVue('recherche_accueil', $donnees));
56
			$this->setSortie(self::RENDU_CORPS, $this->getVue('recherche_accueil', $donnees));
64
		} else {
Line 57... Line 65...
57
		} else {
65
			print_r($_GET['eflore_nom']);
58
			// envoyerResultat;
66
			// envoyerResultat;
59
		}
67
		}
60
	}
68
	}
61
	
69
	
62
	public function rechercherNom($noms) {
70
	private function rechercherNom($noms) {
63
		$noms_approches = '';
71
		$approche = '';
64
		$res = $noms->getRechercheEtendue($_GET['eflore_nom']); //print_r($res);
72
		$res = $noms->getRechercheEtendue($_GET['eflore_nom']); //print_r($res);
65
		if ($res == false || $res->entete->total == 0) {
-
 
66
			$res = $noms->getRechercheFloue($_GET['eflore_nom']);
73
		if ($res == false || $res->entete->total == 0) {
67
			if (!($res == false || $res->entete->total == 0)) {
-
 
68
				$res = (array) $res->resultat;
-
 
69
				$noms_appr = array_shift($res); //print_r($noms_appr);
74
			$res = $noms->getRechercheFloue($_GET['eflore_nom']);
-
 
75
			if (!($res == false || $res->entete->total == 0)) {
-
 
76
				$liste = (array) $res->resultat;
70
				/*foreach ($res->resultat as $id=>$nom) {
77
				$nom_proche = array_shift($liste); 
71
					$noms_approches[$id]['nom'] = ($_GET['eflore_type_nom'] == 'nom_vernaculaire') ? $nom->nom : $nom->nom_sci;
78
				$approche = ($_GET['eflore_type_nom'] == 'nom_vernaculaire') ? $nom_proche->nom : $nom_proche->nom_sci;
72
					$noms_approches[$id]['url'] = $nom->href;
79
			}
-
 
80
		} else {
73
				}*/
81
			$approche = 'ok';
74
			}
82
		}
75
		}
83
		return $approche;