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 |
|
- |
|
19 |
// Codification de la présence d'un taxon
|
- |
|
20 |
private $presence_taxon = array (
|
- |
|
21 |
'P' => 'Présent',
|
- |
|
22 |
'S' => 'Supposé présent (présence à confirmer)',
|
- |
|
23 |
'D' => 'Présence douteuse',
|
- |
|
24 |
'E' => 'Éteint',
|
- |
|
25 |
'C' => 'Cité par erreur comme présent',
|
- |
|
26 |
'A' => 'Absent',
|
- |
|
27 |
'' => 'Pas d\'information',
|
- |
|
28 |
'-' => 'Autre statut de présence',
|
- |
|
29 |
'E-W' => 'Disparu',
|
- |
|
30 |
'P-B' =>'Présence accidentelle (Taxon « visiteur »)',
|
- |
|
31 |
'E-F' => 'Trouvé en fouille',
|
- |
|
32 |
'-C' => 'Cryptogène');
|
- |
|
33 |
// Codification du statut d'origine
|
- |
|
34 |
private $statut_origine= array(
|
- |
|
35 |
'N' => 'Natif',
|
- |
|
36 |
'S' => 'Supposé natif',
|
- |
|
37 |
'D' => 'Origine douteuse',
|
- |
|
38 |
'E' => 'Anciennement natif (éteint)',
|
- |
|
39 |
'C' => 'Cité par erreur comme natif',
|
- |
|
40 |
'A' => 'Non natif',
|
- |
|
41 |
'' => 'Pas d\'information',
|
- |
|
42 |
'X' => 'Inapplicable','-' => 'Autre statut d\'origine',
|
- |
|
43 |
'N-E' => 'Endémique',
|
- |
|
44 |
'N-S' => 'Sub-Endémique',
|
- |
|
45 |
'E-Z' => 'Endémique éteinte');
|
- |
|
46 |
// Codification du statut d'introduction
|
- |
|
47 |
private $statut_introduction = array(
|
- |
|
48 |
'I' => 'Introduit',
|
- |
|
49 |
'S' => 'Supposé introduit',
|
- |
|
50 |
'D' => 'Introduction douteuse',
|
- |
|
51 |
'E' => 'Anciennement introduit (éteint)',
|
- |
|
52 |
'C' => 'Cité par erreur comme introduit',
|
- |
|
53 |
'A' => 'Non introduit',
|
- |
|
54 |
'' => 'Pas d\'information',
|
- |
|
55 |
'X' => 'Inapplicable',
|
- |
|
56 |
'-' => 'Autre notion d\'introduction',
|
- |
|
57 |
'I-J' => 'Introduit envahissant',
|
- |
|
58 |
'I-M' => 'Domestique / Introduit non établi'
|
- |
|
59 |
);
|
- |
|
60 |
// Codification du statut de culture
|
- |
|
61 |
private $statut_culture = array(
|
- |
|
62 |
'C' => 'Cultivé en extérieur',
|
- |
|
63 |
'I' => 'Cultivé en intérieur',
|
- |
|
64 |
'S' => 'Supposé cultivé',
|
- |
|
65 |
'D' => 'Culture douteuse',
|
- |
|
66 |
'E' => 'Anciennement cultivé (éteint)',
|
- |
|
67 |
'C' => 'Cité par erreur comme cultivé',
|
- |
|
68 |
'' => 'Pas d\'information',
|
- |
|
69 |
'X' => 'Inapplicable',
|
- |
|
70 |
'-' => 'Autre notion de culture'
|
18 |
|
71 |
);
|
19 |
//+----------------------------------------------------------------------------------------------------------------+
|
72 |
//+----------------------------------------------------------------------------------------------------------------+
|
20 |
// Méthodes
|
73 |
// Méthodes
|
21 |
/**
|
74 |
/**
|
22 |
* Fonction d'affichage par défaut
|
75 |
* Fonction d'affichage par défaut
|
23 |
*/
|
76 |
*/
|
24 |
public function executerActionParDefaut() {
|
77 |
public function executerActionParDefaut() {
|
25 |
return $this->afficherTaxon();
|
78 |
return $this->afficherTaxon();
|
26 |
}
|
79 |
}
|
27 |
|
80 |
|
28 |
// +---------------------------------------------------------------------------------------------------------------+
|
81 |
// +---------------------------------------------------------------------------------------------------------------+
|
29 |
// FICHE COLLECTION
|
82 |
// FICHE CONSULTATION TAXON
|
30 |
public function afficherTaxon() {
|
83 |
public function afficherTaxon() {
|
31 |
// Récupération du référentiel
|
84 |
// Récupération du référentiel
|
32 |
if (isset($_GET['ref'])) {
|
85 |
if (isset($_GET['ref'])) {
|
33 |
$this->referentiel = strtolower($_GET['ref']);
|
86 |
$this->referentiel = strtolower($_GET['ref']);
|
34 |
}
|
87 |
}
|
35 |
// Gestion des actions par défaut
|
88 |
// Gestion des actions par défaut
|
36 |
$this->taxonDao = new TaxonDao();
|
89 |
$this->taxonDao = new TaxonDao();
|
37 |
$this->definirCommeModulePrincipal(get_class($this));
|
90 |
$this->definirCommeModulePrincipal(get_class($this));
|
38 |
$this->construireMenu($this->referentiel);
|
91 |
$this->construireMenu($this->referentiel);
|
39 |
$this->construireFilAriane($this->referentiel);
|
92 |
$this->construireFilAriane($this->referentiel);
|
40 |
$this->executerActionReferentiel('Recherche', 'chargerMoteurRecherche', $this->referentiel);
|
93 |
$this->executerActionReferentiel('Recherche', 'chargerMoteurRecherche', $this->referentiel);
|
41 |
|
94 |
|
42 |
// Gestion des données de la requête
|
95 |
// Gestion des données de la requête
|
43 |
if (!isset($_GET['num_nom'])) {
|
96 |
if (!isset($_GET['num_nom'])) {
|
44 |
|
97 |
|
45 |
} else {
|
98 |
} else {
|
46 |
// Récupération des données
|
99 |
// Récupération des données
|
47 |
$this->donnees['referentiel'] = $this->referentiel;
|
100 |
$this->donnees['referentiel'] = $this->referentiel;
|
48 |
$this->donnees['num_nom'] = $_GET['num_nom'];
|
101 |
$this->donnees['num_nom'] = $_GET['num_nom'];
|
49 |
$this->donnees['num_nom_retenu'] = $_GET['num_nom_retenu'];
|
102 |
$this->donnees['num_nom_retenu'] = $_GET['num_nom_retenu'];
|
50 |
$this->donnees['nom'] = $_GET['nom'];
|
103 |
$this->donnees['nom'] = $_GET['nom'];
|
51 |
//$this->donnees['info'] = $this->taxonDao->getTaxon($this->referentiel, $this->donnees['num_nom']);
|
104 |
$this->donnees['info'] = $this->taxonDao->getTaxon($this->referentiel, $this->donnees['num_nom']);
|
52 |
|
105 |
|
53 |
// Chargement des données des onglets
|
106 |
// Chargement des données des onglets
|
54 |
$this->chargerNomenclature();
|
107 |
$this->chargerNomenclature();
|
55 |
//print_r($this->donnees);
|
- |
|
56 |
/*$this->chargerSynonymie();
|
108 |
$this->chargerSynonymie();
|
57 |
$this->chargerClassification();
|
109 |
//$this->chargerClassification();
|
58 |
$this->chargerNotes();
|
- |
|
59 |
$this->chargerChorologie();
|
110 |
$this->chargerChorologie();
|
60 |
$this->chargerComplements();*/
|
111 |
//$this->chargerComplements();
|
61 |
|
112 |
|
62 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_taxon', $this->donnees));
|
- |
|
63 |
//$this->chargerPiedDePage();
|
113 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_taxon', $this->donnees));
|
64 |
}
|
114 |
}
|
65 |
}
|
115 |
}
|
- |
|
116 |
|
- |
|
117 |
private function chargerNomenclature() {
|
- |
|
118 |
$this->donnees['selectionne'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom']);
|
- |
|
119 |
if (strpos($this->donnees['nom'], ' x ') ) {
|
- |
|
120 |
if ($this->donnees['num_nom'] != $this->donnees['num_nom_retenu']) {
|
- |
|
121 |
$this->donnees['retenu'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom_retenu']);
|
- |
|
122 |
$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom_retenu']);
|
- |
|
123 |
} else {
|
- |
|
124 |
$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom']);
|
- |
|
125 |
}
|
- |
|
126 |
} else {
|
- |
|
127 |
if ($this->donnees['num_nom'] != $this->donnees['num_nom_retenu']) {
|
- |
|
128 |
$this->donnees['retenu'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom_retenu']);
|
- |
|
129 |
}
|
- |
|
130 |
}
|
- |
|
131 |
}
|
- |
|
132 |
|
- |
|
133 |
// recherche les synonymes (à compléter)
|
- |
|
134 |
private function chargerSynonymie() {
|
- |
|
135 |
$rechercheDao = new RechercheDao();
|
- |
|
136 |
// recherche des synonymes nomenclaturaux et taxonomiques
|
- |
|
137 |
$parametres = $this->parserChaineDeRecherche('nn:'.$this->donnees['num_nom'].' tax:1');
|
- |
|
138 |
$parametres['ref']= $this->referentiel;
|
- |
|
139 |
$synonymes = $rechercheDao->chercher('ParTaxon', $parametres);
|
- |
|
140 |
foreach ($synonymes as $synonyme) {
|
- |
|
141 |
if ($this->donnees['num_nom'] != $synonyme['num_nom'] && $synonyme['basionyme'] != null) {
|
- |
|
142 |
if (($this->donnees['num_nom'] != $synonyme['num_nom']) && ($synonyme['basionyme'] == $this->donnees['num_nom'] ||
|
- |
|
143 |
$this->donnees['info']['basionyme'] == $synonyme['num_nom'] || $this->donnees['info']['basionyme'] == $synonyme['basionyme'])) {
|
- |
|
144 |
$this->donnees['fiche_synonymie']['nomenclaturale'][] = $synonyme;
|
- |
|
145 |
} elseif ($this->donnees['num_nom'] != $synonyme['num_nom'] && $synonyme['basionyme'] != null &&
|
- |
|
146 |
$this->donnees['info']['basionyme'] != null) {
|
- |
|
147 |
$this->donnees['fiche_synonymie']['taxonomique'][] = $synonyme;
|
- |
|
148 |
}
|
- |
|
149 |
} elseif ($this->donnees['num_nom'] != $synonyme['num_nom']) {
|
- |
|
150 |
///nom est synonyme mal applique de num_nom_retenu
|
- |
|
151 |
if ($synonyme['synonyme_mal_applique'] == 1) {
|
- |
|
152 |
$this->donnees['fiche_synonymie']['mal appliquée'][] = $synonyme;
|
- |
|
153 |
} else {
|
- |
|
154 |
$this->donnees['fiche_synonymie']['indéterminée (pas de basionyme)'][] = $synonyme;
|
- |
|
155 |
}
|
- |
|
156 |
}
|
- |
|
157 |
}
|
- |
|
158 |
// recherche synonyme proparte
|
- |
|
159 |
if ($this->donnees['info']['synonyme_proparte'] != ''){
|
- |
|
160 |
$this->donnees['fiche_synonymie']['pro parte']['num_nom'] = $this->donnees['info']['synonyme_proparte'];
|
- |
|
161 |
}
|
- |
|
162 |
// recherche si taxon est un synonyme douteux
|
- |
|
163 |
if ($this->donnees['info']['synonyme_douteux'] == 1) {
|
- |
|
164 |
$this->donnees['fiche_synonymie']['douteux']['num_nom'] = $this->donnees['info'];
|
- |
|
165 |
}
|
- |
|
166 |
|
- |
|
167 |
}
|
- |
|
168 |
|
- |
|
169 |
private function chargerChorologie() {
|
- |
|
170 |
foreach ($this->donnees['info'] as $param => $valeur) {
|
- |
|
171 |
if ($param == 'presence') {
|
- |
|
172 |
$this->donnees['chorologie']['Présence']['France']['code'] = $valeur;
|
- |
|
173 |
$this->donnees['chorologie']['Présence']['France']['valeur'] = $this->presence_taxon[$valeur];
|
- |
|
174 |
} elseif (preg_match('/presence_(.*)/', $param, $lieu)) {
|
- |
|
175 |
$this->donnees['chorologie']['Présence'][$lieu['1']]['code'] = $valeur;
|
- |
|
176 |
$this->donnees['chorologie']['Présence'][$lieu['1']]['valeur'] = $this->presence_taxon[$valeur];
|
- |
|
177 |
} elseif ($param == 'statut_origine') {
|
- |
|
178 |
$this->donnees['chorologie']['Statut d\'origine']['France']['code'] = $valeur;
|
- |
|
179 |
$this->donnees['chorologie']['Statut d\'origine']['France']['valeur'] = $this->statut_origine[$valeur];
|
- |
|
180 |
} elseif (preg_match('/statut_origine_(.*)/', $param, $lieu)) {
|
- |
|
181 |
$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['code'] = $valeur;
|
- |
|
182 |
$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['valeur'] = $this->statut_origine[$valeur];
|
- |
|
183 |
} elseif ($param == 'statut_introduction') {
|
- |
|
184 |
$this->donnees['chorologie']['Statut d\'introduction']['France']['code'] = $valeur;
|
- |
|
185 |
$this->donnees['chorologie']['Statut d\'introduction']['France']['valeur'] = $this->statut_introduction[$valeur];
|
- |
|
186 |
} elseif (preg_match('/statut_introduction_(.*)/', $param, $lieu)) {
|
- |
|
187 |
$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['code'] = $valeur;
|
- |
|
188 |
$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['valeur'] = $this->statut_introduction[$valeur];
|
- |
|
189 |
} elseif ($param == 'statut_culture') {
|
- |
|
190 |
$this->donnees['chorologie']['Statut de culture']['France']['code'] = $valeur;
|
- |
|
191 |
$this->donnees['chorologie']['Statut de culture']['France']['valeur'] = $this->statut_culture[$valeur];
|
- |
|
192 |
} elseif (preg_match('/statut_culture_(.*)/', $param, $lieu)) {
|
- |
|
193 |
$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['code'] = $valeur;
|
- |
|
194 |
$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['valeur'] = $this->statut_culture[$valeur];
|
- |
|
195 |
}
|
- |
|
196 |
}
|
- |
|
197 |
foreach ($this->donnees['chorologie']['Présence'] as $lieu=>$valeur) {
|
- |
|
198 |
if (!isset($this->donnees['chorologie']['Statut d\'origine'][$lieu])) {
|
- |
|
199 |
$this->donnees['chorologie']['Statut d\'origine'][$lieu]['code'] = '';
|
- |
|
200 |
$this->donnees['chorologie']['Statut d\'origine'][$lieu]['valeur'] = $this->statut_origine[''];
|
- |
|
201 |
}
|
- |
|
202 |
if (!isset($this->donnees['chorologie']['Statut d\'introduction'][$lieu])) {
|
- |
|
203 |
$this->donnees['chorologie']['Statut d\'introduction'][$lieu]['code'] = '';
|
- |
|
204 |
$this->donnees['chorologie']['Statut d\'introduction'][$lieu]['valeur'] = $this->statut_introduction[''];
|
- |
|
205 |
}
|
- |
|
206 |
if (!isset($this->donnees['chorologie']['Statut de culture'][$lieu])) {
|
- |
|
207 |
$this->donnees['chorologie']['Statut de culture'][$lieu]['code'] = '';
|
- |
|
208 |
$this->donnees['chorologie']['Statut de culture'][$lieu]['valeur'] = $this->statut_culture[''];
|
- |
|
209 |
}
|
- |
|
210 |
}
|
- |
|
211 |
}
|
- |
|
212 |
|
- |
|
213 |
private function parserChaineDeRecherche($chaine) {
|
- |
|
214 |
$mots = preg_split('/ /i', $chaine, -1, PREG_SPLIT_NO_EMPTY);
|
- |
|
215 |
$parametres = array('mots' => '');
|
- |
|
216 |
$cle_precedente = null;
|
- |
|
217 |
foreach ($mots as $mot) {
|
- |
|
218 |
if (preg_match('/^(sg|gen|sp|ssp|au|an|nn|bib|nr|tax):(.*)$/', $mot, $match)) {
|
- |
|
219 |
$cle = $match[1];
|
- |
|
220 |
$cle_precedente = $cle;
|
- |
|
221 |
$valeur = $match[2];
|
- |
|
222 |
$parametres[$cle] = $valeur;
|
- |
|
223 |
} else if (!is_null($cle_precedente)) {
|
- |
|
224 |
$parametres[$cle_precedente] .= ' '.$mot;
|
- |
|
225 |
} else if (is_null($cle_precedente)) {
|
- |
|
226 |
if (empty($parametres['mots'])) {
|
- |
|
227 |
$parametres['mots'] = $mot;
|
- |
|
228 |
} else {
|
- |
|
229 |
$parametres['mots'] .= ' '.$mot;
|
- |
|
230 |
}
|
- |
|
231 |
}
|
- |
|
232 |
}
|
- |
|
233 |
return $parametres;
|
- |
|
234 |
}
|
- |
|
235 |
|
66 |
|
236 |
// retourne l'url de la fiche taxon pour les liens
|
67 |
public static function getUrlFicheTaxon($params, $type) {
|
237 |
public static function getUrlFicheTaxon($params, $type) {
|
68 |
$taxon = null;
|
238 |
$taxon = null;
|
69 |
switch ($type) {
|
239 |
switch ($type) {
|
70 |
case 'bas' :
|
240 |
case 'bas' :
|
71 |
$taxon['num_nom'] = $params['bas_num'];
|
241 |
$taxon['num_nom'] = $params['bas_num'];
|
72 |
$taxon['num_nom_retenu'] = $params['bas_num_retenu'];
|
242 |
$taxon['num_nom_retenu'] = $params['bas_num_retenu'];
|
73 |
$taxon['nom_complet'] = $params['bas_nom'];
|
243 |
$taxon['nom_complet'] = $params['bas_nom'];
|
74 |
break;
|
244 |
break;
|
75 |
case 'p1' :
|
245 |
case 'p1' :
|
76 |
$taxon['num_nom'] = $params['p1_num'];
|
246 |
$taxon['num_nom'] = $params['p1_num'];
|
77 |
$taxon['num_nom_retenu'] = $params['p1_num'];
|
247 |
$taxon['num_nom_retenu'] = $params['p1_num'];
|
78 |
$taxon['nom_complet'] = $params['p1_nom'];
|
248 |
$taxon['nom_complet'] = $params['p1_nom'];
|
79 |
break;
|
249 |
break;
|
80 |
case 'p2' :
|
250 |
case 'p2' :
|
81 |
$taxon['num_nom'] = $params['p2_num'];
|
251 |
$taxon['num_nom'] = $params['p2_num'];
|
82 |
$taxon['num_nom_retenu'] = $params['p2_num'];
|
252 |
$taxon['num_nom_retenu'] = $params['p2_num'];
|
83 |
$taxon['nom_complet'] = $params['p2_nom'];
|
253 |
$taxon['nom_complet'] = $params['p2_nom'];
|
84 |
break;
|
254 |
break;
|
85 |
default : break;
|
255 |
default : break;
|
86 |
}
|
256 |
}
|
87 |
return Recherche::getUrlFicheTaxon($taxon);
|
257 |
return Recherche::getUrlFicheTaxon($taxon);
|
88 |
}
|
258 |
}
|
89 |
|
- |
|
90 |
|
- |
|
91 |
private function chargerNomenclature() {
|
- |
|
92 |
$this->donnees['selectionne'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom']);
|
- |
|
93 |
if (strpos($this->donnees['nom'], ' x ') ) {
|
- |
|
94 |
if ($this->donnees['num_nom'] != $this->donnees['num_nom_retenu']) {
|
- |
|
95 |
$this->donnees['retenu'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom_retenu']);
|
- |
|
96 |
$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom_retenu']);
|
- |
|
97 |
} else {
|
- |
|
98 |
$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom']);
|
- |
|
99 |
}
|
- |
|
100 |
} else {
|
- |
|
101 |
if ($this->donnees['num_nom'] != $this->donnees['num_nom_retenu']) {
|
- |
|
102 |
$this->donnees['retenu'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom_retenu']);
|
- |
|
103 |
}
|
- |
|
104 |
}
|
- |
|
105 |
}
|
259 |
|
106 |
|
260 |
|
107 |
}
|
261 |
}
|