Subversion Repositories Applications.referentiel

Rev

Rev 277 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 277 Rev 295
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe Controleur du module Fiche Taxon.
4
 * Classe Controleur du module Fiche Taxon.
5
 *
5
 *
6
 * @category	Php 5.2
6
 * @category	Php 5.2
7
 * @package		Taxon
7
 * @package		Taxon
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @copyright	2010 Tela-Botanica
9
 * @copyright	2010 Tela-Botanica
10
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
10
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @version		SVN: $Id: Fiche.php 96 2010-06-21 16:46:31Z jpm $
12
 * @version		SVN: $Id: Fiche.php 96 2010-06-21 16:46:31Z jpm $
13
 */
13
 */
14
class FicheTaxon extends AppliControleur {
14
class FicheTaxon extends AppliControleur {
15
	
15
	
16
	private $donnees = array();
16
	private $donnees = array();
17
	protected $taxonDao = null;
17
	protected $taxonDao = null;
18
	private $tableau_manuel = null;
18
	private $tableau_manuel = null;
19
	private $num_taxon = array(0=>0,1=>0,2=>0);
19
	private $num_taxon = array(0=>0,1=>0,2=>0);
20
	
20
	
21
	//+----------------------------------------------------------------------------------------------------------------+
21
	//+----------------------------------------------------------------------------------------------------------------+
22
	// Méthodes
22
	// Méthodes
23
	/**
23
	/**
24
	 * Fonction d'affichage par défaut
24
	 * Fonction d'affichage par défaut
25
	 */
25
	 */
26
	public function executerActionParDefaut() {
26
	public function executerActionParDefaut() {
27
		return $this->afficherTaxon();
27
		return $this->afficherTaxon();
28
	}
28
	}
29
	
29
	
30
	// +---------------------------------------------------------------------------------------------------------------+
30
	// +---------------------------------------------------------------------------------------------------------------+
31
	// FICHE CONSULTATION TAXON
31
	// FICHE CONSULTATION TAXON
32
	public function afficherTaxon() {
32
	public function afficherTaxon() {
33
		// Récupération du référentiel
33
		// Récupération du référentiel
34
		if (isset($_GET['ref'])) { 
34
		if (isset($_GET['ref'])) { 
35
			$this->referentiel = strtolower($_GET['ref']);
35
			$this->referentiel = strtolower($_GET['ref']);
36
		}
36
		}
37
		// Gestion des actions par défaut
37
		// Gestion des actions par défaut
38
		$this->taxonDao = new TaxonDao();
38
		$this->taxonDao = new TaxonDao();
39
		$this->definirCommeModulePrincipal(get_class($this));
39
		$this->definirCommeModulePrincipal(get_class($this));
40
		$this->construireMenu($this->referentiel);
40
		$this->construireMenu($this->referentiel);
41
		$this->construireFilAriane($this->referentiel);
41
		$this->construireFilAriane($this->referentiel);
42
		$this->executerActionReferentiel('Recherche', 'chargerMoteurRecherche', $this->referentiel, 10);
42
		$this->executerActionReferentiel('Recherche', 'chargerMoteurRecherche', $this->referentiel, 10);
43
		
43
		
44
		// Gestion des données de la requête
44
		// Gestion des données de la requête
45
		if (!isset($_GET['num_nom'])) {
45
		if (!isset($_GET['num_nom'])) {
46
			
46
			
47
		} else {
47
		} else {
48
			// Récupération des données
48
			// Récupération des données
49
			$this->donnees['referentiel'] = $this->referentiel;
49
			$this->donnees['referentiel'] = $this->referentiel;
50
			$this->donnees['num_nom'] = $_GET['num_nom'];
50
			$this->donnees['num_nom'] = $_GET['num_nom'];
51
			$this->donnees['info'] = $this->taxonDao->getTaxon($this->referentiel, $this->donnees['num_nom']);
51
			$this->donnees['info'] = $this->taxonDao->getTaxon($this->referentiel, $this->donnees['num_nom']);
52
			$this->donnees['num_nom_retenu'] = $this->donnees['info']['num_nom_retenu'];
52
			$this->donnees['num_nom_retenu'] = $this->donnees['info']['num_nom_retenu'];
53
			$this->donnees['nom'] = $this->donnees['info']['nom_sci'];
53
			$this->donnees['nom'] = $this->donnees['info']['nom_sci'];
54
			$this->donnees['exclu_taxref'] = $this->donnees['info']['exclure_taxref'];
54
			$this->donnees['exclu_taxref'] = $this->donnees['info']['exclure_taxref'];
55
			
55
			
56
			if ($this->donnees['info'] != '') {
56
			if ($this->donnees['info'] != '') {
57
				// Chargement des données des onglets
57
				// Chargement des données des onglets
58
				$this->chargerNomenclature();
58
				$this->chargerNomenclature();
59
				$this->chargerSynonymie();
59
				$this->chargerSynonymie();
60
				$this->chargerClassification();
60
				$this->chargerClassification();
61
				$this->chargerChorologie();
61
				$this->chargerChorologie();
62
				$this->chargerComplements();
62
				$this->chargerComplements();
63
			}
63
			}
64
			
-
 
65
			$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_taxon', $this->donnees));
64
			$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_taxon', $this->donnees));
66
		}
65
		}
67
	}
66
	}
68
	
67
	
69
	private function chargerNomenclature() {
68
	private function chargerNomenclature() {
70
		$this->donnees['selectionne'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom']);
69
		$this->donnees['selectionne'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom']);
71
		if ($this->donnees['num_nom'] != $this->donnees['num_nom_retenu'] && $this->donnees['num_nom_retenu'] != '') {
70
		if ($this->donnees['num_nom'] != $this->donnees['num_nom_retenu'] && $this->donnees['num_nom_retenu'] != '') {
72
			$this->donnees['retenu'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom_retenu']);
71
			$this->donnees['retenu'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom_retenu']);
73
		} 
72
		} 
74
		if ($this->donnees['info']['hybride_parent_01'] != '' && $this->donnees['info']['hybride_parent_02'] != '') {
73
		if ($this->donnees['info']['hybride_parent_01'] != '' && $this->donnees['info']['hybride_parent_02'] != '') {
75
			$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom']);
74
			$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom']);
76
		} elseif ($this->donnees['info']['hybride_parent_01'] != '' || $this->donnees['info']['hybride_parent_02'] != ''){
75
		} elseif ($this->donnees['info']['hybride_parent_01'] != '' || $this->donnees['info']['hybride_parent_02'] != ''){
77
			$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom']);
76
			$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom']);
78
		}
77
		}
79
	}
78
	}
80
	
79
	
81
	// recherche les synonymes (à compléter)
80
	// recherche les synonymes (à compléter)
82
	private function chargerSynonymie() {
81
	private function chargerSynonymie() {
83
		$rechercheDao = new RechercheDao();
82
		$rechercheDao = new RechercheDao();
84
		// recherche des synonymes nomenclaturaux et taxonomiques
83
		// recherche des synonymes nomenclaturaux et taxonomiques
85
		$parametres = $this->parserChaineDeRecherche('nn:'.$this->donnees['num_nom'].' tax:1');
84
		$parametres = $this->parserChaineDeRecherche('nn:'.$this->donnees['num_nom'].' tax:1');
86
		$parametres['ref']= $this->referentiel;
85
		$parametres['ref']= $this->referentiel;
87
		$synonymes = $rechercheDao->chercher('ParTaxon', $parametres); 
86
		$synonymes = $rechercheDao->chercher('ParTaxon', $parametres); 
88
		if ($synonymes != '') {
87
		if ($synonymes != '') {
89
			$this->donnees['syn'] = $synonymes;
88
			$this->donnees['syn'] = $synonymes;
90
		}
89
		}
91
		// synonyme proparte
90
		// synonyme proparte
92
		if ($this->donnees['info']['synonyme_proparte'] != ''){
91
		if ($this->donnees['info']['synonyme_proparte'] != ''){
93
			$propartes = explode(',', $this->donnees['info']['synonyme_proparte']);
92
			$propartes = explode(',', $this->donnees['info']['synonyme_proparte']);
94
			foreach ($propartes as $proparte) {
93
			foreach ($propartes as $proparte) {
95
				$this->donnees['pp'][] = $this->taxonDao->getTaxonAffichage($this->referentiel, trim($proparte));
94
				$this->donnees['pp'][] = $this->taxonDao->getTaxonAffichage($this->referentiel, trim($proparte));
96
			}
95
			}
97
		}
96
		}
98
		// homonymie
97
		// homonymie
99
		$nom = $this->encodeChaine($this->donnees['info']['nom_sci']);
98
		$nom = $this->encodeChaine($this->donnees['info']['nom_sci']);
100
		$homonymes = $this->taxonDao->getHomonyme($this->referentiel, $nom);
99
		$homonymes = $this->taxonDao->getHomonyme($this->referentiel, $nom);
101
		if (count($homonymes) > 1) {
100
		if (count($homonymes) > 1) {
102
			foreach ($homonymes as $id => &$homonyme) {
101
			foreach ($homonymes as $id => &$homonyme) {
103
				$homonyme['statut'] = $homonyme['homonyme'];
102
				$homonyme['statut'] = $homonyme['homonyme'];
104
			}
103
			}
105
			
104
			
106
			$this->donnees['h'] = $homonymes;
105
			$this->donnees['h'] = $homonymes;
107
		}
106
		}
108
	}
107
	}
109
	
108
	
110
	private function chargerChorologie() {
109
	private function chargerChorologie() {
111
		$this->chargerTableauManuel('presence');
110
		$this->chargerTableauManuel('presence');
112
		$this->chargerTableauManuel('statuts_origine');
111
		$this->chargerTableauManuel('statuts_origine');
113
		$this->chargerTableauManuel('statuts_introduction');
112
		$this->chargerTableauManuel('statuts_introduction');
114
		$this->chargerTableauManuel('statuts_culture');
113
		$this->chargerTableauManuel('statuts_culture');
115
		foreach ($this->donnees['info'] as $param => $valeur) {
114
		foreach ($this->donnees['info'] as $param => $valeur) {
116
			if ($param == 'presence') {
115
			if ($param == 'presence') {
117
				$this->donnees['chorologie']['Présence']['France']['code'] = $valeur;
116
				$this->donnees['chorologie']['Présence']['France']['code'] = $valeur;
118
				$this->donnees['chorologie']['Présence']['France']['valeur'] = $this->tableau_manuel['presence'][$valeur];
117
				$this->donnees['chorologie']['Présence']['France']['valeur'] = $this->tableau_manuel['presence'][$valeur];
119
			} elseif (preg_match('/presence_(.*)/', $param, $lieu)) {
118
			} elseif (preg_match('/presence_(.*)/', $param, $lieu)) {
120
				$this->donnees['chorologie']['Présence'][$lieu['1']]['code'] = $valeur;
119
				$this->donnees['chorologie']['Présence'][$lieu['1']]['code'] = $valeur;
121
				$this->donnees['chorologie']['Présence'][$lieu['1']]['valeur'] = $this->tableau_manuel['presence'][$valeur];
120
				$this->donnees['chorologie']['Présence'][$lieu['1']]['valeur'] = $this->tableau_manuel['presence'][$valeur];
122
			} elseif ($param == 'statut_origine') {
121
			} elseif ($param == 'statut_origine') {
123
				$this->donnees['chorologie']['Statut d\'origine']['France']['code'] = $valeur;
122
				$this->donnees['chorologie']['Statut d\'origine']['France']['code'] = $valeur;
124
				$this->donnees['chorologie']['Statut d\'origine']['France']['valeur'] = 
123
				$this->donnees['chorologie']['Statut d\'origine']['France']['valeur'] = 
125
					$this->tableau_manuel['statuts_origine'][$valeur];
124
					$this->tableau_manuel['statuts_origine'][$valeur];
126
			} elseif (preg_match('/statut_origine_(.*)/', $param, $lieu)) {
125
			} elseif (preg_match('/statut_origine_(.*)/', $param, $lieu)) {
127
				$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['code'] = $valeur;
126
				$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['code'] = $valeur;
128
				$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['valeur'] = 
127
				$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['valeur'] = 
129
					$this->tableau_manuel['statuts_origine'][$valeur];
128
					$this->tableau_manuel['statuts_origine'][$valeur];
130
			} elseif ($param == 'statut_introduction') {
129
			} elseif ($param == 'statut_introduction') {
131
				$this->donnees['chorologie']['Statut d\'introduction']['France']['code'] = $valeur;
130
				$this->donnees['chorologie']['Statut d\'introduction']['France']['code'] = $valeur;
132
				$this->donnees['chorologie']['Statut d\'introduction']['France']['valeur'] = 
131
				$this->donnees['chorologie']['Statut d\'introduction']['France']['valeur'] = 
133
					$this->tableau_manuel['statuts_introduction'][$valeur];
132
					$this->tableau_manuel['statuts_introduction'][$valeur];
134
			} elseif (preg_match('/statut_introduction_(.*)/', $param, $lieu)) {
133
			} elseif (preg_match('/statut_introduction_(.*)/', $param, $lieu)) {
135
				$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['code'] = $valeur;
134
				$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['code'] = $valeur;
136
				$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['valeur'] = 
135
				$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['valeur'] = 
137
					$this->tableau_manuel['statuts_introduction'][$valeur];
136
					$this->tableau_manuel['statuts_introduction'][$valeur];
138
			} elseif ($param == 'statut_culture') {
137
			} elseif ($param == 'statut_culture') {
139
				$this->donnees['chorologie']['Statut de culture']['France']['code'] = $valeur;
138
				$this->donnees['chorologie']['Statut de culture']['France']['code'] = $valeur;
140
				$this->donnees['chorologie']['Statut de culture']['France']['valeur'] = 
139
				$this->donnees['chorologie']['Statut de culture']['France']['valeur'] = 
141
					$this->tableau_manuel['statuts_culture'][$valeur];
140
					$this->tableau_manuel['statuts_culture'][$valeur];
142
			} elseif (preg_match('/statut_culture_(.*)/', $param, $lieu)) {
141
			} elseif (preg_match('/statut_culture_(.*)/', $param, $lieu)) {
143
				$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['code'] = $valeur;
142
				$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['code'] = $valeur;
144
				$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['valeur'] = 
143
				$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['valeur'] = 
145
					$this->tableau_manuel['statuts_culture'][$valeur];
144
					$this->tableau_manuel['statuts_culture'][$valeur];
146
			}
145
			}
147
		}
146
		}
148
		foreach ($this->donnees['chorologie']['Présence'] as $lieu => $valeur) {
147
		foreach ($this->donnees['chorologie']['Présence'] as $lieu => $valeur) {
149
			if (!isset($this->donnees['chorologie']['Statut d\'origine'][$lieu])) {
148
			if (!isset($this->donnees['chorologie']['Statut d\'origine'][$lieu])) {
150
				$this->donnees['chorologie']['Statut d\'origine'][$lieu]['code'] = '';
149
				$this->donnees['chorologie']['Statut d\'origine'][$lieu]['code'] = '';
151
			}
150
			}
152
			if (!isset($this->donnees['chorologie']['Statut d\'introduction'][$lieu])) {
151
			if (!isset($this->donnees['chorologie']['Statut d\'introduction'][$lieu])) {
153
				$this->donnees['chorologie']['Statut d\'introduction'][$lieu]['code'] = '';
152
				$this->donnees['chorologie']['Statut d\'introduction'][$lieu]['code'] = '';
154
			}
153
			}
155
			if (!isset($this->donnees['chorologie']['Statut de culture'][$lieu])) {
154
			if (!isset($this->donnees['chorologie']['Statut de culture'][$lieu])) {
156
				$this->donnees['chorologie']['Statut de culture'][$lieu]['code'] = '';
155
				$this->donnees['chorologie']['Statut de culture'][$lieu]['code'] = '';
157
			}
156
			}
158
		}
157
		}
159
	}
158
	}
160
	
159
	
161
	private function chargerClassification() {
160
	private function chargerClassification() {
162
		$this->chargerTableauManuel('signification_rang');
161
		$this->chargerTableauManuel('signification_rang');
163
		$this->chargerTableauManuel('presence');
162
		$this->chargerTableauManuel('presence');
164
		$this->donnees['valeur_rang'] = $this->tableau_manuel['signification_rang'];
163
		$this->donnees['valeur_rang'] = $this->tableau_manuel['signification_rang'];
165
		$this->donnees['valeur_presence'] = $this->tableau_manuel['presence'];
164
		$this->donnees['valeur_presence'] = $this->tableau_manuel['presence'];
166
		if ($this->donnees['info']['num_tax_sup'] != '' && $this->donnees['info']['num_tax_sup'] !== "0") {
165
		if ($this->donnees['info']['num_tax_sup'] != '' && $this->donnees['info']['num_tax_sup'] !== "0") {
167
			$this->donnees['classification']['supérieurs'] = array_reverse($this->taxonDao->getClassification
166
			$this->donnees['classification']['supérieurs'] = array_reverse($this->taxonDao->getClassification
168
				('Superieur', $this->referentiel, $this->donnees['info']['num_tax_sup']));
167
				('Superieur', $this->referentiel, $this->donnees['info']['num_tax_sup']));
169
		} elseif (isset($this->donnees['retenu']['num_tax_sup']) && ($this->donnees['retenu']['num_tax_sup'] != '')) {
168
		} elseif (isset($this->donnees['retenu']['num_tax_sup']) && ($this->donnees['retenu']['num_tax_sup'] != '')) {
170
			$this->donnees['classification']['supérieurs'] = array_reverse($this->taxonDao->getClassification
169
			$this->donnees['classification']['supérieurs'] = array_reverse($this->taxonDao->getClassification
171
				('Superieur', $this->referentiel, $this->donnees['retenu']['num_tax_sup']));
170
				('Superieur', $this->referentiel, $this->donnees['retenu']['num_tax_sup']));
172
		}	
171
		}	
173
		if ($this->donnees['num_nom_retenu'] != '') {
172
		if ($this->donnees['num_nom_retenu'] != '') {
174
			$class_inf = $this->taxonDao->getClassification
173
			$class_inf = $this->taxonDao->getClassification
175
				('Inferieur', $this->referentiel, $this->donnees['num_nom_retenu']);
174
				('Inferieur', $this->referentiel, $this->donnees['num_nom_retenu']);
176
			if ($class_inf != '') {
175
			if ($class_inf != '') {
177
				$this->donnees['classification']['inférieurs'] = $class_inf['inf'];	
176
				$this->donnees['classification']['inférieurs'] = $class_inf['inf'];	
178
				$this->donnees['niveau'] = $class_inf['niveau'];
177
				$this->donnees['niveau'] = $class_inf['niveau'];
179
				arsort($class_inf['nb_par_rang']);
178
				arsort($class_inf['nb_par_rang']);
180
				$this->donnees['noms_rang'] = $class_inf['nb_par_rang'];
179
				$this->donnees['noms_rang'] = $class_inf['nb_par_rang'];
181
			}
180
			}
182
		}	
181
		}	
183
	}
182
	}
184
	
183
	
185
	private function chargerComplements() {
184
	private function chargerComplements() {
186
		$champs_manuel_technique = explode(',', $this->manuel['champs']);
185
		$champs_manuel_technique = explode(',', $this->manuel['champs']);
187
		$champs_base_donnees = key($this->donnees['info']);
186
		$champs_base_donnees = key($this->donnees['info']);
188
		$champs_supp_base = array_diff_key($this->donnees['info'], array_flip($champs_manuel_technique));
187
		$champs_supp_base = array_diff_key($this->donnees['info'], array_flip($champs_manuel_technique));
189
		foreach ($champs_supp_base as $champ=>$valeur) {
188
		foreach ($champs_supp_base as $champ=>$valeur) {
190
			if (!(preg_match('/presence_(.*)/',$champ) || preg_match('/statut_origine_(.*)/', $champ) || 
189
			if (!(preg_match('/presence_(.*)/',$champ) || preg_match('/statut_origine_(.*)/', $champ) || 
191
				 preg_match('/statut_introduction_(.*)/', $champ) || preg_match('/statut_culture_(.*)/', $champ))) {
190
				 preg_match('/statut_introduction_(.*)/', $champ) || preg_match('/statut_culture_(.*)/', $champ))) {
192
				$this->donnees['complement'][$champ] = $valeur;
191
				$this->donnees['complement'][$champ] = $valeur;
193
			}
192
			}
194
		}
193
		}
195
	}
194
	}
196
	
195
	
197
	private function parserChaineDeRecherche($chaine) {		
196
	private function parserChaineDeRecherche($chaine) {		
198
		$mots = preg_split('/ /i', $chaine, -1, PREG_SPLIT_NO_EMPTY);
197
		$mots = preg_split('/ /i', $chaine, -1, PREG_SPLIT_NO_EMPTY);
199
		$parametres = array('mots' => '');
198
		$parametres = array('mots' => '');
200
		$cle_precedente = null;
199
		$cle_precedente = null;
201
		foreach ($mots as $mot) {
200
		foreach ($mots as $mot) {
202
			if (preg_match('/^(sg|gen|sp|ssp|au|an|nn|bib|nr|tax):(.*)$/', $mot, $match)) {
201
			if (preg_match('/^(sg|gen|sp|ssp|au|an|nn|bib|nr|tax):(.*)$/', $mot, $match)) {
203
				$cle = $match[1];
202
				$cle = $match[1];
204
				$cle_precedente = $cle;
203
				$cle_precedente = $cle;
205
				$valeur = $match[2];
204
				$valeur = $match[2];
206
				$parametres[$cle] = $valeur;
205
				$parametres[$cle] = $valeur;
207
			} else if (!is_null($cle_precedente)) {
206
			} else if (!is_null($cle_precedente)) {
208
				$parametres[$cle_precedente] .= ' '.$mot;
207
				$parametres[$cle_precedente] .= ' '.$mot;
209
			} else if (is_null($cle_precedente)) {
208
			} else if (is_null($cle_precedente)) {
210
				if (empty($parametres['mots'])) {
209
				if (empty($parametres['mots'])) {
211
					$parametres['mots'] = $mot;
210
					$parametres['mots'] = $mot;
212
				} else {
211
				} else {
213
					$parametres['mots'] .= ' '.$mot;
212
					$parametres['mots'] .= ' '.$mot;
214
				}
213
				}
215
			}
214
			}
216
		}		
215
		}		
217
		return $parametres;
216
		return $parametres;
218
	}
217
	}
219
	
218
	
220
	public function encodeChaine($chaine) {
219
	public function encodeChaine($chaine) {
221
		if (Config::get('sortie_encodage') != Config::get('appli_encodage')) {
220
		if (Config::get('sortie_encodage') != Config::get('appli_encodage')) {
222
			$chaine = mb_convert_encoding($chaine, Config::get('sortie_encodage'), Config::get('appli_encodage'));
221
			$chaine = mb_convert_encoding($chaine, Config::get('sortie_encodage'), Config::get('appli_encodage'));
223
		}
222
		}
224
		$chaine = urlencode($chaine);
223
		$chaine = urlencode($chaine);
225
		return $chaine;
224
		return $chaine;
226
	}
225
	}
227
	
226
	
228
	// retourne l'url de la fiche taxon pour les liens 
227
	// retourne l'url de la fiche taxon pour les liens 
229
	public static function getUrlFicheTaxon($params, $type) {
228
	public static function getUrlFicheTaxon($params, $type = '') {
230
		$taxon = null;
229
		$taxon = null;
231
		switch ($type) {
230
		switch ($type) {
232
			case 'bas' : 
231
			case 'bas' : 
233
				$taxon['num_nom'] = $params['bas_num'];
232
				$taxon['num_nom'] = $params['bas_num'];
234
				break;
233
				break;
235
			case 'p1' :
234
			case 'p1' :
236
				$taxon['num_nom'] = $params['p1_num'];
235
				$taxon['num_nom'] = $params['p1_num'];
237
				break;
236
				break;
238
			case 'p2' : 
237
			case 'p2' : 
239
				$taxon['num_nom'] = $params['p2_num'];
238
				$taxon['num_nom'] = $params['p2_num'];
240
				break;
239
				break;
241
			default : $taxon['num_nom'] = $params;
240
			default : $taxon['num_nom'] = $params;
242
				break;
241
				break;
243
		}
242
		}
244
		return Recherche::getUrlFicheTaxon($taxon);
243
		return Recherche::getUrlFicheTaxon($taxon);
245
	}
244
	}
246
	
245
	
247
	// charger tableau de $this->manuel
246
	// charger tableau de $this->manuel
248
	private function chargerTableauManuel($titreTableau) {
247
	private function chargerTableauManuel($titreTableau) {
249
		$champs = explode(',', $this->manuel[$titreTableau]);
248
		$champs = explode(',', $this->manuel[$titreTableau]);
250
		foreach ($champs as $champ) {
249
		foreach ($champs as $champ) {
251
			list($champ_nom, $type) = explode('=', trim($champ));
250
			list($champ_nom, $type) = explode('=', trim($champ));
252
			$this->tableau_manuel[$titreTableau][$champ_nom] = $type;
251
			$this->tableau_manuel[$titreTableau][$champ_nom] = $type;
253
		}
252
		}
254
	}
253
	}
255
	
254
	
256
 
255
 
257
}
256
}