Subversion Repositories Applications.referentiel

Rev

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

Rev 260 Rev 277
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
			
64
			
65
			$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_taxon', $this->donnees));
65
			$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_taxon', $this->donnees));
66
		}
66
		}
67
	}
67
	}
68
	
68
	
69
	private function chargerNomenclature() {
69
	private function chargerNomenclature() {
70
		$this->donnees['selectionne'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom']);
70
		$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'] != '') {
71
		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']);
72
			$this->donnees['retenu'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom_retenu']);
73
		} 
73
		} 
74
		if ($this->donnees['info']['hybride_parent_01'] != '' && $this->donnees['info']['hybride_parent_02'] != '') {
74
		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']);
75
			$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'] != ''){
76
		} 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']);
77
			$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom']);
78
		}
78
		}
79
	}
79
	}
80
	
80
	
81
	// recherche les synonymes (à compléter)
81
	// recherche les synonymes (à compléter)
82
	private function chargerSynonymie() {
82
	private function chargerSynonymie() {
83
		$rechercheDao = new RechercheDao();
83
		$rechercheDao = new RechercheDao();
84
		// recherche des synonymes nomenclaturaux et taxonomiques
84
		// recherche des synonymes nomenclaturaux et taxonomiques
85
		$parametres = $this->parserChaineDeRecherche('nn:'.$this->donnees['num_nom'].' tax:1');
85
		$parametres = $this->parserChaineDeRecherche('nn:'.$this->donnees['num_nom'].' tax:1');
86
		$parametres['ref']= $this->referentiel;
86
		$parametres['ref']= $this->referentiel;
87
		$synonymes = $rechercheDao->chercher('ParTaxon', $parametres); 
87
		$synonymes = $rechercheDao->chercher('ParTaxon', $parametres); 
88
		if ($synonymes != '') {
88
		if ($synonymes != '') {
89
			foreach ($synonymes as $synonyme) {
-
 
90
				$this->trierSynonymesNomenclaturauxTaxonomiques($synonyme);
-
 
91
				$this->trierSynonymesMalAppliques($synonyme);
89
			$this->donnees['syn'] = $synonymes;
92
				$this->trierSynonymesOrthographiques($synonyme);
-
 
93
			}
-
 
94
		}
90
		}
95
		// synonyme proparte
91
		// synonyme proparte
96
		if ($this->donnees['info']['synonyme_proparte'] != ''){
92
		if ($this->donnees['info']['synonyme_proparte'] != ''){
97
			$propartes = explode(',', $this->donnees['info']['synonyme_proparte']);
93
			$propartes = explode(',', $this->donnees['info']['synonyme_proparte']);
98
			foreach ($propartes as $proparte) {
94
			foreach ($propartes as $proparte) {
99
				$this->donnees['pp'][] = $this->taxonDao->getTaxonAffichage($this->referentiel, trim($proparte));
95
				$this->donnees['pp'][] = $this->taxonDao->getTaxonAffichage($this->referentiel, trim($proparte));
100
			}
96
			}
101
		}
97
		}
102
		// homonymie
98
		// homonymie
103
		$nom = $this->encodeChaine($this->donnees['info']['nom_sci']);
99
		$nom = $this->encodeChaine($this->donnees['info']['nom_sci']);
104
		$homonymes = $this->taxonDao->getHomonyme($this->referentiel, $nom);
100
		$homonymes = $this->taxonDao->getHomonyme($this->referentiel, $nom);
105
		if (count($homonymes) > 1) {
101
		if (count($homonymes) > 1) {
106
			foreach ($homonymes as $id => &$homonyme) {
102
			foreach ($homonymes as $id => &$homonyme) {
107
				$homonyme['statut'] = $homonyme['homonyme'];
103
				$homonyme['statut'] = $homonyme['homonyme'];
108
			}
104
			}
109
			
105
			
110
			$this->donnees['h'] = $homonymes;
106
			$this->donnees['h'] = $homonymes;
111
		}
107
		}
112
	}
-
 
113
	
-
 
114
	private function trierSynonymesNomenclaturauxTaxonomiques($synonyme) {
-
 
115
		if ($this->donnees['num_nom'] != $synonyme['num_nom'] && $synonyme['basionyme'] != null) {
-
 
116
			if (($this->donnees['num_nom'] != $synonyme['num_nom']) && ($synonyme['basionyme'] == 
-
 
117
					$this->donnees['num_nom'] || $this->donnees['info']['basionyme'] == $synonyme['num_nom'] || 
-
 
118
					$this->donnees['info']['basionyme'] == $synonyme['basionyme'])) {
-
 
119
				$this->donnees['n'][] = $synonyme;	
-
 
120
			} elseif ($this->donnees['num_nom'] != $synonyme['num_nom'] && $synonyme['basionyme'] != null && 
-
 
121
					$this->donnees['info']['basionyme'] != null) {
-
 
122
				$this->donnees['t'][] = $synonyme;
-
 
123
			} else {
-
 
124
				$this->donnees['i'][] = $synonyme;
-
 
125
			}
-
 
126
		} elseif ($this->donnees['num_nom'] != $synonyme['num_nom']) {
-
 
127
			$this->donnees['i'][] = $synonyme;
-
 
128
		}
-
 
129
	}
-
 
130
	
-
 
131
	private function trierSynonymesMalAppliques($synonyme) {
-
 
132
		if ($synonyme['synonyme_mal_applique'] == 1) {
-
 
133
			if ($synonyme['num_nom'] == $synonyme['num_nom_retenu']) {
-
 
134
				$synonyme['statut'] = 'posséde des synonymes mal appliqués';
-
 
135
			} else {
-
 
136
				$synonyme['statut'] = 'est synonyme mal appliqué du num_nom '.$synonyme['num_nom_retenu'];
-
 
137
			}
-
 
138
			$this->donnees['ma'][] = $synonyme;
-
 
139
		}
-
 
140
	}
-
 
141
	
-
 
142
	private function trierSynonymesOrthographiques($synonyme) {
-
 
143
		if (isset($synonyme['synonyme_orthographique']) && $synonyme['synonyme_orthographique'] != '') {
-
 
144
			if ($synonyme['synonyme_orthographique'] == $synonyme['num_nom']) {
-
 
145
				$synonyme['statut'] = 'posséde des synonymes orthographiques';
-
 
146
			} else {
-
 
147
				$synonyme['statut'] = 'est synonyme orthographique du num_nom '.$synonyme['synonyme_orthographique'];
-
 
148
			}	
-
 
149
			$this->donnees['o'][] = $synonyme;
-
 
150
		}
-
 
151
	}
108
	}
152
	
109
	
153
	private function chargerChorologie() {
110
	private function chargerChorologie() {
154
		$this->chargerTableauManuel('presence');
111
		$this->chargerTableauManuel('presence');
155
		$this->chargerTableauManuel('statuts_origine');
112
		$this->chargerTableauManuel('statuts_origine');
156
		$this->chargerTableauManuel('statuts_introduction');
113
		$this->chargerTableauManuel('statuts_introduction');
157
		$this->chargerTableauManuel('statuts_culture');
114
		$this->chargerTableauManuel('statuts_culture');
158
		foreach ($this->donnees['info'] as $param => $valeur) {
115
		foreach ($this->donnees['info'] as $param => $valeur) {
159
			if ($param == 'presence') {
116
			if ($param == 'presence') {
160
				$this->donnees['chorologie']['Présence']['France']['code'] = $valeur;
117
				$this->donnees['chorologie']['Présence']['France']['code'] = $valeur;
161
				$this->donnees['chorologie']['Présence']['France']['valeur'] = $this->tableau_manuel['presence'][$valeur];
118
				$this->donnees['chorologie']['Présence']['France']['valeur'] = $this->tableau_manuel['presence'][$valeur];
162
			} elseif (preg_match('/presence_(.*)/', $param, $lieu)) {
119
			} elseif (preg_match('/presence_(.*)/', $param, $lieu)) {
163
				$this->donnees['chorologie']['Présence'][$lieu['1']]['code'] = $valeur;
120
				$this->donnees['chorologie']['Présence'][$lieu['1']]['code'] = $valeur;
164
				$this->donnees['chorologie']['Présence'][$lieu['1']]['valeur'] = $this->tableau_manuel['presence'][$valeur];
121
				$this->donnees['chorologie']['Présence'][$lieu['1']]['valeur'] = $this->tableau_manuel['presence'][$valeur];
165
			} elseif ($param == 'statut_origine') {
122
			} elseif ($param == 'statut_origine') {
166
				$this->donnees['chorologie']['Statut d\'origine']['France']['code'] = $valeur;
123
				$this->donnees['chorologie']['Statut d\'origine']['France']['code'] = $valeur;
167
				$this->donnees['chorologie']['Statut d\'origine']['France']['valeur'] = 
124
				$this->donnees['chorologie']['Statut d\'origine']['France']['valeur'] = 
168
					$this->tableau_manuel['statuts_origine'][$valeur];
125
					$this->tableau_manuel['statuts_origine'][$valeur];
169
			} elseif (preg_match('/statut_origine_(.*)/', $param, $lieu)) {
126
			} elseif (preg_match('/statut_origine_(.*)/', $param, $lieu)) {
170
				$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['code'] = $valeur;
127
				$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['code'] = $valeur;
171
				$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['valeur'] = 
128
				$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['valeur'] = 
172
					$this->tableau_manuel['statuts_origine'][$valeur];
129
					$this->tableau_manuel['statuts_origine'][$valeur];
173
			} elseif ($param == 'statut_introduction') {
130
			} elseif ($param == 'statut_introduction') {
174
				$this->donnees['chorologie']['Statut d\'introduction']['France']['code'] = $valeur;
131
				$this->donnees['chorologie']['Statut d\'introduction']['France']['code'] = $valeur;
175
				$this->donnees['chorologie']['Statut d\'introduction']['France']['valeur'] = 
132
				$this->donnees['chorologie']['Statut d\'introduction']['France']['valeur'] = 
176
					$this->tableau_manuel['statuts_introduction'][$valeur];
133
					$this->tableau_manuel['statuts_introduction'][$valeur];
177
			} elseif (preg_match('/statut_introduction_(.*)/', $param, $lieu)) {
134
			} elseif (preg_match('/statut_introduction_(.*)/', $param, $lieu)) {
178
				$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['code'] = $valeur;
135
				$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['code'] = $valeur;
179
				$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['valeur'] = 
136
				$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['valeur'] = 
180
					$this->tableau_manuel['statuts_introduction'][$valeur];
137
					$this->tableau_manuel['statuts_introduction'][$valeur];
181
			} elseif ($param == 'statut_culture') {
138
			} elseif ($param == 'statut_culture') {
182
				$this->donnees['chorologie']['Statut de culture']['France']['code'] = $valeur;
139
				$this->donnees['chorologie']['Statut de culture']['France']['code'] = $valeur;
183
				$this->donnees['chorologie']['Statut de culture']['France']['valeur'] = 
140
				$this->donnees['chorologie']['Statut de culture']['France']['valeur'] = 
184
					$this->tableau_manuel['statuts_culture'][$valeur];
141
					$this->tableau_manuel['statuts_culture'][$valeur];
185
			} elseif (preg_match('/statut_culture_(.*)/', $param, $lieu)) {
142
			} elseif (preg_match('/statut_culture_(.*)/', $param, $lieu)) {
186
				$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['code'] = $valeur;
143
				$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['code'] = $valeur;
187
				$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['valeur'] = 
144
				$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['valeur'] = 
188
					$this->tableau_manuel['statuts_culture'][$valeur];
145
					$this->tableau_manuel['statuts_culture'][$valeur];
189
			}
146
			}
190
		}
147
		}
191
		foreach ($this->donnees['chorologie']['Présence'] as $lieu => $valeur) {
148
		foreach ($this->donnees['chorologie']['Présence'] as $lieu => $valeur) {
192
			if (!isset($this->donnees['chorologie']['Statut d\'origine'][$lieu])) {
149
			if (!isset($this->donnees['chorologie']['Statut d\'origine'][$lieu])) {
193
				$this->donnees['chorologie']['Statut d\'origine'][$lieu]['code'] = '';
150
				$this->donnees['chorologie']['Statut d\'origine'][$lieu]['code'] = '';
194
			}
151
			}
195
			if (!isset($this->donnees['chorologie']['Statut d\'introduction'][$lieu])) {
152
			if (!isset($this->donnees['chorologie']['Statut d\'introduction'][$lieu])) {
196
				$this->donnees['chorologie']['Statut d\'introduction'][$lieu]['code'] = '';
153
				$this->donnees['chorologie']['Statut d\'introduction'][$lieu]['code'] = '';
197
			}
154
			}
198
			if (!isset($this->donnees['chorologie']['Statut de culture'][$lieu])) {
155
			if (!isset($this->donnees['chorologie']['Statut de culture'][$lieu])) {
199
				$this->donnees['chorologie']['Statut de culture'][$lieu]['code'] = '';
156
				$this->donnees['chorologie']['Statut de culture'][$lieu]['code'] = '';
200
			}
157
			}
201
		}
158
		}
202
	}
159
	}
203
	
160
	
204
	private function chargerClassification() {
161
	private function chargerClassification() {
205
		$this->chargerTableauManuel('signification_rang');
162
		$this->chargerTableauManuel('signification_rang');
206
		$this->chargerTableauManuel('presence');
163
		$this->chargerTableauManuel('presence');
207
		$this->donnees['valeur_rang'] = $this->tableau_manuel['signification_rang'];
164
		$this->donnees['valeur_rang'] = $this->tableau_manuel['signification_rang'];
208
		$this->donnees['valeur_presence'] = $this->tableau_manuel['presence'];
165
		$this->donnees['valeur_presence'] = $this->tableau_manuel['presence'];
209
		if ($this->donnees['info']['num_tax_sup'] != '' && $this->donnees['info']['num_tax_sup'] !== "0") {
166
		if ($this->donnees['info']['num_tax_sup'] != '' && $this->donnees['info']['num_tax_sup'] !== "0") {
210
			$this->donnees['classification']['supérieurs'] = array_reverse($this->taxonDao->getClassification
167
			$this->donnees['classification']['supérieurs'] = array_reverse($this->taxonDao->getClassification
211
				('Superieur', $this->referentiel, $this->donnees['info']['num_tax_sup']));
168
				('Superieur', $this->referentiel, $this->donnees['info']['num_tax_sup']));
212
		} elseif (isset($this->donnees['retenu']['num_tax_sup']) && ($this->donnees['retenu']['num_tax_sup'] != '')) {
169
		} elseif (isset($this->donnees['retenu']['num_tax_sup']) && ($this->donnees['retenu']['num_tax_sup'] != '')) {
213
			$this->donnees['classification']['supérieurs'] = array_reverse($this->taxonDao->getClassification
170
			$this->donnees['classification']['supérieurs'] = array_reverse($this->taxonDao->getClassification
214
				('Superieur', $this->referentiel, $this->donnees['retenu']['num_tax_sup']));
171
				('Superieur', $this->referentiel, $this->donnees['retenu']['num_tax_sup']));
215
		}	
172
		}	
216
		if ($this->donnees['num_nom_retenu'] != '') {
173
		if ($this->donnees['num_nom_retenu'] != '') {
217
			$class_inf = $this->taxonDao->getClassification
174
			$class_inf = $this->taxonDao->getClassification
218
				('Inferieur', $this->referentiel, $this->donnees['num_nom_retenu']);
175
				('Inferieur', $this->referentiel, $this->donnees['num_nom_retenu']);
219
			if ($class_inf != '') {
176
			if ($class_inf != '') {
220
				$this->donnees['classification']['inférieurs'] = $class_inf['inf'];	
177
				$this->donnees['classification']['inférieurs'] = $class_inf['inf'];	
221
				$this->donnees['niveau'] = $class_inf['niveau'];
178
				$this->donnees['niveau'] = $class_inf['niveau'];
222
				arsort($class_inf['nb_par_rang']);
179
				arsort($class_inf['nb_par_rang']);
223
				$this->donnees['noms_rang'] = $class_inf['nb_par_rang'];
180
				$this->donnees['noms_rang'] = $class_inf['nb_par_rang'];
224
			}
181
			}
225
		}	
182
		}	
226
	}
183
	}
227
	
184
	
228
	private function chargerComplements() {
185
	private function chargerComplements() {
229
		$champs_manuel_technique = explode(',', $this->manuel['champs']);
186
		$champs_manuel_technique = explode(',', $this->manuel['champs']);
230
		$champs_base_donnees = key($this->donnees['info']);
187
		$champs_base_donnees = key($this->donnees['info']);
231
		$champs_supp_base = array_diff_key($this->donnees['info'], array_flip($champs_manuel_technique));
188
		$champs_supp_base = array_diff_key($this->donnees['info'], array_flip($champs_manuel_technique));
232
		foreach ($champs_supp_base as $champ=>$valeur) {
189
		foreach ($champs_supp_base as $champ=>$valeur) {
233
			if (!(preg_match('/presence_(.*)/',$champ) || preg_match('/statut_origine_(.*)/', $champ) || 
190
			if (!(preg_match('/presence_(.*)/',$champ) || preg_match('/statut_origine_(.*)/', $champ) || 
234
				 preg_match('/statut_introduction_(.*)/', $champ) || preg_match('/statut_culture_(.*)/', $champ))) {
191
				 preg_match('/statut_introduction_(.*)/', $champ) || preg_match('/statut_culture_(.*)/', $champ))) {
235
				$this->donnees['complement'][$champ] = $valeur;
192
				$this->donnees['complement'][$champ] = $valeur;
236
			}
193
			}
237
		}
194
		}
238
	}
195
	}
239
	
196
	
240
	private function parserChaineDeRecherche($chaine) {		
197
	private function parserChaineDeRecherche($chaine) {		
241
		$mots = preg_split('/ /i', $chaine, -1, PREG_SPLIT_NO_EMPTY);
198
		$mots = preg_split('/ /i', $chaine, -1, PREG_SPLIT_NO_EMPTY);
242
		$parametres = array('mots' => '');
199
		$parametres = array('mots' => '');
243
		$cle_precedente = null;
200
		$cle_precedente = null;
244
		foreach ($mots as $mot) {
201
		foreach ($mots as $mot) {
245
			if (preg_match('/^(sg|gen|sp|ssp|au|an|nn|bib|nr|tax):(.*)$/', $mot, $match)) {
202
			if (preg_match('/^(sg|gen|sp|ssp|au|an|nn|bib|nr|tax):(.*)$/', $mot, $match)) {
246
				$cle = $match[1];
203
				$cle = $match[1];
247
				$cle_precedente = $cle;
204
				$cle_precedente = $cle;
248
				$valeur = $match[2];
205
				$valeur = $match[2];
249
				$parametres[$cle] = $valeur;
206
				$parametres[$cle] = $valeur;
250
			} else if (!is_null($cle_precedente)) {
207
			} else if (!is_null($cle_precedente)) {
251
				$parametres[$cle_precedente] .= ' '.$mot;
208
				$parametres[$cle_precedente] .= ' '.$mot;
252
			} else if (is_null($cle_precedente)) {
209
			} else if (is_null($cle_precedente)) {
253
				if (empty($parametres['mots'])) {
210
				if (empty($parametres['mots'])) {
254
					$parametres['mots'] = $mot;
211
					$parametres['mots'] = $mot;
255
				} else {
212
				} else {
256
					$parametres['mots'] .= ' '.$mot;
213
					$parametres['mots'] .= ' '.$mot;
257
				}
214
				}
258
			}
215
			}
259
		}		
216
		}		
260
		return $parametres;
217
		return $parametres;
261
	}
218
	}
262
	
219
	
263
	public function encodeChaine($chaine) {
220
	public function encodeChaine($chaine) {
264
		if (Config::get('sortie_encodage') != Config::get('appli_encodage')) {
221
		if (Config::get('sortie_encodage') != Config::get('appli_encodage')) {
265
			$chaine = mb_convert_encoding($chaine, Config::get('sortie_encodage'), Config::get('appli_encodage'));
222
			$chaine = mb_convert_encoding($chaine, Config::get('sortie_encodage'), Config::get('appli_encodage'));
266
		}
223
		}
267
		$chaine = urlencode($chaine);
224
		$chaine = urlencode($chaine);
268
		return $chaine;
225
		return $chaine;
269
	}
226
	}
270
	
227
	
271
	// retourne l'url de la fiche taxon pour les liens 
228
	// retourne l'url de la fiche taxon pour les liens 
272
	public static function getUrlFicheTaxon($params, $type) {
229
	public static function getUrlFicheTaxon($params, $type) {
273
		$taxon = null;
230
		$taxon = null;
274
		switch ($type) {
231
		switch ($type) {
275
			case 'bas' : 
232
			case 'bas' : 
276
				$taxon['num_nom'] = $params['bas_num'];
233
				$taxon['num_nom'] = $params['bas_num'];
277
				break;
234
				break;
278
			case 'p1' :
235
			case 'p1' :
279
				$taxon['num_nom'] = $params['p1_num'];
236
				$taxon['num_nom'] = $params['p1_num'];
280
				break;
237
				break;
281
			case 'p2' : 
238
			case 'p2' : 
282
				$taxon['num_nom'] = $params['p2_num'];
239
				$taxon['num_nom'] = $params['p2_num'];
283
				break;
240
				break;
284
			default : $taxon['num_nom'] = $params;
241
			default : $taxon['num_nom'] = $params;
285
				break;
242
				break;
286
		}
243
		}
287
		return Recherche::getUrlFicheTaxon($taxon);
244
		return Recherche::getUrlFicheTaxon($taxon);
288
	}
245
	}
289
	
246
	
290
	// charger tableau de $this->manuel
247
	// charger tableau de $this->manuel
291
	private function chargerTableauManuel($titreTableau) {
248
	private function chargerTableauManuel($titreTableau) {
292
		$champs = explode(',', $this->manuel[$titreTableau]);
249
		$champs = explode(',', $this->manuel[$titreTableau]);
293
		foreach ($champs as $champ) {
250
		foreach ($champs as $champ) {
294
			list($champ_nom, $type) = explode('=', trim($champ));
251
			list($champ_nom, $type) = explode('=', trim($champ));
295
			$this->tableau_manuel[$titreTableau][$champ_nom] = $type;
252
			$this->tableau_manuel[$titreTableau][$champ_nom] = $type;
296
		}
253
		}
297
	}
254
	}
298
	
255
	
299
 
256
 
300
}
257
}