Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 958 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 958 Rev 967
1
<?php
1
<?php
2
 
2
 
3
/**
3
/**
4
* Classe InformationsTaxonsSup.php permet de faire des requetes  pour les rangs superieurs de baseflor
4
* Classe InformationsTaxonsSup.php permet de faire des requetes  pour les rangs superieurs de baseflor
5
*  du référentiel BDTFX  et avec un numéro nomenclatural ( différent de 0 ). 
5
*  du référentiel BDTFX  et avec un numéro nomenclatural ( différent de 0 ). 
6
*  fin d'url possibles :
6
*  fin d'url possibles :
7
*  
7
*  
8
*  /informations/#bdnt.nn:#num_nomen?champs=ecologie --> retourne champs ecologiques pour un BDNT et un num_nomen
8
*  /informations/#bdnt.nn:#num_nomen?champs=ecologie --> retourne champs ecologiques pour un BDNT et un num_nomen
9
*  
9
*  
10
*
10
*
11
* Encodage en entrée : utf8
11
* Encodage en entrée : utf8
12
* Encodage en sortie : utf8
12
* Encodage en sortie : utf8
13
* @package eflore-projets
13
* @package eflore-projets
14
* @author Mathilde SALTHUN-LASSALLE <mathilde@tela-botanica.org>
14
* @author Mathilde SALTHUN-LASSALLE <mathilde@tela-botanica.org>
15
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
15
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
16
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
16
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
17
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
17
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
18
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
18
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
19
* @version 1.0
19
* @version 1.0
20
* @copyright 1999-2011 Tela Botanica (accueil@tela-botanica.org)
20
* @copyright 1999-2011 Tela Botanica (accueil@tela-botanica.org)
21
*/
21
*/
22
 
22
 
23
class InformationsTaxonsSup extends Commun{
23
class InformationsTaxonsSup extends Commun{
24
	
24
	
25
	protected $table = "";
25
	protected $table = "";
26
	private $champs_ontologiques = array();
26
	private $champs_ontologiques = array();
27
	private $format_reponse = 'informations';
27
	private $format_reponse = 'informations';
28
	protected $serviceNom = 'informations';
28
	protected $serviceNom = 'informations';
29
	private $retour_format = 'max';
29
	private $retour_format = 'max';
30
	private $Bdd;
30
	private $Bdd;
31
	private $requete_condition = "";
31
	private $requete_condition = "";
32
	private $champs_recherches = '*';
32
	private $champs_recherches = '*';
33
	
33
	
34
	public function consulter($ressources, $parametres) {
34
	public function consulter($ressources, $parametres) {
35
		$this->ressources = $ressources;
35
		$this->ressources = $ressources;
36
		$this->parametres = $parametres;
36
		$this->parametres = $parametres;
37
		$this->traiterParametres();
37
		$this->traiterParametres();
38
		$this->definirTables();
38
		$this->definirTables();
39
		$this->traiterRessources();
39
		$this->traiterRessources();
40
		$resultats = '';
40
		$resultats = '';
41
	foreach ($this->table_version as $version) {
41
	foreach ($this->table_version as $version) {
42
			$this->table = $version;
42
			$this->table = $version;
43
			$requete = $this->assemblerLaRequete();
43
			$requete = $this->assemblerLaRequete();
44
			$resultat = $this->Bdd->recupererTous($requete);
44
			$resultat = $this->Bdd->recupererTous($requete);
45
			$versionResultat = $this->analyserResultat($resultat);
45
			$versionResultat = $this->analyserResultat($resultat);
46
			if (count($this->table_version) > 1) {
46
			if (count($this->table_version) > 1) {
47
				$resultats[$version] = $versionResultat;
47
				$resultats[$version] = $versionResultat;
48
			} else {
48
			} else {
49
				$resultats = $versionResultat;
49
				$resultats = $versionResultat;
50
			}
50
			}
51
		}
51
		}
52
		return $resultats;
52
		return $resultats;
53
	}
53
	}
54
	
54
	
55
	public function analyserResultat($resultat) {
55
	public function analyserResultat($resultat) {
56
		$versionResultat = null;
56
		$versionResultat = null;
57
		if ($resultat == '') {
57
		if ($resultat == '') {
58
			$message = 'La requête SQL formée comporte une erreur!';
58
			$message = 'La requête SQL formée comporte une erreur!';
59
			$code = RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE;
59
			$code = RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE;
60
			throw new Exception($message, $code);
60
			throw new Exception($message, $code);
61
		} elseif ($resultat) {
61
		} elseif ($resultat) {
62
			$versionResultat = $this->retournerResultatFormate($resultat);
62
			$versionResultat = $this->retournerResultatFormate($resultat);
63
		}
63
		}
64
		return $versionResultat;
64
		return $versionResultat;
65
	}
65
	}
66
	
66
	
67
	public function __construct(Conteneur $Conteneur) {
67
	public function __construct(Conteneur $Conteneur) {
68
		$this->Bdd = $Conteneur->getBdd();
68
		$this->Bdd = $Conteneur->getBdd();
69
	}
69
	}
70
	
70
	
71
	//+--------------------------traitement ressources ou paramètres  -------------------------------------------+
71
	//+--------------------------traitement ressources ou paramètres  -------------------------------------------+
72
		
72
		
73
	public function traiterRessources() {
73
	public function traiterRessources() {
74
			if(preg_match('/^(.+)\.nn:([0-9]+)$/', $this->ressources[0], $retour)==1){
74
			if(preg_match('/^(.+)\.nn:([0-9]+)$/', $this->ressources[0], $retour)==1){
75
				switch ($retour[1]) {
75
				switch ($retour[1]) {
76
					case 'bdtfx' :
76
					case 'bdtfx' :
77
						$this->requete_condition[] = "num_nomen = ".$retour[2]." AND bdnt = 'bdtfx' ";
77
						$this->requete_condition[] = "num_nomen = ".$retour[2]." AND bdnt = 'bdtfx' ";
78
						break;
78
						break;
79
					default :
79
					default :
80
						$e = 'Erreur dans l\'url de votre requête : </br> Le référentiel " '
80
						$e = 'Erreur dans l\'url de votre requête : </br> Le référentiel " '
81
					.$retour[1].' " n\'existe pas.';
81
					.$retour[1].' " n\'existe pas.';
82
					throw new Exception($e, RestServeur::HTTP_CODE_MAUVAISE_REQUETE);
82
					throw new Exception($e, RestServeur::HTTP_CODE_MAUVAISE_REQUETE);
83
					break;
83
					break;
84
				}
84
				}
85
	
85
	
86
			}
86
			}
87
			
87
			
88
	}
88
	}
89
	
89
	
90
	//+---- paramètres ----+
90
	//+---- paramètres ----+
91
	
91
	
92
	public function traiterParametres() {
92
	public function traiterParametres() {
93
		if (isset($this->parametres) && !empty($this->parametres) ) {
93
		if (isset($this->parametres) && !empty($this->parametres) ) {
94
			foreach ($this->parametres as $param => $valeur) {
94
			foreach ($this->parametres as $param => $valeur) {
95
				switch ($param) {
95
				switch ($param) {
96
					case 'categorie'  :
96
					case 'categorie'  :
97
						if ($valeur == "ecologie"){
97
						if ($valeur == "ecologie"){
98
							$this->champs_recherches = ' num_nomen, bdnt, ve_lumiere_min , ve_lumiere_max,'
98
							$this->champs_recherches = ' num_nomen, bdnt, ve_lumiere_min , ve_lumiere_max,'
99
							.' ve_temperature_min, ve_temperature_max, ve_continentalite_min,'
99
							.' ve_temperature_min, ve_temperature_max, ve_continentalite_min,'
100
							.' ve_continentalite_max, ve_humidite_atmos_min, ve_humidite_atmos_max,'
100
							.' ve_continentalite_max, ve_humidite_atmos_min, ve_humidite_atmos_max,'
101
							.' ve_humidite_edaph_min, ve_humidite_edaph_max, ve_reaction_sol_min,'
101
							.' ve_humidite_edaph_min, ve_humidite_edaph_max, ve_reaction_sol_min,'
102
							.' ve_reaction_sol_max, ve_nutriments_sol_min, ve_nutriments_sol_max,'
102
							.' ve_reaction_sol_max, ve_nutriments_sol_min, ve_nutriments_sol_max,'
103
							.' ve_salinite_min, ve_salinite_max, ve_texture_sol_min,ve_texture_sol_max,'
103
							.' ve_salinite_min, ve_salinite_max, ve_texture_sol_min,ve_texture_sol_max,'
104
							.' ve_mat_org_sol_min, ve_mat_org_sol_max ';
104
							.' ve_mat_org_sol_min, ve_mat_org_sol_max ';
105
						} else {
105
						} else {
106
							$e = "Valeur de paramètre inconnue pour 'categorie'. Ce paramètre n'est pas autorisé pour informations/#id";
106
							$e = "Valeur de paramètre inconnue pour 'categorie'. Ce paramètre n'est pas autorisé pour informations/#id";
107
							throw new Exception($e, RestServeur::HTTP_CODE_MAUVAISE_REQUETE);
107
							throw new Exception($e, RestServeur::HTTP_CODE_MAUVAISE_REQUETE);
108
						}
108
						}
109
						break;
109
						break;
110
					case 'retour.format'  :
110
					case 'retour.format'  :
111
						if ($valeur == 'min' || $valeur == 'max') {
111
						if ($valeur == 'min' || $valeur == 'max') {
112
							$this->retour_format = $valeur;
112
							$this->retour_format = $valeur;
113
							break;
113
							break;
114
						} else {
114
						} else {
115
							$e = "Valeur de paramètre inconnue pour 'retour.format'. Ce paramètre n'est pas autorisé pour informations/#id";
115
							$e = "Valeur de paramètre inconnue pour 'retour.format'. Ce paramètre n'est pas autorisé pour informations/#id";
116
							throw new Exception($e, RestServeur::HTTP_CODE_MAUVAISE_REQUETE);
116
							throw new Exception($e, RestServeur::HTTP_CODE_MAUVAISE_REQUETE);
117
						}
117
						}
-
 
118
					case 'navigation.depart'  :
-
 
119
						$this->definirNavigationDepart($valeur);
-
 
120
						break;
-
 
121
					case 'navigation.limite'  :
-
 
122
						$this->definirNavigationLimite($valeur);
-
 
123
						break;
118
					case 'version.projet' :
124
					case 'version.projet' :
119
						$this->traiterVersion($valeur);
125
						$this->traiterVersion($valeur);
120
						break;
126
						break;
121
					default :
127
					default :
122
						$e = 'Erreur dans les parametres de votre requête : </br> Le paramètre " '
128
						$e = 'Erreur dans les parametres de votre requête : </br> Le paramètre " '
123
					.$param.' " n\'existe pas.';
129
					.$param.' " n\'existe pas.';
124
					throw new Exception($e, RestServeur::HTTP_CODE_MAUVAISE_REQUETE);	break;
130
					throw new Exception($e, RestServeur::HTTP_CODE_MAUVAISE_REQUETE);	break;
125
				}
131
				}
126
			}
132
			}
127
		}
133
		}
128
	}	
134
	}	
129
 
135
 
130
	//+++------------------------------traitement des versions----------------------------------------++
136
	//+++------------------------------traitement des versions----------------------------------------++
131
	
137
	
132
	public function traiterVersion($valeur) {
138
	public function traiterVersion($valeur) {
133
		if (preg_match('/^[0-9]+(?:[._][0-9]+)*$/', $valeur) || $valeur == '*' || $valeur == '+') {
139
		if (preg_match('/^[0-9]+(?:[._][0-9]+)*$/', $valeur) || $valeur == '*' || $valeur == '+') {
134
				$this->version_projet = $valeur;
140
				$this->version_projet = $valeur;
135
			} else  {
141
			} else  {
136
				$e = "Erreur : La version est inconnue.";
142
				$e = "Erreur : La version est inconnue.";
137
				throw new Exception($e, RestServeur::HTTP_CODE_MAUVAISE_REQUETE);
143
				throw new Exception($e, RestServeur::HTTP_CODE_MAUVAISE_REQUETE);
138
			}
144
			}
139
		if ($this->version_projet == '*' && $this->ressources == array()) {
145
		if ($this->version_projet == '*' && $this->ressources == array()) {
140
			$message = "L'affichage de plusieurs versions ne fonctionne que pour les ressources de type /ressources/#id";
146
			$message = "L'affichage de plusieurs versions ne fonctionne que pour les ressources de type /ressources/#id";
141
			$code = RestServeur::HTTP_CODE_MAUVAISE_REQUETE;
147
			$code = RestServeur::HTTP_CODE_MAUVAISE_REQUETE;
142
			throw new Exception($message, $code);
148
			throw new Exception($message, $code);
143
		}
149
		}
144
	}
150
	}
145
 
151
 
146
	public function definirTables() {
152
	public function definirTables() {
147
		$table_num_version = $this->recupererVersionDisponible();
153
		$table_num_version = $this->recupererVersionDisponible();
148
		$prefixe_table = config::get('bdd_table_rang_sup');
154
		$prefixe_table = config::get('bdd_table_rang_sup');
149
		if ( in_array($this->version_projet,$table_num_version) ) {
155
		if ( in_array($this->version_projet,$table_num_version) ) {
150
			$this->table_version[] = $prefixe_table.'_v'.$this->version_projet;
156
			$this->table_version[] = $prefixe_table.'_v'.$this->version_projet;
151
		} elseif ($this->version_projet == '+') {
157
		} elseif ($this->version_projet == '+') {
152
					$derniere_version = $table_num_version[count($table_num_version) - 1];
158
					$derniere_version = $table_num_version[count($table_num_version) - 1];
153
					$this->table_version[] = $prefixe_table.'_v'.str_replace('.', '_', $derniere_version);
159
					$this->table_version[] = $prefixe_table.'_v'.str_replace('.', '_', $derniere_version);
154
		} elseif ($this->version_projet == '*') {
160
		} elseif ($this->version_projet == '*') {
155
			foreach ($table_num_version as $num_version) {
161
			foreach ($table_num_version as $num_version) {
156
				$this->table_version[] = $prefixe_table.'_v'.str_replace('.', '_', $num_version);
162
				$this->table_version[] = $prefixe_table.'_v'.str_replace('.', '_', $num_version);
157
			}
163
			}
158
		} else {
164
		} else {
159
			$e = "Erreur : La version est inconnue.";
165
			$e = "Erreur : La version est inconnue.";
160
			throw new Exception($e, RestServeur::HTTP_CODE_MAUVAISE_REQUETE);
166
			throw new Exception($e, RestServeur::HTTP_CODE_MAUVAISE_REQUETE);
161
		}
167
		}
162
	}
168
	}
163
	
169
	
164
	
170
	
165
	//+--------------------------formatages de resultats  -------------------------------------------+
171
	//+--------------------------formatages de resultats  -------------------------------------------+
166
	
172
	
167
	
173
	
168
	public function retournerResultatFormate($resultat) {
174
	public function retournerResultatFormate($resultat) {
169
		$this->resultat_json = $resultat[0];
175
		$this->resultat_json = $resultat[0];
170
		if ($this->retour_format == 'max') {
176
		if ($this->retour_format == 'max') {
171
			$graphique_presence = $this->traiterEcologie() ;
177
			$graphique_presence = $this->traiterEcologie() ;
172
			if ($graphique_presence) {
178
			if ($graphique_presence) {
173
				$this->ajouterLiensGraphique($graphique_presence);
179
				$this->ajouterLiensGraphique($graphique_presence);
174
			}
180
			}
175
		} 
181
		} 
176
		return $this->resultat_json ;
182
		return $this->resultat_json ;
177
		
183
		
178
	}
184
	}
179
	
185
	
180
	public function traiterEcologie() {
186
	public function traiterEcologie() {
181
		$donnees_presence =  false;
187
		$donnees_presence =  false;
182
		$this->champs_ontologiques = Commun::s_recupererTableauConfig('Paramètres.champs_ontologiques');
188
		$this->champs_ontologiques = Commun::s_recupererTableauConfig('Paramètres.champs_ontologiques');
183
		foreach ($this->champs_ontologiques as $cle => $valeur){
189
		foreach ($this->champs_ontologiques as $cle => $valeur){
184
			/* Les deux tests commentés ci-dessous étaient présents dans eflore-test (uniquement) jusqu'à juin 2013.
190
			/* Les deux tests commentés ci-dessous étaient présents dans eflore-test (uniquement) jusqu'à juin 2013.
185
			   La valeur 0 pose question.
191
			   La valeur 0 pose question.
186
			   cf baseflor_v2012_12_31
192
			   cf baseflor_v2012_12_31
187
			   cf services/modules/0.1/baseflor/CommunGraphiques.php traiterValeursEcologiques() */
193
			   cf services/modules/0.1/baseflor/CommunGraphiques.php traiterValeursEcologiques() */
188
			if ($this->resultat_json[$cle.'_min'] != "") { // && $this->resultat_json[$cle.'_min'] != 0) {
194
			if ($this->resultat_json[$cle.'_min'] != "") { // && $this->resultat_json[$cle.'_min'] != 0) {
189
				$donnees_presence[$this->getNomGraphique($valeur)] = true;
195
				$donnees_presence[$this->getNomGraphique($valeur)] = true;
190
				$tab_ontologie = $this->recupererOntologies($this->resultat_json[$cle.'_min'], $cle.'_min');
196
				$tab_ontologie = $this->recupererOntologies($this->resultat_json[$cle.'_min'], $cle.'_min');
191
				unset($this->resultat_json[$cle.'_min']);
197
				unset($this->resultat_json[$cle.'_min']);
192
			}
198
			}
193
			if ($this->resultat_json[$cle.'_max'] != "") { // && $this->resultat_json[$cle.'_max'] != 0) {
199
			if ($this->resultat_json[$cle.'_max'] != "") { // && $this->resultat_json[$cle.'_max'] != 0) {
194
				$this->recupererOntologies($this->resultat_json[$cle.'_max'], $cle.'_max');
200
				$this->recupererOntologies($this->resultat_json[$cle.'_max'], $cle.'_max');
195
				unset($this->resultat_json[$cle.'_max']);
201
				unset($this->resultat_json[$cle.'_max']);
196
			}
202
			}
197
		}
203
		}
198
		return $donnees_presence;
204
		return $donnees_presence;
199
	}
205
	}
200
	
206
	
201
	//donne le nom du graphique correspondant à un champ écologique
207
	//donne le nom du graphique correspondant à un champ écologique
202
	public function getNomGraphique($code_ecolo) {
208
	public function getNomGraphique($code_ecolo) {
203
		$graphique = null;
209
		$graphique = null;
204
		if (in_array($code_ecolo, explode(',',Config::get('Paramètres.climat')))) {
210
		if (in_array($code_ecolo, explode(',',Config::get('Paramètres.climat')))) {
205
			$graphique = 'climat';
211
			$graphique = 'climat';
206
		} elseif (in_array($code_ecolo, explode(',', Config::get('Paramètres.sol')) )) {
212
		} elseif (in_array($code_ecolo, explode(',', Config::get('Paramètres.sol')) )) {
207
			$graphique = 'sol';
213
			$graphique = 'sol';
208
		}
214
		}
209
		return $graphique;
215
		return $graphique;
210
	}
216
	}
211
	
217
	
212
	public function ajouterLiensGraphique($graphique_presence) {
218
	public function ajouterLiensGraphique($graphique_presence) {
213
		if ($graphique_presence['climat']) {
219
		if ($graphique_presence['climat']) {
214
			$this->resultat_json['graphique_climat']['libelle'] = 'climat';
220
			$this->resultat_json['graphique_climat']['libelle'] = 'climat';
215
			$this->resultat_json['graphique_climat']['href'] = $this->ajouterHref('graphiques/climat',
221
			$this->resultat_json['graphique_climat']['href'] = $this->ajouterHref('graphiques/climat',
216
			strtolower($this->resultat_json['bdnt']).'.nn:'.$this->resultat_json['num_nomen']);
222
			strtolower($this->resultat_json['bdnt']).'.nn:'.$this->resultat_json['num_nomen']);
217
		}
223
		}
218
		if ($graphique_presence['sol']) {
224
		if ($graphique_presence['sol']) {
219
			$this->resultat_json['graphique_sol']['libelle'] = 'sol';
225
			$this->resultat_json['graphique_sol']['libelle'] = 'sol';
220
			$this->resultat_json['graphique_sol']['href'] = $this->ajouterHref('graphiques/sol',
226
			$this->resultat_json['graphique_sol']['href'] = $this->ajouterHref('graphiques/sol',
221
			strtolower($this->resultat_json['bdnt']).'.nn:'.$this->resultat_json['num_nomen']);
227
			strtolower($this->resultat_json['bdnt']).'.nn:'.$this->resultat_json['num_nomen']);
222
		}
228
		}
223
	}
229
	}
224
	
230
	
225
	//+--------------------------traitement ontologies -------------------------------------------+
231
	//+--------------------------traitement ontologies -------------------------------------------+
226
	
232
	
227
	public function recupererOntologies($valeur, $champs){
233
	public function recupererOntologies($valeur, $champs){
228
		$chps_sans = preg_replace("/_min|_max/", '', $champs);
234
		$chps_sans = preg_replace("/_min|_max/", '', $champs);
229
		$url = Config::get('url_service_base').Config::get('nom_projet').
235
		$url = Config::get('url_service_base').Config::get('nom_projet').
230
			'/ontologies/'.$this->champs_ontologiques[$chps_sans].':'.urlencode(urlencode($valeur));
236
			'/ontologies/'.$this->champs_ontologiques[$chps_sans].':'.urlencode(urlencode($valeur));
231
		try {
237
		try {
232
			$val = $this->getBdd()->recuperer(sprintf(
238
			$val = $this->getBdd()->recuperer(sprintf(
233
				"SELECT a.nom FROM baseflor_ontologies a LEFT JOIN baseflor_ontologies b ON a.id = b.id LEFT JOIN baseflor_ontologies c ON b.classe_id = c.id WHERE".
239
				"SELECT a.nom FROM baseflor_ontologies a LEFT JOIN baseflor_ontologies b ON a.id = b.id LEFT JOIN baseflor_ontologies c ON b.classe_id = c.id WHERE".
234
				" b.code = BINARY '%s' AND c.code = BINARY '%s' LIMIT 0, 100",
240
				" b.code = BINARY '%s' AND c.code = BINARY '%s' LIMIT 0, 100",
235
				$valeur,
241
				$valeur,
236
				$this->champs_ontologiques[$chps_sans]),
242
				$this->champs_ontologiques[$chps_sans]),
237
											  Bdd::MODE_OBJET);
243
											  Bdd::MODE_OBJET);
238
			$this->resultat_json[$champs.'.libelle'] = $val->nom;
244
			$this->resultat_json[$champs.'.libelle'] = $val->nom;
239
			$this->resultat_json[$champs.'.code'] = $valeur;
245
			$this->resultat_json[$champs.'.code'] = $valeur;
240
			$this->resultat_json[$champs.'.href'] = $url;
246
			$this->resultat_json[$champs.'.href'] = $url;
241
		} catch (Exception $e) {
247
		} catch (Exception $e) {
242
			$this->resultat_json[$champs.'.libelle'] = '';
248
			$this->resultat_json[$champs.'.libelle'] = '';
243
			$this->resultat_json[$champs.'.code'] = '';
249
			$this->resultat_json[$champs.'.code'] = '';
244
			$this->resultat_json[$champs.'.href'] = '';
250
			$this->resultat_json[$champs.'.href'] = '';
245
		}
251
		}
246
	}
252
	}
247
	
253
	
248
	
254
	
249
	//+--------------------------FONCTIONS D'ASSEMBLAGE DE LA REQUETE-------------------------------------------+
255
	//+--------------------------FONCTIONS D'ASSEMBLAGE DE LA REQUETE-------------------------------------------+
250
	
256
	
251
	public function assemblerLaRequete() {
257
	public function assemblerLaRequete() {
252
		$requete = 	' SELECT '.$this->champs_recherches.' FROM '.$this->table.' '
258
		$requete = 	' SELECT '.$this->champs_recherches.' FROM '.$this->table.' '
253
		.$this->retournerRequeteCondition();
259
		.$this->retournerRequeteCondition();
254
		return $requete;
260
		return $requete;
255
	}
261
	}
256
	
262
	
257
	
263
	
258
	
264
	
259
	public  function retournerRequeteCondition() {
265
	public  function retournerRequeteCondition() {
260
		$condition = '';
266
		$condition = '';
261
		if (empty($this->requete_condition) == false) {
267
		if (empty($this->requete_condition) == false) {
262
			$condition = ' WHERE '.implode(' AND ', $this->requete_condition);
268
			$condition = ' WHERE '.implode(' AND ', $this->requete_condition);
263
		}
269
		}
264
		return $condition;
270
		return $condition;
265
	}
271
	}
266
	
272
	
267
}
273
}
268
?>
274
?>