Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 1107 Rev 1195
Line 124... Line 124...
124
		}
124
		}
125
	}
125
	}
Line 126... Line 126...
126
 
126
 
127
	public function ajouterFiltreMasque($nom_champ, $valeur) {
127
	public function ajouterFiltreMasque($nom_champ, $valeur) {
-
 
128
		if ($nom_champ == 'num_taxon') { // si il s'agit d'un chiffre
128
		if ($nom_champ == 'num_taxon') { // si il s'agit d'un chiffre
129
			$valeur = implode(',', array_map(array($this->getBdd(), 'proteger'), explode(',',$valeur)));
129
			$this->requete_condition[] = $nom_champ.' = '.$this->getBdd()->proteger($valeur);
130
			$this->requete_condition[] = $nom_champ.' IN ('.$valeur.')';
130
		} else {
131
		} else {
131
			if ($this->recherche == 'floue') {
132
			if ($this->recherche == 'floue') {
132
				$this->requete_condition[] = '(SOUNDEX('.$nom_champ.') = SOUNDEX(\''.$valeur.'\')'
133
				$this->requete_condition[] = '(SOUNDEX('.$nom_champ.') = SOUNDEX(\''.$valeur.'\')'
133
					.' OR SOUNDEX(REVERSE('.$nom_champ.')) = SOUNDEX(REVERSE(\''.$valeur.'\'))) ';
134
					.' OR SOUNDEX(REVERSE('.$nom_champ.')) = SOUNDEX(REVERSE(\''.$valeur.'\'))) ';
Line 149... Line 150...
149
				$this->traiterRessourceId(); // ajoute condition id=#valeur
150
				$this->traiterRessourceId(); // ajoute condition id=#valeur
150
				if (isset($this->ressources[1]) && !empty($this->ressources[1])) {
151
				if (isset($this->ressources[1]) && !empty($this->ressources[1])) {
151
					$this->traiterRessourceChamp(); //modifie requete_champ ou requete_condition
152
					$this->traiterRessourceChamp(); //modifie requete_champ ou requete_condition
152
				}
153
				}
153
			}
154
			}
154
		} else { //rajoute distinct pour ne pas avoir plusieurs fois le même nom
-
 
155
			$this->requete_champ = array('distinct(nva.num_nom_vernaculaire)', 'nva.nom_vernaculaire ');
-
 
156
		}
155
		}
157
	}
156
	}
Line 158... Line 157...
158
 
157
 
159
	//requete : /noms-vernaculaires/#id (ex : /noms-vernaculaires/7)
158
	//requete : /noms-vernaculaires/#id (ex : /noms-vernaculaires/7)
Line 200... Line 199...
200
		$requete = ' SELECT '.$this->formerRequeteChamp().
199
		$requete = ' SELECT '.$this->formerRequeteChamp().
201
		', CASE nva.code_langue WHEN "fra" THEN 1 ELSE 0 END AS tri '.
200
		', CASE nva.code_langue WHEN "fra" THEN 1 ELSE 0 END AS tri '.
202
			' FROM '.str_replace('nva', 'nva_index', $this->table).' inva'.
201
			' FROM '.str_replace('nva', 'nva_index', $this->table).' inva'.
203
			' LEFT JOIN '.$this->table.' nva ON nva.num_nom_vernaculaire = inva.num_nom_vernaculaire '
202
			' LEFT JOIN '.$this->table.' nva ON nva.num_nom_vernaculaire = inva.num_nom_vernaculaire '
204
			.$this->formerRequeteCondition().
203
			.$this->formerRequeteCondition().
-
 
204
			' GROUP BY nva.num_nom_vernaculaire '.
205
			' ORDER BY tri DESC, nva.nom_vernaculaire ASC '
205
			' ORDER BY tri DESC, nva.nom_vernaculaire ASC '
206
			.$this->formerRequeteLimite();
206
			.$this->formerRequeteLimite();
207
		return $requete;
207
		return $requete;
208
	}
208
	}
Line 293... Line 293...
293
	public function ajouterJsonResultatNV($resultat) {
293
	public function ajouterJsonResultatNV($resultat) {
294
		foreach ($resultat as $tab) {
294
		foreach ($resultat as $tab) {
295
			foreach ($tab as $key => $valeur) {
295
			foreach ($tab as $key => $valeur) {
296
				if ($valeur != '') {
296
				if ($valeur != '') {
297
					switch ($key) {
297
					switch ($key) {
-
 
298
						case 'num_taxon'				: $this->table_retour['num_taxon'] = $valeur;								break;
298
						case 'num_nom_vernaculaire'				: $num = $valeur;								break;
299
						case 'num_nom_vernaculaire'				: $num = $valeur;								break;
299
						case 'nom_vernaculaire'	: $this->table_retour['nom'] = $valeur;			break;
300
						case 'nom_vernaculaire'	: $this->table_retour['nom'] = $valeur;			break;
300
						default					:												break;
301
						default					:												break;
301
					}
302
					}
302
				}
303
				}