Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 369 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 369 Rev 720
Line 37... Line 37...
37
			$donnees['message']['attention'] = 'info_nb_lettres';
37
			$donnees['message']['attention'] = 'info_nb_lettres';
38
		} else {
38
		} else {
39
			$presence = $this->rechercherNom();
39
			$presence = $this->rechercherNom();
40
			if ($presence == '') { // s'il n'y a pas de nom
40
			if ($presence == '') { // s'il n'y a pas de nom
41
				$donnees['message']['attention'] = 'info_sp_abs';
41
				$donnees['message']['attention'] = 'info_sp_abs';
-
 
42
			} elseif ($presence == 'sans_correspondance') {
-
 
43
				$res = Registre::get('resultats');
-
 
44
				$id = array_keys($res['resultat']);
-
 
45
				$donnees['message']['nom_ss_corresp']['id'] = $id[0];
-
 
46
				$nom = array_shift($res['resultat']);
-
 
47
				$donnees['message']['nom_ss_corresp']['nom'] = $nom['nom_sci'];
42
			} elseif ($presence != 'ok') { // s'il y a des noms approchés
48
			} elseif ($presence != 'ok') { // s'il y a des noms approchés
43
				if (!Registre::get('resultats')) { // s'il n'y a aucun nom exact
49
				if (!Registre::get('resultats')) { // s'il n'y a aucun nom exact
44
					$donnees['message']['attention'] = 'info_sp_abs';
50
					$donnees['message']['attention'] = 'info_sp_abs';
45
				}
51
				}
46
				$donnees['message']['nom_approche'] = $presence;
52
				$donnees['message']['nom_approche'] = $presence;
Line 63... Line 69...
63
		$res = $noms->getRechercheEtendue($this->nom, $this->type_resultat);
69
		$res = $noms->getRechercheEtendue($this->nom, $this->type_resultat);
64
		$form = I18n::get('Recherche-form-nom');
70
		$form = I18n::get('Recherche-form-nom');
65
		if ($res == false || $res['entete']['total'] == 0) { // recherche nom approché
71
		if ($res == false || $res['entete']['total'] == 0) { // recherche nom approché
66
			$approche = $this->rechercherNomApproche($noms);
72
			$approche = $this->rechercherNomApproche($noms);
67
		} elseif ($res['entete']['total'] == 1 || $this->submit == $form['fiche']) { // renvoie à la fiche
73
		} elseif ($res['entete']['total'] == 1 || $this->submit == $form['fiche']) { // renvoie à la fiche
68
			$ids = array_keys($res['resultat']);
-
 
69
			$url = $this->urls->obtenirUrlFiche($ids[0], $this->type_nom, $this->nom);
-
 
70
			$this->redirigerVers($url);
74
			$approche = $this->traiterAccesFiche($res);
71
		} else { // affiche les résultats
75
		} else { // affiche les résultats
72
			$res['type'] = $this->type_nom;
76
			$res['type'] = $this->type_nom;
73
			Registre::set('resultats', $res);
77
			Registre::set('resultats', $res);
74
			$approche = 'ok';
78
			$approche = 'ok';
75
			if ($res['entete']['total'] < 3) { // si moins de 16 noms affiche en plus un nom approché
79
			if ($res['entete']['total'] < 3) { // si moins de 16 noms affiche en plus un nom approché
Line 77... Line 81...
77
			}
81
			}
78
		}
82
		}
79
		return $approche;
83
		return $approche;
80
	}
84
	}
Line -... Line 85...
-
 
85
	
-
 
86
	private function traiterAccesFiche($res) {
-
 
87
		$ids = array_keys($res['resultat']);
-
 
88
		if ($this->type_nom == 'nom_vernaculaire') {
-
 
89
			$id = explode(':',$res['resultat'][$ids[0]]['nom_retenu.code']);
-
 
90
			$id = $id[1];
-
 
91
		} else {
-
 
92
			if ($res['resultat'][$ids[0]]['retenu'] == 'absent') { // dans le cas d'un nom sans correspondance
-
 
93
				$res['type'] = $this->type_nom;
-
 
94
				Registre::set('resultats', $res);
-
 
95
				$approche = 'sans_correspondance';
-
 
96
				return $approche;
-
 
97
			} else {
-
 
98
				$id = $ids[0];
-
 
99
			}
-
 
100
		}
-
 
101
		$url = $this->urls->obtenirUrlFiche($id, $this->type_nom, $this->nom);
-
 
102
		$this->redirigerVers($url);
-
 
103
	}
81
	
104
	
82
	private function rechercherNomApproche($noms) {
105
	private function rechercherNomApproche($noms) {
83
		$approche = '';
106
		$approche = '';
84
		$res = $noms->getRechercheFloue($this->nom);
107
		$res = $noms->getRechercheFloue($this->nom);
85
		if (!($res == false || $res['entete']['total'] == 0)) {
108
		if (!($res == false || $res['entete']['total'] == 0)) {
Line 92... Line 115...
92
		return $approche;
115
		return $approche;
93
	}
116
	}
Line 94... Line 117...
94
	
117
	
95
	
118
	
96
	private function capturerParametres() {
119
	private function capturerParametres() {
97
		if (isset($_GET['nom'])) {
120
		if (isset($_REQUEST['nom'])) {
98
			$this->nom = $_GET['nom'];
121
			$this->nom = $_REQUEST['nom'];
99
		}
122
		}
100
		if (isset($_GET['type_nom'])) {
123
		if (isset($_GET['type_nom'])) {