Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 91 Rev 104
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
* Description :
4
* Description :
5
* Classe CommunNomsTaxons.php
5
* Classe CommunNomsTaxons.php
6
* Encodage en entrée : utf8
6
* Encodage en entrée : utf8
7
* Encodage en sortie : utf8
7
* Encodage en sortie : utf8
8
* @package framework-v3
8
* @package framework-v3
9
* @author Jennifer Dhé <jennifer.dhe@tela-botanica.org>
9
* @author Jennifer Dhé <jennifer.dhe@tela-botanica.org>
10
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
10
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
11
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
11
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
12
* @version 1.0
12
* @version 1.0
13
* @copyright 1999-2011 Tela Botanica (accueil@tela-botanica.org)
13
* @copyright 1999-2011 Tela Botanica (accueil@tela-botanica.org)
14
*/
14
*/
-
 
15
 
15
 
16
 
16
abstract class CommunNomsTaxons extends Commun {
17
abstract class CommunNomsTaxons extends Commun {
17
 
18
 
18
	/** Tableau de correspondance entre les noms des champs et les codes de l'ontologie.*/
19
	/** Tableau de correspondance entre les noms des champs et les codes de l'ontologie.*/
19
	private $relationsChampsCodesOntologie = null;
20
	private $relationsChampsCodesOntologie = null;
20
	protected $table_retour; //Permet de stocker le tableau de résultat (non encodé en json)
21
	protected $table_retour; //Permet de stocker le tableau de résultat (non encodé en json)
21
	protected $resultat_req; // Permet de stocker le résultat de la requete principale.
22
	protected $resultat_req; // Permet de stocker le résultat de la requete principale.
22
	protected $compo_nom = null; //Stocke sous forme de tableau les composant du nom à ajouter au nom scientifique
23
	protected $compo_nom = null; //Stocke sous forme de tableau les composant du nom à ajouter au nom scientifique
23
	protected $table;// Nom de la table dans laquelle on récupèrera les données dans les requetes SQL
24
	protected $table;// Nom de la table dans laquelle on récupèrera les données dans les requetes SQL
24
	protected $total_resultat = null;
25
	protected $total_resultat = null;
25
	 /** Stocke le service appelé correspondant. Est utilisé principalement lors de l'affichage du href d'un synonyme
26
	 /** Stocke le service appelé correspondant. Est utilisé principalement lors de l'affichage du href d'un synonyme
26
	  (ex id=12, basionyme num 25 est un synonyme) dans le service taxon */
27
	  (ex id=12, basionyme num 25 est un synonyme) dans le service taxon */
27
	protected $service_href = null;
28
	protected $service_href = null;
28
	protected $erreursParametres = null;
29
	protected $erreursParametres = null;
29
 
30
 
30
//+------------------------------- PARAMÈTRES ---------------------------------------------------------------+
31
//+------------------------------- PARAMÈTRES ---------------------------------------------------------------+
31
 
32
 
32
	public function traiterParametres() {
33
	public function traiterParametres() {
33
		$this->definirParametresParDefaut();
34
		$this->definirParametresParDefaut();
34
		$this->verifierParametres();
35
		$this->verifierParametres();
35
 
36
 
36
		if (isset($this->parametres) && count($this->parametres) > 0) {
37
		if (isset($this->parametres) && count($this->parametres) > 0) {
37
			foreach ($this->parametres as $param => $val) {
38
			foreach ($this->parametres as $param => $val) {
38
				switch ($param) {
39
				switch ($param) {
39
					case 'ns.structure' :
40
					case 'ns.structure' :
40
						$this->remplirTableCompositionNom($val);
41
						$this->remplirTableCompositionNom($val);
41
						$this->requete_champ .= ' ,'.implode(', ',$this->compo_nom);
42
						$this->requete_champ .= ' ,'.implode(', ',$this->compo_nom);
42
						break;
43
						break;
43
					case 'navigation.depart' :
44
					case 'navigation.depart' :
44
							$this->limite_requete['depart'] = $val;
45
							$this->limite_requete['depart'] = $val;
45
						break;
46
						break;
46
					case 'navigation.limite' :
47
					case 'navigation.limite' :
47
							$this->limite_requete['limite'] = $val;
48
							$this->limite_requete['limite'] = $val;
48
						break;
49
						break;
49
				}
50
				}
50
			}
51
			}
51
			$this->traiterParametresSpecifiques();
52
			$this->traiterParametresSpecifiques();
52
		}
53
		}
53
	}
54
	}
54
 
55
 
55
	protected function definirParametresParDefaut() {
56
	protected function definirParametresParDefaut() {
56
		if (empty($this->parametres['recherche'])) {
57
		if (empty($this->parametres['recherche'])) {
57
			$this->parametres['recherche'] = 'stricte';
58
			$this->parametres['recherche'] = 'stricte';
58
		}
59
		}
59
		if (empty($this->parametres['ns.format'])) {
60
		if (empty($this->parametres['ns.format'])) {
60
			$this->parametres['ns.format'] =  'txt';
61
			$this->parametres['ns.format'] =  'txt';
61
		}
62
		}
62
		if (empty($this->parametres['retour.format'])) {
63
		if (empty($this->parametres['retour.format'])) {
63
			$this->parametres['retour.format'] = 'max';
64
			$this->parametres['retour.format'] = 'max';
64
		}
65
		}
65
	}
66
	}
66
 
67
 
67
	public function verifierParametres() {
68
	public function verifierParametres() {
68
		$this->verifierParametresAPI();
69
		$this->verifierParametresAPI();
69
 
70
 
70
		$this->verifierParametre('recherche', 'stricte|floue|etendue');
71
		$this->verifierParametre('recherche', 'stricte|floue|etendue');
71
		$this->verifierParametre('ns.format', 'htm|txt');
72
		$this->verifierParametre('ns.format', 'htm|txt');
72
		$this->verifierParametre('retour.format', 'min|max|oss|perso');
73
		$this->verifierParametre('retour.format', 'min|max|oss|perso');
73
		$this->verifierParametreAvecValeurMultipe('ns.structure', 'an|au|bib|ad');
74
		$this->verifierParametreAvecValeurMultipe('ns.structure', 'an|au|bib|ad');
74
 
75
 
75
		if (count($this->erreursParametres) > 0) {
76
		if (count($this->erreursParametres) > 0) {
76
			$m = 'Erreur dans votre requête : '.implode('<br/>', $this->erreursParametres);
77
			$m = 'Erreur dans votre requête : '.implode('<br/>', $this->erreursParametres);
77
			$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $m);
78
			$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $m);
78
		}
79
		}
79
	}
80
	}
80
 
81
 
81
	public function verifierParametresAPI() {
82
	public function verifierParametresAPI() {
82
		$parametresApi = $this->recupererTableauConfig('parametresAPI');
83
		$parametresApi = $this->recupererTableauConfig('parametresAPI');
83
		while (!is_null($parametre = key($this->parametres))) {
84
		while (!is_null($parametre = key($this->parametres))) {
84
			if (!in_array($parametre, $parametresApi)) {
85
			if (!in_array($parametre, $parametresApi)) {
85
				$this->erreursParametres[] = "Le paramètre '$parametre' n'est pas pris en compte par cette version de l'API.";
86
				$this->erreursParametres[] = "Le paramètre '$parametre' n'est pas pris en compte par cette version de l'API.";
86
			}
87
			}
87
			next($this->parametres);
88
			next($this->parametres);
88
		}
89
		}
89
	}
90
	}
90
 
91
 
91
	public function verifierParametre($parametre, $valeursPermises) {
92
	public function verifierParametre($parametre, $valeursPermises) {
92
		if (isset($this->parametres[$parametre]) && !empty($this->parametres[$parametre])) {
93
		if (isset($this->parametres[$parametre]) && !empty($this->parametres[$parametre])) {
93
			$valeur = $this->parametres[$parametre];
94
			$valeur = $this->parametres[$parametre];
94
			$this->verifierValeursPermises($parametre, $valeur, $valeursPermises);
95
			$this->verifierValeursPermises($parametre, $valeur, $valeursPermises);
95
		}
96
		}
96
	}
97
	}
97
 
98
 
98
	public function verifierParametreAvecValeurMultipe($parametre, $valeursPermises) {
99
	public function verifierParametreAvecValeurMultipe($parametre, $valeursPermises) {
99
		if (isset($this->parametres[$parametre]) && !empty($this->parametres[$parametre])) {
100
		if (isset($this->parametres[$parametre]) && !empty($this->parametres[$parametre])) {
100
			$valeursConcatenees = $this->parametres[$parametre];
101
			$valeursConcatenees = $this->parametres[$parametre];
101
			$valeurs = explode(',', $valeursConcatenees);
102
			$valeurs = explode(',', $valeursConcatenees);
102
			foreach ($valeurs as $valeur) {
103
			foreach ($valeurs as $valeur) {
103
				$this->verifierValeursPermises($parametre, $valeur, $valeursPermises);
104
				$this->verifierValeursPermises($parametre, $valeur, $valeursPermises);
104
			}
105
			}
105
		}
106
		}
106
	}
107
	}
107
 
108
 
108
	private function verifierValeursPermises($parametre, $valeur, $valeursPermises) {
109
	private function verifierValeursPermises($parametre, $valeur, $valeursPermises) {
109
		if (!in_array($valeur, explode('|', $valeursPermises))) {
110
		if (!in_array($valeur, explode('|', $valeursPermises))) {
110
			$this->erreursParametres[] = "Le paramètre '$parametre' ne peut pas prendre la valeur '$valeur'. Valeurs permises : $valeursPermises";
111
			$this->erreursParametres[] = "Le paramètre '$parametre' ne peut pas prendre la valeur '$valeur'. Valeurs permises : $valeursPermises";
111
		}
112
		}
112
	}
113
	}
113
 
114
 
114
	public function traiterParametresCommuns() {
115
	public function traiterParametresCommuns() {
115
 
116
 
116
	}
117
	}
117
 
118
 
118
	public function ajouterFiltreMasque($nom_champ, $valeur) {
119
	public function ajouterFiltreMasque($nom_champ, $valeur) {
119
		if ($nom_champ == 'annee' || $nom_champ == 'rang') {
120
		if ($nom_champ == 'annee' || $nom_champ == 'rang') {
120
			$this->requete_condition []= "$nom_champ = ".$this->getBdd()->proteger($valeur);
121
			$this->requete_condition []= "$nom_champ = ".$this->getBdd()->proteger($valeur);
121
		} else {
122
		} else {
122
			if ($this->parametres['recherche'] == 'etendue') {
123
			if ($this->parametres['recherche'] == 'etendue') {
123
				$valeur = $this->modifierValeur($valeur);
124
				$valeur = $this->modifierValeur($valeur);
124
				$this->requete_condition[] = "$nom_champ LIKE ".$this->getBdd()->proteger($valeur);
125
				$this->requete_condition[] = "$nom_champ LIKE ".$this->getBdd()->proteger($valeur);
125
			} elseif ($this->parametres['recherche'] == 'floue') {
126
			} elseif ($this->parametres['recherche'] == 'floue') {
126
				$valeur = $this->getBdd()->proteger($valeur);
127
				$valeur = $this->getBdd()->proteger($valeur);
127
				$this->requete_condition[] = "( SOUNDEX($nom_champ) = SOUNDEX($valeur))".
128
				$this->requete_condition[] = "( SOUNDEX($nom_champ) = SOUNDEX($valeur))".
128
						" OR ( SOUNDEX(REVERSE($nom_champ)) = SOUNDEX(REVERSE($valeur)))";
129
						" OR ( SOUNDEX(REVERSE($nom_champ)) = SOUNDEX(REVERSE($valeur)))";
129
			} else {
130
			} else {
130
				$this->requete_condition[] = "$nom_champ LIKE ".$this->getBdd()->proteger($valeur);
131
				$this->requete_condition[] = "$nom_champ LIKE ".$this->getBdd()->proteger($valeur);
131
			}
132
			}
132
		}
133
		}
133
		$this->masque[$nom_champ] = "$nom_champ=$valeur";
134
		$this->masque[$nom_champ] = "$nom_champ=$valeur";
134
	}
135
	}
135
 
136
 
136
	private function modifierValeur($valeur) {
137
	private function modifierValeur($valeur) {
137
		$valeur = $this->remplacerCaractereHybrideEtChimere($valeur);
138
		$valeur = $this->remplacerCaractereHybrideEtChimere($valeur);
138
		$valeur = $this->preparerChainePourRechercheEtendue($valeur);
139
		$valeur = $this->preparerChainePourRechercheEtendue($valeur);
139
		return $valeur;
140
		return $valeur;
140
	}
141
	}
141
 
142
 
142
	private function remplacerCaractereHybrideEtChimere($valeur) {
143
	private function remplacerCaractereHybrideEtChimere($valeur) {
143
		$caracteres = array('×', '%D7', '+', '%2B');
144
		$caracteres = array('×', '%D7', '+', '%2B');
144
		$remplacements = array('x ','x ', '+', '+');
145
		$remplacements = array('x ','x ', '+', '+');
145
		$valeur = str_replace($caracteres, $remplacements, $valeur);
146
		$valeur = str_replace($caracteres, $remplacements, $valeur);
146
		return $valeur;
147
		return $valeur;
147
	}
148
	}
148
 
149
 
149
	private function preparerChainePourRechercheEtendue($valeur) {
150
	private function preparerChainePourRechercheEtendue($valeur) {
150
		$valeur = str_replace(' ', '%', trim($valeur));
151
		$valeur = str_replace(' ', '%', trim($valeur));
151
		$valeur = $valeur.'%';
152
		$valeur = $valeur.'%';
152
		return $valeur;
153
		return $valeur;
153
	}
154
	}
154
 
155
 
155
	//+-------------------------------Fonctions d'analyse des ressources-------------------------------------+
156
	//+-------------------------------Fonctions d'analyse des ressources-------------------------------------+
156
 
157
 
157
	private function etreRessourceId() {
158
	private function etreRessourceId() {
158
		$ok = false;
159
		$ok = false;
159
		if ($this->estUnIdentifiant() && count($this->ressources) == 1) {
160
		if ($this->estUnIdentifiant() && count($this->ressources) == 1) {
160
			$ok = true;
161
			$ok = true;
161
		}
162
		}
162
		return $ok;
163
		return $ok;
163
	}
164
	}
164
 
165
 
165
	public function traiterRessources() {
166
	public function traiterRessources() {
166
		if (isset($this->ressources) && count($this->ressources) > 0) {
167
		if (isset($this->ressources) && count($this->ressources) > 0) {
167
			if ($this->ressources[0] == 'relations') {
168
			if ($this->ressources[0] == 'relations') {
168
				$this->traiterRessourceRelations();
169
				$this->traiterRessourceRelations();
169
			} elseif ($this->estUnIdentifiant()) { //l'identifiant peut etre de type /#id ou /nt:#id
170
			} elseif ($this->estUnIdentifiant()) { //l'identifiant peut etre de type /#id ou /nt:#id
170
				$this->traiterRessourcesIdentifiant(); // dans le service noms ou taxons
171
				$this->traiterRessourcesIdentifiant(); // dans le service noms ou taxons
171
			} elseif ($this->ressources[0] == 'stats') { //ressource = noms/stats
172
			} elseif ($this->ressources[0] == 'stats') { //ressource = noms/stats
172
				$this->traiterRessourcesStats();
173
				$this->traiterRessourcesStats();
173
			} else {
174
			} else {
174
				$e = 'Erreur dans votre requete </br> Ressources disponibles : <br/>
175
				$e = 'Erreur dans votre requete </br> Ressources disponibles : <br/>
175
					 <li> /'.$this->service.'/#id (id : L\'identifiant du nom rechercher)</li>
176
					 <li> /'.$this->service.'/#id (id : L\'identifiant du nom rechercher)</li>
176
					 <li> /'.$this->service.'/nt:#id (id : Numero du taxon recherche)</li>
177
					 <li> /'.$this->service.'/nt:#id (id : Numero du taxon recherche)</li>
177
					 <li> /'.$this->service.'/stats </li>';
178
					 <li> /'.$this->service.'/stats </li>';
178
				$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
179
				$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
179
			}
180
			}
180
		}
181
		}
181
	}
182
	}
182
 
183
 
183
	public function traiterRessourcesStats() {
184
	public function traiterRessourcesStats() {
184
		$this->format_reponse = $this->service.'/stats';
185
		$this->format_reponse = $this->service.'/stats';
185
 
186
 
186
		$e = "Erreur dans votre requête </br> Ressources disponibles : $this->service/stats/[annees|rangs|initiales]";
187
		$e = "Erreur dans votre requête </br> Ressources disponibles : $this->service/stats/[annees|rangs|initiales]";
187
		if (isset($this->ressources[1]) && !empty($this->ressources[1])) {
188
		if (isset($this->ressources[1]) && !empty($this->ressources[1])) {
188
			switch ($this->ressources[1]) {
189
			switch ($this->ressources[1]) {
189
				case 'annees' :
190
				case 'annees' :
190
					$this->traiterRessourceStatsAnnees();
191
					$this->traiterRessourceStatsAnnees();
191
					break;
192
					break;
192
				case 'rangs' :
193
				case 'rangs' :
193
					$this->traiterRessourceStatsRangs();
194
					$this->traiterRessourceStatsRangs();
194
					break;
195
					break;
195
				case 'initiales' :
196
				case 'initiales' :
196
					$this->traiterRessourceStatsInitiales();
197
					$this->traiterRessourceStatsInitiales();
197
					break;
198
					break;
198
				default :
199
				default :
199
					$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
200
					$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
200
					break;
201
					break;
201
			}
202
			}
202
		} else {
203
		} else {
203
			$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
204
			$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
204
		}
205
		}
205
	}
206
	}
206
 
207
 
207
	/** Vérifie si la première valeur de la table de ressource est un identifiant :
208
	/** Vérifie si la première valeur de la table de ressource est un identifiant :
208
	 * un numerique ou un numéro taxonomique sous la forme nt:xx */
209
	 * un numerique ou un numéro taxonomique sous la forme nt:xx */
209
	public function estUnIdentifiant() {
210
	public function estUnIdentifiant() {
210
		return (is_numeric($this->ressources[0]) || (strrpos($this->ressources[0],'nt:') !== false
211
		return (is_numeric($this->ressources[0]) || (strrpos($this->ressources[0],'nt:') !== false
211
				&& is_numeric(str_replace('nt:','',$this->ressources[0]))));
212
				&& is_numeric(str_replace('nt:','',$this->ressources[0]))));
212
	}
213
	}
213
 
214
 
214
	//+------------------------------------------------------------------------------------------------------+
215
	//+------------------------------------------------------------------------------------------------------+
215
	// Fonction d'analyse des parametres
216
	// Fonction d'analyse des parametres
216
 
217
 
217
	/** Permet de remplir le tableau compo_nom. Il comprendra en fct du paramètre ns.structure les éléments à rajouter
218
	/** Permet de remplir le tableau compo_nom. Il comprendra en fct du paramètre ns.structure les éléments à rajouter
218
	 * au nom_sci (annee, auteur, biblio ou addendum). */
219
	 * au nom_sci (annee, auteur, biblio ou addendum). */
219
	public function remplirTableCompositionNom($valeur) {
220
	public function remplirTableCompositionNom($valeur) {
220
		$structure_nom = explode(',', $valeur);
221
		$structure_nom = explode(',', $valeur);
221
		foreach ($structure_nom as $structure) {
222
		foreach ($structure_nom as $structure) {
222
			$this->compo_nom[$structure] = str_replace(array('an', 'au', 'bib', 'ad'),
223
			$this->compo_nom[$structure] = str_replace(array('an', 'au', 'bib', 'ad'),
223
				array('annee', 'auteur', 'biblio_origine', 'nom_addendum'), $structure);
224
				array('annee', 'auteur', 'biblio_origine', 'nom_addendum'), $structure);
224
		}
225
		}
225
	}
226
	}
226
 
227
 
227
	public function mettreAuFormat() {
228
	public function mettreAuFormat() {
228
		if ($this->parametres['ns.format'] == 'htm') {
229
		if ($this->parametres['ns.format'] == 'htm') {
229
			if (strrpos($this->requete_champ, 'nom_sci_html as nom_sci') === false) {
230
			if (strrpos($this->requete_champ, 'nom_sci_html as nom_sci') === false) {
230
				$this->requete_champ = str_replace('nom_sci', 'nom_sci_html as nom_sci', $this->requete_champ);
231
				$this->requete_champ = str_replace('nom_sci', 'nom_sci_html as nom_sci', $this->requete_champ);
231
			}
232
			}
232
		}
233
		}
233
	}
234
	}
234
 
235
 
235
	//+------------------------------------------------------------------------------------------------------+
236
	//+------------------------------------------------------------------------------------------------------+
236
	// Fonctions de formatage
237
	// Fonctions de formatage
237
 
238
 
238
	/** Fonction permettant de creer la table dont le nom est passé en paramètre (champs_api, champs_bdtfx,
239
	/** Fonction permettant de creer la table dont le nom est passé en paramètre (champs_api, champs_bdtfx,
239
	 * correspondance_champs...). Les données de chaque table sont présentes dans le fichier de configuration config.ini
240
	 * correspondance_champs...). Les données de chaque table sont présentes dans le fichier de configuration config.ini
240
	 * @param String $table : Peut contenir plusieurs nom de table dont on souhaite récupérer les données : table,table,table. */
241
	 * @param String $table : Peut contenir plusieurs nom de table dont on souhaite récupérer les données : table,table,table. */
241
	public function recupererTableSignification($table) {
242
	public function recupererTableSignification($table) {
242
		$tables = explode(',', $table);
243
		$tables = explode(',', $table);
243
		foreach ($tables as $tab) {
244
		foreach ($tables as $tab) {
244
			if ($tab == 'champs_comp') {
245
			if ($tab == 'champs_comp') {
245
				$champ_bdnff_api = array_keys($this->champs_api); //on recupère le nom des champ ds la bdd
246
				$champ_bdnff_api = array_keys($this->champs_api); //on recupère le nom des champ ds la bdd
246
				$this->champs_comp = array_diff($this->champs_table, $champ_bdnff_api);
247
				$this->champs_comp = array_diff($this->champs_table, $champ_bdnff_api);
247
			} elseif ($tab == 'champs_api') {
248
			} elseif ($tab == 'champs_api') {
248
				foreach ($this->correspondance_champs as $key => $val) {
249
				foreach ($this->correspondance_champs as $key => $val) {
249
					preg_match('/(hybride[.]parent_0[12](?:[.]notes)?|nom_sci[.][^.]+|[^.]+)(?:[.](id|code))?/', $val, $match);
250
					preg_match('/(hybride[.]parent_0[12](?:[.]notes)?|nom_sci[.][^.]+|[^.]+)(?:[.](id|code))?/', $val, $match);
250
					$val = $match[1];
251
					$val = $match[1];
251
					$this->champs_api[$key] = $val;
252
					$this->champs_api[$key] = $val;
252
				}
253
				}
253
			} else {
254
			} else {
254
				$this->$tab = $this->recupererTableauConfig($tab);
255
				$this->$tab = $this->recupererTableauConfig($tab);
255
			}
256
			}
256
		}
257
		}
257
	}
258
	}
258
 
259
 
259
	public function formaterEnOss($resultat) {
260
	public function formaterEnOss($resultat) {
260
		$table_nom = array();
261
		$table_nom = array();
261
		$oss = '';
262
		$oss = '';
262
		foreach ($resultat as $tab) {
263
		foreach ($resultat as $tab) {
263
			if (isset($tab['nom_sci']) ) {
264
			if (isset($tab['nom_sci']) ) {
264
				if (!in_array($tab['nom_sci'], $table_nom)) {
265
				if (!in_array($tab['nom_sci'], $table_nom)) {
265
					$table_nom[] = $tab['nom_sci'];
266
					$table_nom[] = $tab['nom_sci'];
266
					$oss [] = $tab['nom_sci'].$this->ajouterCompositionNom($tab);
267
					$oss [] = $tab['nom_sci'].$this->ajouterCompositionNom($tab);
267
				}
268
				}
268
			}
269
			}
269
		}
270
		}
270
		if (isset($this->masque)) $masque = implode('&', $this->masque);
271
		if (isset($this->masque)) $masque = implode('&', $this->masque);
271
		else $masque = 'Pas de masque';
272
		else $masque = 'Pas de masque';
272
		$table_retour_oss = array($masque, $oss);
273
		$table_retour_oss = array($masque, $oss);
273
		return $table_retour_oss;
274
		return $table_retour_oss;
274
	}
275
	}
275
 
276
 
276
	public function afficherEnteteResultat($url_service) {
277
	public function afficherEnteteResultat($url_service) {
277
		$this->table_retour['depart'] = $this->limite_requete['depart'];
278
		$this->table_retour['depart'] = $this->limite_requete['depart'];
278
		$this->table_retour['limite'] = $this->limite_requete['limite'];
279
		$this->table_retour['limite'] = $this->limite_requete['limite'];
279
		$this->table_retour['total']  = $this->total_resultat;
280
		$this->table_retour['total']  = $this->total_resultat;
280
		$url = $this->formulerUrl($this->total_resultat, $url_service);
281
		$url = $this->formulerUrl($this->total_resultat, $url_service);
281
		if (isset($url['precedent']) && $url['precedent'] != '') {
282
		if (isset($url['precedent']) && $url['precedent'] != '') {
282
			$this->table_retour['href.precedent'] = $url['precedent'];
283
			$this->table_retour['href.precedent'] = $url['precedent'];
283
		}
284
		}
284
		if (isset($url['suivant']) && $url['suivant']   != '') {
285
		if (isset($url['suivant']) && $url['suivant']   != '') {
285
			$this->table_retour['href.suivant']   = $url['suivant'];
286
			$this->table_retour['href.suivant']   = $url['suivant'];
286
		}
287
		}
287
	}
288
	}
288
 
289
 
289
	public function afficherNomHrefRetenu($tab, $num) {
290
	public function afficherNomHrefRetenu($tab, $num) {
290
		$this->resultat_req = $tab;
291
		$this->resultat_req = $tab;
291
		$this->afficherDonnees('num_nom', $num);
292
		$this->afficherDonnees('num_nom', $num);
292
		if ($this->parametres['retour.format'] == 'min') { // sinon est affiché ds afficherDonnees(num_nom, $val) ci-dessus
293
		if ($this->parametres['retour.format'] == 'min') { // sinon est affiché ds afficherDonnees(num_nom, $val) ci-dessus
293
			 $this->table_retour['nom_sci'] = $tab['nom_sci'].$this->ajouterCompositionNom($tab);
294
			 $this->table_retour['nom_sci'] = $tab['nom_sci'].$this->ajouterCompositionNom($tab);
294
		}
295
		}
295
		$this->table_retour['retenu'] = ($tab['num_nom_retenu'] == $num) ? 'true' : 'false';
296
		$this->table_retour['retenu'] = ($tab['num_nom_retenu'] == $num) ? 'true' : 'false';
296
		unset($this->table_retour['id']);
297
		unset($this->table_retour['id']);
297
	}
298
	}
298
 
299
 
299
 
300
 
300
	//+------------------------------------------------------------------------------------------------------+
301
	//+------------------------------------------------------------------------------------------------------+
301
	// Fonction de formatage pour les services /#id/
302
	// Fonction de formatage pour les services /#id/
302
 
303
 
303
	public function formaterId($resultat) {
304
	public function formaterId($resultat) {
304
		$this->recupererTableSignification('correspondance_champs,champs_api,champs_comp');
305
		$this->recupererTableSignification('correspondance_champs,champs_api,champs_comp');
305
		$this->resultat_req = $resultat;
306
		$this->resultat_req = $resultat;
-
 
307
		
306
		foreach ($resultat as $cle => $valeur) {
308
		foreach ($resultat as $cle => $valeur) {
307
			if ($valeur != '') {
309
			if ($valeur != '') {
308
				$this->afficherDonnees($cle, $valeur);
310
				$this->afficherDonnees($cle, $valeur);
309
			}
311
			}
310
		}
312
		}
-
 
313
		if (isset($this->parametres['retour.champs']) && $this->format_reponse == 'noms/id') {
-
 
314
			$retour = $this->table_retour;
-
 
315
			$this->table_retour = array();
-
 
316
			$champs = explode(',', $this->parametres['retour.champs']);
-
 
317
			$this->ajouterChampsPersonnalises($champs, $retour);
-
 
318
		}
311
		unset($this->table_retour['href']);
319
		unset($this->table_retour['href']);
312
		return $this->table_retour;
320
		return $this->table_retour;
313
	}
321
	}
314
 
322
 
315
	public function formaterIdChamp($resultat) {
323
	public function formaterIdChamp($resultat) {
316
		$this->recupererTableSignification('correspondance_champs,champs_api,champs_comp');
324
		$this->recupererTableSignification('correspondance_champs,champs_api,champs_comp');
317
		$reponse_id = $this->formaterId($resultat);
325
		$reponse_id = $this->formaterId($resultat);
318
		$this->table_retour = array();
326
		$this->table_retour = array();
319
		$champs = explode(' ', $this->ressources[1]);
327
		$champs = explode(' ', $this->ressources[1]);
320
		$this->ajouterChampsPersonnalises($champs, $reponse_id);
328
		$this->ajouterChampsPersonnalises($champs, $reponse_id);
321
		return $this->table_retour;
329
		return $this->table_retour;
322
	}
330
	}
323
 
331
 
324
	protected function ajouterChampsPersonnalises($champs, $reponse_id) {
332
	protected function ajouterChampsPersonnalises($champs, $reponse_id) {
325
		if (! is_null($champs) && is_array($champs) && count($champs) > 0) {
333
		if (! is_null($champs) && is_array($champs) && count($champs) > 0) {
326
			foreach ($champs as $champ) {
334
			foreach ($champs as $champ) {
327
				if ($this->verifierValiditeChamp($champ)) {
335
				if ($this->verifierValiditeChamp($champ)) {
328
					if (strrpos($champ, '.*') !== false) {
336
					if (strrpos($champ, '.*') !== false) {
329
						$this->afficherPointEtoile($champ, $reponse_id);
337
						$this->afficherPointEtoile($champ, $reponse_id);
330
					} else {
338
					} else {
331
						$champ = $this->trouverChampBddCorrespondant($champ);
339
						$champ = $this->trouverChampBddCorrespondant($champ);
332
						$this->table_retour[$champ] = (isset($reponse_id[$champ])) ? $reponse_id[$champ] : null;
340
						$this->table_retour[$champ] = (isset($reponse_id[$champ])) ? $reponse_id[$champ] : null;
333
					}
341
					}
334
				}
342
				}
335
			}
343
			}
336
		}
344
		}
337
	}
345
	}
338
 
346
 
339
	public function afficherPointEtoile($champ, $reponse) {
347
	public function afficherPointEtoile($champ, $reponse) {
340
		preg_match('/^([^.]+\.)\*$/', $champ, $match);
348
		preg_match('/^([^.]+\.)\*$/', $champ, $match);
341
		if ($match[1] == 'nom_sci') {
349
		if ($match[1] == 'nom_sci') {
342
			$this->afficherNomSciPointEpithete($this->resultat_req);
350
			$this->afficherNomSciPointEpithete($this->resultat_req);
343
		} else {
351
		} else {
344
			foreach ($reponse as $chp => $valeur) {
352
			foreach ($reponse as $chp => $valeur) {
345
				if (strrpos($chp, $match[1]) !== false) {
353
				if (strrpos($chp, $match[1]) !== false) {
346
					if ($valeur != '') {
354
					if ($valeur != '') {
347
						$this->table_retour[$chp] = $valeur;
355
						$this->table_retour[$chp] = $valeur;
348
					} else {
356
					} else {
349
						$this->table_retour[$chp] = null;
357
						$this->table_retour[$chp] = null;
350
					}
358
					}
351
				}
359
				}
352
			}
360
			}
353
		}
361
		}
354
	}
362
	}
355
 
363
 
356
	public function decomposerNomChamp($champ) {
364
	public function decomposerNomChamp($champ) {
357
		$decomposition = false;
365
		$decomposition = false;
358
		if (preg_match('/^(?:([^.]+\.parent_0[12]|[^.]+))(?:\.(.+))?$/', $champ, $match)) {
366
		if (preg_match('/^(?:([^.]+\.parent_0[12]|[^.]+))(?:\.(.+))?$/', $champ, $match)) {
359
			$radical_champ = $match[1];
367
			$radical_champ = $match[1];
360
			$suffixe = (isset($match[2])) ? $match[2] : "";
368
			$suffixe = (isset($match[2])) ? $match[2] : "";
361
			$decomposition = array($radical_champ, $suffixe);
369
			$decomposition = array($radical_champ, $suffixe);
362
		}
370
		}
363
		return $decomposition;
371
		return $decomposition;
364
	}
372
	}
365
 
373
 
366
	public function verifierValiditeChamp($champ) {
374
	public function verifierValiditeChamp($champ) {
367
		$decomposition = $this->decomposerNomChamp($champ);
375
		$decomposition = $this->decomposerNomChamp($champ);
368
		$validite_ressource = true;
376
		$validite_ressource = true;
369
		if ($decomposition) {
377
		if ($decomposition) {
370
			list($radical, $suffixe) = $decomposition;
378
			list($radical, $suffixe) = $decomposition;
371
			// on verifie si le nom du champ existe bien
379
			// on verifie si le nom du champ existe bien
372
			if (!$this->estChampApi($radical) && !$this->estChampComplementaire($radical)) {
380
			if (!$this->estChampApi($radical) && !$this->estChampComplementaire($radical)) {
373
				$validite_ressource = false;
381
				$validite_ressource = false;
374
				$e = 'Le champ "'.$radical.'" n\'existe pas dans la base. <br/><br/>';
382
				$e = 'Le champ "'.$radical.'" n\'existe pas dans la base. <br/><br/>';
375
				$this->renvoyerErreur( RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
383
				$this->renvoyerErreur( RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
376
			} elseif ($this->estUnPoint($champ)) {
384
			} elseif ($this->estUnPoint($champ)) {
377
				$validite_ressource = $this->verifierValiditeSuffixe($suffixe, $radical);
385
				$validite_ressource = $this->verifierValiditeSuffixe($suffixe, $radical);
378
			}
386
			}
379
		}
387
		}
380
		return $validite_ressource;
388
		return $validite_ressource;
381
	}
389
	}
382
 
390
 
383
	public function estChampApi($radical_champ) {
391
	public function estChampApi($radical_champ) {
384
		$champ_api_ok = false;
392
		$champ_api_ok = false;
385
		if (in_array($radical_champ, $this->champs_api) || in_array($radical_champ, $this->correspondance_champs)) {
393
		if (in_array($radical_champ, $this->champs_api) || in_array($radical_champ, $this->correspondance_champs)) {
386
			$champ_api_ok = true;
394
			$champ_api_ok = true;
387
		}
395
		}
388
		return $champ_api_ok;
396
		return $champ_api_ok;
389
	}
397
	}
390
 
398
 
391
	public function estChampComplementaire($radical_champ) {
399
	public function estChampComplementaire($radical_champ) {
392
		$champ_complementaire_ok = in_array($radical_champ, $this->champs_comp) ? true : false;
400
		$champ_complementaire_ok = in_array($radical_champ, $this->champs_comp) ? true : false;
393
		return	$champ_complementaire_ok;
401
		return	$champ_complementaire_ok;
394
	}
402
	}
395
 
403
 
396
	public function verifierValiditeSuffixe($suffixe, $radical_champ) {
404
	public function verifierValiditeSuffixe($suffixe, $radical_champ) {
397
		$validite_ressource = true;
405
		$validite_ressource = true;
398
		if ($this->correspondAUnId($radical_champ) || $radical_champ == 'id') {
406
		if ($this->correspondAUnId($radical_champ) || $radical_champ == 'id') {
399
			$this->verificationSuffixesIdentifiant($suffixe, $radical_champ, $validite_ressource);
407
			$this->verificationSuffixesIdentifiant($suffixe, $radical_champ, $validite_ressource);
400
		} elseif ($this->correspondAUnCode($radical_champ)) {
408
		} elseif ($this->correspondAUnCode($radical_champ)) {
401
			$this->verificationSuffixesCodes($suffixe, $radical_champ, $validite_ressource);
409
			$this->verificationSuffixesCodes($suffixe, $radical_champ, $validite_ressource);
402
		} elseif ($radical_champ == 'nom_sci') {
410
		} elseif ($radical_champ == 'nom_sci') {
403
			if ($suffixe != '*') {
411
			if ($suffixe != '*') {
404
				$validite_ressource = false;
412
				$validite_ressource = false;
405
				$m = 'Erreur : Le suffixe demandé n\'existe pas pour le champ "'.$radical_champ.'".<br/>
413
				$m = 'Erreur : Le suffixe demandé n\'existe pas pour le champ "'.$radical_champ.'".<br/>
406
					Les suffixes possibles sont les suivants : <li> * </li>';
414
					Les suffixes possibles sont les suivants : <li> * </li>';
407
				$this->renvoyerErreur( RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $m);
415
				$this->renvoyerErreur( RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $m);
408
			}
416
			}
409
		} else {
417
		} else {
410
			$validite_ressource = false;
418
			$validite_ressource = false;
411
			$m = 'Erreur : Le paramètre "'.$radical_champ.'" ne peut pas présenter de suffixe. <br/><br/>';
419
			$m = 'Erreur : Le paramètre "'.$radical_champ.'" ne peut pas présenter de suffixe. <br/><br/>';
412
			$this->renvoyerErreur( RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $m);
420
			$this->renvoyerErreur( RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $m);
413
		}
421
		}
414
		return $validite_ressource;
422
		return $validite_ressource;
415
	}
423
	}
416
 
424
 
417
	public function verificationSuffixesCodes(&$suffixe, &$radical_champ, &$validite_ressource ) {
425
	public function verificationSuffixesCodes(&$suffixe, &$radical_champ, &$validite_ressource ) {
418
		if (!in_array($suffixe, array('*', 'code', 'href', 'details'))) {
426
		if (!in_array($suffixe, array('*', 'code', 'href', 'details'))) {
419
			$validite_ressource = false;
427
			$validite_ressource = false;
420
			$e = 'Erreur : Le suffixe demandé n\'existe pas pour le champ "'.$radical_champ.'.<br/> Les suffixes '
428
			$e = 'Erreur : Le suffixe demandé n\'existe pas pour le champ "'.$radical_champ.'.<br/> Les suffixes '
421
				.'possibles sont les suivants : <li> .* </li><li> .code </li><li> .href </li><li> .details </li>';
429
				.'possibles sont les suivants : <li> .* </li><li> .code </li><li> .href </li><li> .details </li>';
422
			$this->renvoyerErreur( RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
430
			$this->renvoyerErreur( RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
423
		}
431
		}
424
	}
432
	}
425
 
433
 
426
	public function verificationSuffixesIdentifiant(&$suffixe, &$radical_champ, &$validite_ressource) {
434
	public function verificationSuffixesIdentifiant(&$suffixe, &$radical_champ, &$validite_ressource) {
427
		if ((strrpos($radical_champ, 'parent') !== false && !in_array($suffixe, array('*', 'id', 'href', 'details', 'notes')))
435
		if ((strrpos($radical_champ, 'parent') !== false && !in_array($suffixe, array('*', 'id', 'href', 'details', 'notes')))
428
			|| !in_array($suffixe, array('*', 'id', 'href', 'details')) && strrpos($radical_champ, 'parent') === false) {
436
			|| !in_array($suffixe, array('*', 'id', 'href', 'details')) && strrpos($radical_champ, 'parent') === false) {
429
			$validite_ressource = false;
437
			$validite_ressource = false;
430
			$e = 'Erreur : Le suffixe demandé n\'existe pas pour le champ "'.$radical_champ.'".<br/> Les suffixes '
438
			$e = 'Erreur : Le suffixe demandé n\'existe pas pour le champ "'.$radical_champ.'".<br/> Les suffixes '
431
				.'possibles sont les suivants : <li> .* </li><li> .id </li><li> .href </li><li> .details </li>'
439
				.'possibles sont les suivants : <li> .* </li><li> .id </li><li> .href </li><li> .details </li>'
432
				.'<li> .notes (seulement pour les hybride.parent)';
440
				.'<li> .notes (seulement pour les hybride.parent)';
433
			$this->renvoyerErreur( RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
441
			$this->renvoyerErreur( RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
434
		}
442
		}
435
	}
443
	}
436
 
444
 
437
 
445
 
438
//------------------------------fonction de formatage pour les services /stats/-----------------------------------------
446
//------------------------------fonction de formatage pour les services /stats/-----------------------------------------
439
 
447
 
440
	public function formaterStatsAnnee($resultat) {
448
	public function formaterStatsAnnee($resultat) {
441
		foreach ($resultat as $cle_annee) {
449
		foreach ($resultat as $cle_annee) {
442
			$annee = ($cle_annee['annee'] != '') ? $cle_annee['annee'] : 'ND';
450
			$annee = ($cle_annee['annee'] != '') ? $cle_annee['annee'] : 'ND';
443
			$nb = $cle_annee['nombre'];
451
			$nb = $cle_annee['nombre'];
444
			$retour_stats_annee[$annee] = $nb;
452
			$retour_stats_annee[$annee] = $nb;
445
		}
453
		}
446
		return $retour_stats_annee;
454
		return $retour_stats_annee;
447
	}
455
	}
448
 
456
 
449
	public function formaterStatsRang($resultat) {
457
	public function formaterStatsRang($resultat) {
450
		foreach ($resultat as $rangs) {
458
		foreach ($resultat as $rangs) {
451
			if ($rangs['rang'] != 0) {
459
			if ($rangs['rang'] != 0) {
452
				$rang = $rangs['rang'];
460
				$rang = $rangs['rang'];
453
				if ($this->parametres['retour.format'] == 'max') {
461
				if ($this->parametres['retour.format'] == 'max') {
454
					$retour_rang[$rang]['rang'] = $this->ajouterSignificationCode('rang',$rang);
462
					$retour_rang[$rang]['rang'] = $this->ajouterSignificationCode('rang',$rang);
455
				}
463
				}
456
				$nombre = $rangs['nombre'];
464
				$nombre = $rangs['nombre'];
457
				$retour_rang[$rang]['nombre'] = $nombre;
465
				$retour_rang[$rang]['nombre'] = $nombre;
458
			}
466
			}
459
		}
467
		}
460
		return $retour_rang;
468
		return $retour_rang;
461
	}
469
	}
462
 
470
 
463
	public function formaterStatsInitiales($resultat) {
471
	public function formaterStatsInitiales($resultat) {
464
		$rang = null;
472
		$rang = null;
465
		$table_rang = array();
473
		$table_rang = array();
466
		foreach ($resultat as $tuple) {
474
		foreach ($resultat as $tuple) {
467
			if ($tuple['rang'] != 0) {
475
			if ($tuple['rang'] != 0) {
468
				$this->memoriserRang($table_rang, $tuple, $rang);
476
				$this->memoriserRang($table_rang, $tuple, $rang);
469
				if ($tuple['lettre'] == 'x ') {
477
				if ($tuple['lettre'] == 'x ') {
470
					$this->ajouterHybrideChimere('hybride', $rang, $tuple);
478
					$this->ajouterHybrideChimere('hybride', $rang, $tuple);
471
				} elseif ($tuple['lettre'] == '+ ') {
479
				} elseif ($tuple['lettre'] == '+ ') {
472
					$this->ajouterHybrideChimere('chimere', $rang, $tuple);
480
					$this->ajouterHybrideChimere('chimere', $rang, $tuple);
473
				} else {
481
				} else {
474
					$l = substr($tuple['lettre'], 0, 1);
482
					$l = substr($tuple['lettre'], 0, 1);
475
					if (isset($this->table_retour[$rang][$l])) {
483
					if (isset($this->table_retour[$rang][$l])) {
476
						$this->table_retour[$rang][substr($tuple['lettre'], 0, 1)] += floatval($tuple['nb']);
484
						$this->table_retour[$rang][substr($tuple['lettre'], 0, 1)] += floatval($tuple['nb']);
477
					} else {
485
					} else {
478
						$this->table_retour[$rang][substr($tuple['lettre'], 0, 1)] = floatval($tuple['nb']);
486
						$this->table_retour[$rang][substr($tuple['lettre'], 0, 1)] = floatval($tuple['nb']);
479
					}
487
					}
480
				}
488
				}
481
			}
489
			}
482
		}
490
		}
483
		return $this->table_retour;
491
		return $this->table_retour;
484
	}
492
	}
485
 
493
 
486
	public function memoriserRang(&$table_rang, $tuple, &$rang) {
494
	public function memoriserRang(&$table_rang, $tuple, &$rang) {
487
		if (is_array($table_rang)) {
495
		if (is_array($table_rang)) {
488
			if (!in_array($tuple['rang'], $table_rang)) {
496
			if (!in_array($tuple['rang'], $table_rang)) {
489
				$rang = $tuple['rang'];
497
				$rang = $tuple['rang'];
490
				$table_rang[] = $rang;
498
				$table_rang[] = $rang;
491
				if ($this->parametres['retour.format'] == 'max') {
499
				if ($this->parametres['retour.format'] == 'max') {
492
					$rang = $this->ajouterSignificationCode('rang', $rang);
500
					$rang = $this->ajouterSignificationCode('rang', $rang);
493
				}
501
				}
494
			}
502
			}
495
		}
503
		}
496
	}
504
	}
497
 
505
 
498
	public function ajouterHybrideChimere($groupe, &$rang, &$tuple) {
506
	public function ajouterHybrideChimere($groupe, &$rang, &$tuple) {
499
		if (isset($this->table_retour[$rang][str_replace('hybride', 'hyb', $groupe)])) {
507
		if (isset($this->table_retour[$rang][str_replace('hybride', 'hyb', $groupe)])) {
500
			$this->table_retour[$rang][$groupe] += floatval($tuple['nb']);
508
			$this->table_retour[$rang][$groupe] += floatval($tuple['nb']);
501
		} else {
509
		} else {
502
			$this->table_retour[$rang][$groupe] = floatval($tuple['nb']);
510
			$this->table_retour[$rang][$groupe] = floatval($tuple['nb']);
503
		}
511
		}
504
	}
512
	}
505
 
513
 
506
	//-----------------------------Fonctions d'affichage utiliser dans les fonctions de formatage---------------------------
514
	//-----------------------------Fonctions d'affichage utiliser dans les fonctions de formatage---------------------------
507
 
515
 
508
	public function afficherDonnees($champApi, $valeur) {
516
	public function afficherDonnees($champApi, $valeur) {
509
		$champBdd = $this->trouverChampBddCorrespondant($champApi);
517
		$champBdd = $this->trouverChampBddCorrespondant($champApi);
510
		if ($this->parametres['retour.format'] == 'min') {
518
		if ($this->parametres['retour.format'] == 'min') {
511
			if ($cle == 'nom_sci') {
519
			if ($cle == 'nom_sci') {
512
				$valeur = $valeur.$this->ajouterCompositionNom($this->resultat_req);
520
				$valeur = $valeur.$this->ajouterCompositionNom($this->resultat_req);
513
			}
521
			}
514
			$this->table_retour[$champBdd] = $valeur;
522
			$this->table_retour[$champBdd] = $valeur;
515
		} else {
523
		} else {
516
			$this->afficherToutesLesInfos($champBdd, $valeur);
524
			$this->afficherToutesLesInfos($champBdd, $valeur);
517
		}
525
		}
518
	}
526
	}
519
 
527
 
520
	public function trouverChampBddCorrespondant($champApi) {
528
	public function trouverChampBddCorrespondant($champApi) {
521
		if (array_key_exists($champApi, $this->champs_api)) {
529
		if (array_key_exists($champApi, $this->champs_api)) {
522
			$champBdd = $this->correspondance_champs[$champApi];
530
			$champBdd = $this->correspondance_champs[$champApi];
523
		} else {
531
		} else {
524
			$champBdd = $champApi;
532
			$champBdd = $champApi;
525
		}
533
		}
526
		return $champBdd;
534
		return $champBdd;
527
	}
535
	}
528
 
536
 
529
	public function afficherToutesLesInfos($nom_champ_api, $valeur) {
537
	public function afficherToutesLesInfos($nom_champ_api, $valeur) {
530
		if ($this->presentePlusieursId($nom_champ_api, $valeur)) {
538
		if ($this->presentePlusieursId($nom_champ_api, $valeur)) {
531
			preg_match('/^([^.]+\.parent_0[12]|[^.]+)(?:\.id)?$/', $nom_champ_api, $match);
539
			preg_match('/^([^.]+\.parent_0[12]|[^.]+)(?:\.id)?$/', $nom_champ_api, $match);
532
			$this->afficherInfosPrecises($match[1], 'details', $valeur);
540
			$this->afficherInfosPrecises($match[1], 'details', $valeur);
533
			$this->table_retour[$nom_champ_api] = $valeur;
541
			$this->table_retour[$nom_champ_api] = $valeur;
534
 
542
 
535
		} elseif (strrpos($nom_champ_api, 'parent') !== false && strrpos($nom_champ_api, 'notes') !== false) {
543
		} elseif (strrpos($nom_champ_api, 'parent') !== false && strrpos($nom_champ_api, 'notes') !== false) {
536
			$this->table_retour[$nom_champ_api] = $valeur;
544
			$this->table_retour[$nom_champ_api] = $valeur;
537
 
545
 
538
		} elseif (($this->correspondAUnId($nom_champ_api) || $nom_champ_api == 'id' && $valeur != '0')) {
546
		} elseif (($this->correspondAUnId($nom_champ_api) || $nom_champ_api == 'id' && $valeur != '0')) {
539
			preg_match('/^([^.]+\.parent_0[12]|[^.]+)(?:\.id)?$/', $nom_champ_api, $match);
547
			preg_match('/^([^.]+\.parent_0[12]|[^.]+)(?:\.id)?$/', $nom_champ_api, $match);
540
			$this->afficherInfosPrecises($match[1], 'id,signification,href', $valeur);
548
			$this->afficherInfosPrecises($match[1], 'id,signification,href', $valeur);
541
 
549
 
542
		} elseif ($this->correspondAUnCode($nom_champ_api)) {
550
		} elseif ($this->correspondAUnCode($nom_champ_api)) {
543
			preg_match('/^([^.]+)(?:\.code)?$/', $nom_champ_api, $match);
551
			preg_match('/^([^.]+)(?:\.code)?$/', $nom_champ_api, $match);
544
			$this->afficherInfosPrecises($match[1], 'code,signification,href', $valeur);
552
			$this->afficherInfosPrecises($match[1], 'code,signification,href', $valeur);
545
 
553
 
546
		} elseif ($nom_champ_api != 'nom_sci') {
554
		} elseif ($nom_champ_api != 'nom_sci') {
547
			$this->table_retour[$nom_champ_api] = $valeur;
555
			$this->table_retour[$nom_champ_api] = $valeur;
548
		}
556
		}
549
	}
557
	}
550
 
558
 
551
	public function presentePlusieursId($ressource, $valeur = null) {
559
	public function presentePlusieursId($ressource, $valeur = null) {
552
		if ($valeur) {
560
		if ($valeur) {
553
			$presente = strrpos($ressource, 'proparte') !== false && strrpos($valeur, ',') !== false;
561
			$presente = strrpos($ressource, 'proparte') !== false && strrpos($valeur, ',') !== false;
554
		} else { //pour la vérification du champ, on ignore alors la valeur de la ressource
562
		} else { //pour la vérification du champ, on ignore alors la valeur de la ressource
555
			$presente = strrpos($ressource, 'proparte') !== false;
563
			$presente = strrpos($ressource, 'proparte') !== false;
556
		}
564
		}
557
		return $presente;
565
		return $presente;
558
	}
566
	}
559
 
567
 
560
	public function afficherInfosPrecises($champ, $suffixe, $valeur) {
568
	public function afficherInfosPrecises($champ, $suffixe, $valeur) {
561
		$suffixes = explode(',', $suffixe);
569
		$suffixes = explode(',', $suffixe);
562
		//on initialise au service appelé. Sera potentiellement modifié dans la fonction afficherSignification()
570
		//on initialise au service appelé. Sera potentiellement modifié dans la fonction afficherSignification()
563
		$this->service_href = $this->service;
571
		$this->service_href = $this->service;
564
		foreach ($suffixes  as $suffixe) {
572
		foreach ($suffixes  as $suffixe) {
565
			switch ($suffixe) {
573
			switch ($suffixe) {
566
				case 'id' 			 :
574
				case 'id' 			 :
567
					$this->table_retour[str_replace('id.id', 'id', $champ.'.id')] = $valeur;
575
					$this->table_retour[str_replace('id.id', 'id', $champ.'.id')] = $valeur;
568
					break;
576
					break;
569
				case 'details' 		 :
577
				case 'details' 		 :
570
					$this->afficherTableDetails($champ, $valeur);
578
					$this->afficherTableDetails($champ, $valeur);
571
					break;
579
					break;
572
				case 'signification' :
580
				case 'signification' :
573
					$this->afficherSignification($champ, $valeur);
581
					$this->afficherSignification($champ, $valeur);
574
					break;
582
					break;
575
				case 'href' 		 :
583
				case 'href' 		 :
576
					$url = $this->creerUrl($champ, $valeur);
584
					$url = $this->creerUrl($champ, $valeur);
577
					$this->table_retour[str_replace('id.href', 'href', $champ.'.href')] = $url;
585
					$this->table_retour[str_replace('id.href', 'href', $champ.'.href')] = $url;
578
					break;
586
					break;
579
				case 'code' 		 :
587
				case 'code' 		 :
580
					$this->table_retour[$champ.'.code'] = $this->obtenirCode($champ, $valeur);
588
					$this->table_retour[$champ.'.code'] = $this->obtenirCode($champ, $valeur);
581
					break;
589
					break;
582
				case 'notes' 		 :
590
				case 'notes' 		 :
583
					$this->table_retour[$champ.'.notes'] = $this->resultat_req[str_replace('.', '_', $champ).'_notes'];
591
					$this->table_retour[$champ.'.notes'] = $this->resultat_req[str_replace('.', '_', $champ).'_notes'];
584
					break;
592
					break;
585
				default : break;
593
				default : break;
586
			}
594
			}
587
		}
595
		}
588
	}
596
	}
589
 
597
 
590
	public function afficherTableDetails($nom_champ_api, $valeur) {
598
	public function afficherTableDetails($nom_champ_api, $valeur) {
591
		$tab_id = explode(',', $valeur);
599
		$tab_id = explode(',', $valeur);
592
		$tab_res = $this->table_retour;
600
		$tab_res = $this->table_retour;
593
		$this->table_retour = array();
601
		$this->table_retour = array();
594
		foreach ($tab_id as $id) {
602
		foreach ($tab_id as $id) {
595
			$this->afficherInfosPrecises($nom_champ_api, 'id,signification,href', $id);
603
			$this->afficherInfosPrecises($nom_champ_api, 'id,signification,href', $id);
596
			$tab_res[$nom_champ_api.'.details'][] = $this->table_retour;
604
			$tab_res[$nom_champ_api.'.details'][] = $this->table_retour;
597
			$this->table_retour = array();
605
			$this->table_retour = array();
598
		}
606
		}
599
		$this->table_retour = $tab_res;
607
		$this->table_retour = $tab_res;
600
	}
608
	}
601
 
609
 
602
	private function obtenirCode($champ, $valeur) {
610
	private function obtenirCode($champ, $valeur) {
603
		$code = $this->transformerChampEnCode($champ);
611
		$code = $this->transformerChampEnCode($champ);
604
		return "bdnt.$code:$valeur";
612
		return "bdnt.$code:$valeur";
605
	}
613
	}
606
 
614
 
607
	private function transformerChampEnCode($champ) {
615
	private function transformerChampEnCode($champ) {
608
		if (is_null($this->relationsChampsCodesOntologie)) {
616
		if (is_null($this->relationsChampsCodesOntologie)) {
609
			$this->relationsChampsCodesOntologie = Outils::recupererTableauConfig('ChampsCodesOntologie');
617
			$this->relationsChampsCodesOntologie = Outils::recupererTableauConfig('ChampsCodesOntologie');
610
		}
618
		}
611
 
619
 
612
		$code = $champ;
620
		$code = $champ;
613
		if (array_key_exists($champ, $this->relationsChampsCodesOntologie)) {
621
		if (array_key_exists($champ, $this->relationsChampsCodesOntologie)) {
614
			$code = $this->relationsChampsCodesOntologie[$champ];
622
			$code = $this->relationsChampsCodesOntologie[$champ];
615
		}
623
		}
616
		return $code;
624
		return $code;
617
	}
625
	}
618
 
626
 
619
	public function creerUrl($champ, $valeur) {
627
	public function creerUrl($champ, $valeur) {
620
		if ($this->correspondAUnId($champ) || $champ == 'id') {
628
		if ($this->correspondAUnId($champ) || $champ == 'id') {
621
			$service = $this->service_href;
629
			$service = $this->service_href;
622
			$url = $this->ajouterHref($service, $valeur);
630
			$url = $this->ajouterHref($service, $valeur);
623
		} else {
631
		} else {
624
			$code = $this->transformerChampEnCode($champ);
632
			$code = $this->transformerChampEnCode($champ);
625
			$url = $this->ajouterHrefAutreProjet('ontologies', "$code:", $valeur, 'bdnt');
633
			$url = $this->ajouterHrefAutreProjet('ontologies', "$code:", $valeur, 'bdnt');
626
		}
634
		}
627
		return $url;
635
		return $url;
628
	}
636
	}
629
 
637
 
630
	public function afficherSignification($champ, $valeur) {
638
	public function afficherSignification($champ, $valeur) {
631
		if ($champ == 'id' && isset($this->resultat_req['nom_sci']) && $this->resultat_req['num_nom'] == $valeur) {
639
		if ($champ == 'id' && isset($this->resultat_req['nom_sci']) && $this->resultat_req['num_nom'] == $valeur) {
632
			//si le nom_sci du num_nom que l'on veut afficher est déjà dans la table de résultat :
640
			//si le nom_sci du num_nom que l'on veut afficher est déjà dans la table de résultat :
633
			$this->table_retour['nom_sci'] = $this->resultat_req['nom_sci'].
641
			$this->table_retour['nom_sci'] = $this->resultat_req['nom_sci'].
634
				$this->ajouterCompositionNom($this->resultat_req);
642
				$this->ajouterCompositionNom($this->resultat_req);
635
		} elseif ($this->correspondAUnId($champ) || $champ == 'id') {
643
		} elseif ($this->correspondAUnId($champ) || $champ == 'id') {
636
			$nom = $this->recupererNomSci($valeur);
644
			$nom = $this->recupererNomSci($valeur);
637
			if ($nom != array()) {
645
			if ($nom != array()) {
638
				$this->table_retour[$champ] = $nom['nom_sci'];
646
				$this->table_retour[$champ] = $nom['nom_sci'];
639
				$this->service_href = $nom['service'];
647
				$this->service_href = $nom['service'];
640
			}
648
			}
641
		} elseif ($this->correspondAUnCode($champ)) {
649
		} elseif ($this->correspondAUnCode($champ)) {
642
			$this->table_retour[$champ] = $this->ajouterSignificationCode($champ, $valeur);
650
			$this->table_retour[$champ] = $this->ajouterSignificationCode($champ, $valeur);
643
		}
651
		}
644
	}
652
	}
645
 
653
 
646
	/** Permet d'afficher les élements nomenclatural du nom_sci lors de l'appel dans le service noms/id/champ du champ^nom_sci.*/
654
	/** Permet d'afficher les élements nomenclatural du nom_sci lors de l'appel dans le service noms/id/champ du champ^nom_sci.*/
647
	public function afficherNomSciPointEpithete($resultat) {
655
	public function afficherNomSciPointEpithete($resultat) {
648
		$tab_nom_sci   = array('nom_supra_generique', 'genre', 'epithete_infra_generique', 'epithete_sp',
656
		$tab_nom_sci   = array('nom_supra_generique', 'genre', 'epithete_infra_generique', 'epithete_sp',
649
		'type_epithete', 'epithete_infra_sp', 'cultivar_groupe', 'cultivar', 'nom_commercial');
657
		'type_epithete', 'epithete_infra_sp', 'cultivar_groupe', 'cultivar', 'nom_commercial');
650
		foreach ($tab_nom_sci as $compo_nom) {
658
		foreach ($tab_nom_sci as $compo_nom) {
651
			if (isset($resultat[$compo_nom]) && !empty($resultat[$compo_nom])) {
659
			if (isset($resultat[$compo_nom]) && !empty($resultat[$compo_nom])) {
652
				$this->table_retour['nom_sci.'.$compo_nom] = $resultat[$compo_nom];
660
				$this->table_retour['nom_sci.'.$compo_nom] = $resultat[$compo_nom];
653
			}
661
			}
654
		}
662
		}
655
	}
663
	}
656
 
664
 
657
	public function ajouterSignificationCode($champ, $valeur) {
665
	public function ajouterSignificationCode($champ, $valeur) {
658
		$champ = ($champ == 'rang') ? 'rangTaxo' : rtrim($champ, '_Co,_Ga');
666
		$champ = ($champ == 'rang') ? 'rangTaxo' : rtrim($champ, '_Co,_Ga');
659
		if (preg_match('/^([^_-]+)(?:_|-)([^_-]+)$/', $champ, $match)) {
667
		if (preg_match('/^([^_-]+)(?:_|-)([^_-]+)$/', $champ, $match)) {
660
			$champ = $match[1].ucfirst($match[2]);
668
			$champ = $match[1].ucfirst($match[2]);
661
		}
669
		}
662
		$url = Config::get('url_ontologie').$champ.':'.$valeur.'/nom';
670
		$url = Config::get('url_ontologie').$champ.':'.$valeur.'/nom';
663
		$res = $this->consulterHref($url); //dans commun.php
671
		$res = $this->consulterHref($url); //dans commun.php
664
		$nom_code = $valeur;
672
		$nom_code = $valeur;
665
		if (is_object($res)) {
673
		if (is_object($res)) {
666
			$nom_code = $res->nom;
674
			$nom_code = $res->nom;
667
		}
675
		}
668
		return $nom_code;
676
		return $nom_code;
669
	}
677
	}
670
 
678
 
671
	public function recupererNomSci($id) {
679
	public function recupererNomSci($id) {
672
		$nom = array();
680
		$nom = array();
673
		if ($id != 0) {
681
		if ($id != 0) {
674
			if ($this->compo_nom == null) {
682
			if ($this->compo_nom == null) {
675
				$req = 'SELECT nom_sci, num_nom_retenu FROM '.$this->table.' WHERE num_nom = '.$id;
683
				$req = 'SELECT nom_sci, num_nom_retenu FROM '.$this->table.' WHERE num_nom = '.$id;
676
			} else { //on ajoute à la requete sql, les champs de ns.structure
684
			} else { //on ajoute à la requete sql, les champs de ns.structure
677
				//print_r($this->compo_nom);
685
				//print_r($this->compo_nom);
678
				$req = 'SELECT nom_sci, num_nom_retenu, '.implode(', ', $this->compo_nom)
686
				$req = 'SELECT nom_sci, num_nom_retenu, '.implode(', ', $this->compo_nom)
679
						.' FROM '.$this->table
687
						.' FROM '.$this->table
680
						.' WHERE num_nom = '.$id;
688
						.' WHERE num_nom = '.$id;
681
			}
689
			}
682
			if ($this->parametres['ns.format'] == 'htm') {
690
			if ($this->parametres['ns.format'] == 'htm') {
683
				$req = str_replace('nom_sci', 'nom_sci_html as nom_sci', $req);
691
				$req = str_replace('nom_sci', 'nom_sci_html as nom_sci', $req);
684
			}
692
			}
685
			$res = $this->getBdd()->recuperer($req);
693
			$res = $this->getBdd()->recuperer($req);
686
			if ($res) {
694
			if ($res) {
687
				$nom['nom_sci']	= $res['nom_sci'].$this->ajouterCompositionNom($res);
695
				$nom['nom_sci']	= $res['nom_sci'].$this->ajouterCompositionNom($res);
688
				$nom['service'] = ($res['num_nom_retenu'] == $id && $this->service == 'taxons') ? 'taxons' : 'noms';
696
				$nom['service'] = ($res['num_nom_retenu'] == $id && $this->service == 'taxons') ? 'taxons' : 'noms';
689
			}
697
			}
690
		}
698
		}
691
		return $nom;
699
		return $nom;
692
	}
700
	}
693
 
701
 
694
	/** Permet de retourner une chaine de caractère composée des parametres du nom (ns.structure : annnée, auteur,
702
	/** Permet de retourner une chaine de caractère composée des parametres du nom (ns.structure : annnée, auteur,
695
	 * bibilio et addendum). A ajouter au nom scientifique */
703
	 * bibilio et addendum). A ajouter au nom scientifique */
696
	public function ajouterCompositionNom($tab_res) {
704
	public function ajouterCompositionNom($tab_res) {
697
		$nom = '';
705
		$nom = '';
698
		if (isset($this->compo_nom)) {
706
		if (isset($this->compo_nom)) {
699
			$compo_nom = null;
707
			$compo_nom = null;
700
			$nom_complet = null;
708
			$nom_complet = null;
701
			if ($this->parametres['ns.format'] == 'htm') {
709
			if ($this->parametres['ns.format'] == 'htm') {
702
				$format = array(
710
				$format = array(
703
					'au' => '<span class="auteur">%s</span>',
711
					'au' => '<span class="auteur">%s</span>',
704
					'an' => '[<span class="annee">%s</span>]',
712
					'an' => '[<span class="annee">%s</span>]',
705
					'an_bib' => '[<span class="annee">%s</span>, <span class="biblio">%s</span>]',
713
					'an_bib' => '[<span class="annee">%s</span>, <span class="biblio">%s</span>]',
706
					'bib' => '[<span class="biblio">%s</span>]',
714
					'bib' => '[<span class="biblio">%s</span>]',
707
					'ad' => '[<span class="adendum">%s</span>]');
715
					'ad' => '[<span class="adendum">%s</span>]');
708
			} else {
716
			} else {
709
				$format = array(
717
				$format = array(
710
					'au' => '%s',
718
					'au' => '%s',
711
					'an' => '[%s]',
719
					'an' => '[%s]',
712
					'an_bib' => '[%s, %s]',
720
					'an_bib' => '[%s, %s]',
713
					'bib' => '[%s]',
721
					'bib' => '[%s]',
714
					'ad' => '[%s]');
722
					'ad' => '[%s]');
715
			}
723
			}
716
			foreach ($this->compo_nom as $key => $champ) {
724
			foreach ($this->compo_nom as $key => $champ) {
717
				if (isset($tab_res[$champ]) && !empty($tab_res[$champ])) {
725
				if (isset($tab_res[$champ]) && !empty($tab_res[$champ])) {
718
					$compo_nom[$key] = $tab_res[$champ];
726
					$compo_nom[$key] = $tab_res[$champ];
719
				}
727
				}
720
			}
728
			}
721
			$this->formerNomComplet($compo_nom, $nom_complet, $format);
729
			$this->formerNomComplet($compo_nom, $nom_complet, $format);
722
			$nom = ' '.implode(' ', $nom_complet);
730
			$nom = ' '.implode(' ', $nom_complet);
723
		}
731
		}
724
		return rtrim($nom, ' ');
732
		return rtrim($nom, ' ');
725
	}
733
	}
726
 
734
 
727
 
735
 
728
	public function formerNomComplet(&$compo_nom, &$nom_complet, $format) {
736
	public function formerNomComplet(&$compo_nom, &$nom_complet, $format) {
729
		extract($compo_nom);
737
		extract($compo_nom);
730
		if (isset($au)) $nom_complet[] = sprintf($format['au'], $au);
738
		if (isset($au)) $nom_complet[] = sprintf($format['au'], $au);
731
		if (isset($an)) {
739
		if (isset($an)) {
732
			if (isset($bib)) {
740
			if (isset($bib)) {
733
				$nom_complet[] = sprintf($format['an_bib'], $an, $bib);
741
				$nom_complet[] = sprintf($format['an_bib'], $an, $bib);
734
			} else {
742
			} else {
735
				$nom_complet[] = sprintf($format['an'], $an);
743
				$nom_complet[] = sprintf($format['an'], $an);
736
			}
744
			}
737
		} elseif (isset($bib)) {
745
		} elseif (isset($bib)) {
738
			$nom_complet[] = sprintf($format['bib'], $bib);
746
			$nom_complet[] = sprintf($format['bib'], $bib);
739
		}
747
		}
740
		if (isset($ad)) $nom_complet[] = sprintf($format['ad'], $ad);
748
		if (isset($ad)) $nom_complet[] = sprintf($format['ad'], $ad);
741
		return $nom_complet;
749
		return $nom_complet;
742
	}
750
	}
743
 
751
 
744
 
752
 
745
	public function correspondAUnCode($key) {
753
	public function correspondAUnCode($key) {
746
		return (strrpos($key, '.code') !== false) || (in_array($key.'.code', $this->correspondance_champs));
754
		return (strrpos($key, '.code') !== false) || (in_array($key.'.code', $this->correspondance_champs));
747
	}
755
	}
748
 
756
 
749
	public function correspondAUnId($key) {
757
	public function correspondAUnId($key) {
750
		return (strrpos($key, '.id') !== false) || (in_array($key.'.id', $this->correspondance_champs));
758
		return (strrpos($key, '.id') !== false) || (in_array($key.'.id', $this->correspondance_champs));
751
	}
759
	}
752
 
760
 
753
	public function estUnPoint($key) {
761
	public function estUnPoint($key) {
754
		if (strrpos($key, 'hybride.parent') !== false) {
762
		if (strrpos($key, 'hybride.parent') !== false) {
755
			$key = str_replace('hybride.parent', 'hybride_parent', $key);
763
			$key = str_replace('hybride.parent', 'hybride_parent', $key);
756
		}
764
		}
757
		return (strrpos($key, '.') !== false);
765
		return (strrpos($key, '.') !== false);
758
	}
766
	}
759
 
767
 
760
	public function recupererMasquePrincipal() {
768
	public function recupererMasquePrincipal() {
761
		$masque = null;
769
		$masque = null;
762
		$tab_masque   = array(
770
		$tab_masque   = array(
763
			'masque' => 'nom_sci',
771
			'masque' => 'nom_sci',
764
			'masque_sg' => 'nom_supra_generique',
772
			'masque_sg' => 'nom_supra_generique',
765
			'masque_gen' => 'genre',
773
			'masque_gen' => 'genre',
766
			'masque_sp' => 'epithete_sp',
774
			'masque_sp' => 'epithete_sp',
767
			'masque_ssp' => 'epithete_infra_sp',
775
			'masque_ssp' => 'epithete_infra_sp',
768
			'masque_au' => 'auteur',
776
			'masque_au' => 'auteur',
769
			'masque_an' => 'annee',
777
			'masque_an' => 'annee',
770
			'masque_bib' => 'biblio_origine',
778
			'masque_bib' => 'biblio_origine',
771
			'masque_ad' => 'addendum',
779
			'masque_ad' => 'addendum',
772
			'masque_rg' => 'rang');
780
			'masque_rg' => 'rang');
773
		$liste_masque = array();
781
		$liste_masque = array();
774
 
782
 
775
		if (isset($this->masque['num_nom'])) {
783
		if (isset($this->masque['num_nom'])) {
776
			$liste_masque[] = $this->masque['num_nom'];
784
			$liste_masque[] = $this->masque['num_nom'];
777
		}
785
		}
778
 
786
 
779
		foreach ($tab_masque as $key => $filtre) {
787
		foreach ($tab_masque as $key => $filtre) {
780
            if (isset($this->masque[$filtre])) {
788
            if (isset($this->masque[$filtre])) {
781
            	if (!isset($masque) && !in_array($filtre, array('rang', 'annee'))) {
789
            	if (!isset($masque) && !in_array($filtre, array('rang', 'annee'))) {
782
            		$masque = array($key, $filtre);
790
            		$masque = array($key, $filtre);
783
            	}
791
            	}
784
                $liste_masque[] = $this->masque[$filtre];
792
                $liste_masque[] = $this->masque[$filtre];
785
            }
793
            }
786
        }
794
        }
787
        $this->masque = $liste_masque;
795
        $this->masque = $liste_masque;
788
        return $masque;
796
        return $masque;
789
	}
797
	}
790
}
798
}
791
?>
799
?>