Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 1186 Rev 1253
Line 156... Line 156...
156
				? new NomsVernaculaires(Config::get(Registre::get('parametres.referentiel').'.referentielVerna')) 
156
				? new NomsVernaculaires(Config::get(Registre::get('parametres.referentiel').'.referentielVerna')) 
157
				: new Noms(Registre::get('parametres.referentiel'));
157
				: new Noms(Registre::get('parametres.referentiel'));
158
		$approche = '';
158
		$approche = '';
159
		$res = $noms->getRechercheEtendue($this->nom, $this->type_resultat);
159
		$res = $noms->getRechercheEtendue($this->nom, $this->type_resultat);
160
		$form = I18n::get('Recherche-form-nom');
160
		$form = I18n::get('Recherche-form-nom');
-
 
161
 
161
		if ($res == false || $res['entete']['total'] === 0) { // recherche nom approché
162
		if ($res == false || $res['entete']['total'] === 0) { // recherche nom approché
162
			$approche = $this->rechercherNomApproche($noms);
163
			$approche = $this->rechercherNomApproche($noms);
163
		} elseif ($res['entete']['total'] == 1 || $this->acces_fiche) { // renvoie à la fiche
164
		} elseif ($res['entete']['total'] == 1 || $this->acces_fiche) { // renvoie à la fiche
164
			$approche = $this->traiterAccesFiche($res);
165
			$approche = $this->traiterAccesFiche($res);
165
		} else { // affiche les résultats
166
		} else { // affiche les résultats
Line 168... Line 169...
168
			$approche = 'ok';
169
			$approche = 'ok';
169
			if ($res['entete']['total'] < 3) { // si moins de 16 noms affiche en plus un nom approché
170
			if ($res['entete']['total'] < 3) { // si moins de 16 noms affiche en plus un nom approché
170
				$approche = $this->rechercherNomApproche($noms);
171
				$approche = $this->rechercherNomApproche($noms);
171
			}
172
			}
172
		}
173
		}
-
 
174
		
-
 
175
		// suppression des nomps en doublons + du nom déjà dans le moteur de recherche
-
 
176
		// TODO: comprendre d'ou viennent les noms en doublons. Peut-être une histoire de noms similaires avec un nom d'auteur
-
 
177
		// différent, qui une fois supprimé se retrouvent à être les même ? 
-
 
178
		if(is_array($approche)) {
-
 
179
			$approche_sans_doublons = array();
-
 
180
			foreach($approche as $element) {
-
 
181
				if(!in_array($element, $approche_sans_doublons) && $element['nom'] != $this->nom) {
-
 
182
					$approche_sans_doublons[] = $element;
-
 
183
				}
-
 
184
			}
-
 
185
			$approche = $approche_sans_doublons;
-
 
186
		}
173
		return $approche;
187
		return $approche;
174
	}
188
	}
Line 175... Line 189...
175
	
189
	
176
	private function traiterAccesFiche($res) {
190
	private function traiterAccesFiche($res) {