Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 208 Rev 209
Line 48... Line 48...
48
			$conditions[] = "ns.genre = $masqueGen";
48
			$conditions[] = "ns.genre = $masqueGen";
49
		}
49
		}
50
		if ($masqueSp = $this->parametres->getMasquePourBdd('sp')) {
50
		if ($masqueSp = $this->parametres->getMasquePourBdd('sp')) {
51
			$conditions[] = "ns.epithete_sp = $masqueSp";
51
			$conditions[] = "ns.epithete_sp = $masqueSp";
52
		}
52
		}
53
 
-
 
-
 
53
		$navigation = $this->getNavigation();
54
		$requete = 'SELECT SQL_CALC_FOUND_ROWS ns.*,  '.
54
		$requete = 'SELECT SQL_CALC_FOUND_ROWS ns.*,  '.
55
						'	nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
55
			'	nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
56
						"FROM $table AS ns ".
56
			"FROM $table AS ns ".
57
						"	LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
57
			"	LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
58
						"	LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
58
			"	LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
59
		(count($conditions) > 0 ? 'WHERE ' : '').
59
			$this->getWhere($conditions).
60
		implode(' AND ', $conditions).
60
			implode(' AND ', $conditions).
61
						'ORDER BY ns.nom_sci ASC '.
61
			'ORDER BY ns.nom_sci ASC '.
62
						'LIMIT 0,100';
62
			"LIMIT $navigation ";
63
		$resultats = $this->bdd->recupererTous($requete);
63
		$resultats = $this->bdd->recupererTous($requete);
Line 64... Line 64...
64
 
64
 
65
		return $resultats;
65
		return $resultats;
Line 78... Line 78...
78
			$conditions[] = "ns.genre LIKE $masqueGen";
78
			$conditions[] = "ns.genre LIKE $masqueGen";
79
		}
79
		}
80
		if ($masqueSp = $this->parametres->getMasquePourBdd('sp')) {
80
		if ($masqueSp = $this->parametres->getMasquePourBdd('sp')) {
81
			$conditions[] = "ns.epithete_sp LIKE $masqueSp";
81
			$conditions[] = "ns.epithete_sp LIKE $masqueSp";
82
		}
82
		}
-
 
83
		$navigation = $this->getNavigation();
83
		$requete = 'SELECT SQL_CALC_FOUND_ROWS ns.*,  '.
84
		$requete = 'SELECT SQL_CALC_FOUND_ROWS ns.*,  '.
84
				'	nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
85
			'	nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
85
				"FROM $table AS ns ".
86
			"FROM $table AS ns ".
86
				"	LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
87
			"	LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
87
				"	LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
88
			"	LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
88
		(count($conditions) > 0 ? 'WHERE ' : '').
89
			$this->getWhere($conditions).
89
		implode(' AND ', $conditions).
90
			implode(' AND ', $conditions).
90
				'ORDER BY ns.nom_sci ASC '.
91
			'ORDER BY ns.nom_sci ASC '.
91
				'LIMIT 0,100';
92
			"LIMIT $navigation ";
Line 92... Line 93...
92
 
93
 
93
		$resultats = $this->bdd->recupererTous($requete);
94
		$resultats = $this->bdd->recupererTous($requete);
94
		return $resultats;
95
		return $resultats;
Line 95... Line 96...
95
	}
96
	}
96
 
97
 
97
	public function rechercherFloue() {
98
	public function rechercherFloue() {
-
 
99
		$table = $this->getTable();
98
		$table = $this->getTable();
100
		$masque = $this->parametres->getMasquePourBdd();
99
		$masque = $this->parametres->getMasquePourBdd();
101
		$navigation = $this->getNavigation();
100
		$requete = 'SELECT SQL_CALC_FOUND_ROWS ns.*,  '.
102
		$requete = 'SELECT SQL_CALC_FOUND_ROWS ns.*,  '.
101
				'	nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
103
			'	nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
102
				"FROM $table AS ns ".
104
			"FROM $table AS ns ".
-
 
105
			"	LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
103
				"	LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
106
			"	LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
104
				"	LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
107
			$this->getWhere().
105
		($masque ? 'WHERE '.
108
			($masque ?
106
					"	(SOUNDEX(ns.nom_sci) = SOUNDEX($masque)) ".
109
					"	(SOUNDEX(ns.nom_sci) = SOUNDEX($masque)) ".
107
					"	OR (SOUNDEX(REVERSE(ns.nom_sci)) = SOUNDEX(REVERSE($masque))) " : '').
110
					"	OR (SOUNDEX(REVERSE(ns.nom_sci)) = SOUNDEX(REVERSE($masque))) " : '').
108
				'ORDER BY ns.nom_sci ASC '.
111
			'ORDER BY ns.nom_sci ASC '.
109
				'LIMIT 0,100';
112
			"LIMIT $navigation ";
110
		$resultats = $this->bdd->recupererTous($requete);
113
		$resultats = $this->bdd->recupererTous($requete);
Line -... Line 114...
-
 
114
		return $resultats;
-
 
115
	}
-
 
116
 
-
 
117
	private function getNavigation() {
-
 
118
		$debut = $this->parametres->get('navigation.depart');
-
 
119
		$nbre = $this->parametres->get('navigation.limite');
-
 
120
		return "$debut,$nbre";
-
 
121
	}
-
 
122
 
-
 
123
	private function getWhere($conditions = array()) {
-
 
124
		$where = '';
-
 
125
		if ($this->ressources->getServiceNom() == 'taxons') {
-
 
126
			$where = 'WHERE ns.num_nom = ns.num_nom_retenu ';
-
 
127
		} else if (count($conditions) > 0) {
-
 
128
			$where = 'WHERE ';
-
 
129
		}
111
		return $resultats;
130
		return $where;
112
	}
131
	}
113
 
132
 
114
	public function recupererNombreNomsTotal() {
133
	public function recupererNombreNomsTotal() {
115
		$requete = 'SELECT FOUND_ROWS() AS nbre';
134
		$requete = 'SELECT FOUND_ROWS() AS nbre';