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 |
private $type_synonymie = array(
|
- |
|
21 |
'n' => 'Synonymie nomenclaturale',
|
- |
|
22 |
't' => 'Synonymie taxonomique',
|
- |
|
23 |
'i' => 'Synonymie indéterminée (pas de basionyme)',
|
- |
|
24 |
'd' => 'Synonymie douteuse',
|
- |
|
25 |
'o' => 'Synonymie orthographique',
|
- |
|
26 |
'ma' => 'Synonymie mal appliquée',
|
- |
|
27 |
'pp' => 'Synonymie pro parte',
|
- |
|
28 |
'h' => 'Homonymie (sensu)',
|
- |
|
29 |
'b' => 'Basionyme commun');
|
- |
|
30 |
|
20 |
|
31 |
//+----------------------------------------------------------------------------------------------------------------+
|
21 |
//+----------------------------------------------------------------------------------------------------------------+
|
32 |
// Méthodes
|
22 |
// Méthodes
|
33 |
/**
|
23 |
/**
|
34 |
* Fonction d'affichage par défaut
|
24 |
* Fonction d'affichage par défaut
|
35 |
*/
|
25 |
*/
|
36 |
public function executerActionParDefaut() {
|
26 |
public function executerActionParDefaut() {
|
37 |
return $this->afficherTaxon();
|
27 |
return $this->afficherTaxon();
|
38 |
}
|
28 |
}
|
39 |
|
29 |
|
40 |
// +---------------------------------------------------------------------------------------------------------------+
|
30 |
// +---------------------------------------------------------------------------------------------------------------+
|
41 |
// FICHE CONSULTATION TAXON
|
31 |
// FICHE CONSULTATION TAXON
|
42 |
public function afficherTaxon() {
|
32 |
public function afficherTaxon() {
|
43 |
// Récupération du référentiel
|
33 |
// Récupération du référentiel
|
44 |
if (isset($_GET['ref'])) {
|
34 |
if (isset($_GET['ref'])) {
|
45 |
$this->referentiel = strtolower($_GET['ref']);
|
35 |
$this->referentiel = strtolower($_GET['ref']);
|
46 |
}
|
36 |
}
|
47 |
// Gestion des actions par défaut
|
37 |
// Gestion des actions par défaut
|
48 |
$this->taxonDao = new TaxonDao();
|
38 |
$this->taxonDao = new TaxonDao();
|
49 |
$this->definirCommeModulePrincipal(get_class($this));
|
39 |
$this->definirCommeModulePrincipal(get_class($this));
|
50 |
$this->construireMenu($this->referentiel);
|
40 |
$this->construireMenu($this->referentiel);
|
51 |
$this->construireFilAriane($this->referentiel);
|
41 |
$this->construireFilAriane($this->referentiel);
|
52 |
$this->executerActionReferentiel('Recherche', 'chargerMoteurRecherche', $this->referentiel);
|
42 |
$this->executerActionReferentiel('Recherche', 'chargerMoteurRecherche', $this->referentiel);
|
53 |
|
43 |
|
54 |
// Gestion des données de la requête
|
44 |
// Gestion des données de la requête
|
55 |
if (!isset($_GET['num_nom'])) {
|
45 |
if (!isset($_GET['num_nom'])) {
|
56 |
|
46 |
|
57 |
} else {
|
47 |
} else {
|
58 |
// Récupération des données
|
48 |
// Récupération des données
|
59 |
$this->donnees['referentiel'] = $this->referentiel;
|
49 |
$this->donnees['referentiel'] = $this->referentiel;
|
60 |
$this->donnees['num_nom'] = $_GET['num_nom'];
|
50 |
$this->donnees['num_nom'] = $_GET['num_nom'];
|
61 |
$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']);
|
62 |
$this->donnees['num_nom_retenu'] = $this->donnees['info']['num_nom_retenu'];
|
52 |
$this->donnees['num_nom_retenu'] = $this->donnees['info']['num_nom_retenu'];
|
63 |
$this->donnees['nom'] = $this->donnees['info']['nom_complet'];
|
53 |
$this->donnees['nom'] = $this->donnees['info']['nom_complet'];
|
64 |
|
54 |
|
65 |
if ($this->donnees['info'] != '') {
|
55 |
if ($this->donnees['info'] != '') {
|
66 |
// Chargement des données des onglets
|
56 |
// Chargement des données des onglets
|
67 |
$this->chargerNomenclature();
|
57 |
$this->chargerNomenclature();
|
68 |
$this->chargerSynonymie();
|
58 |
$this->chargerSynonymie();
|
69 |
$this->chargerClassification();
|
59 |
$this->chargerClassification();
|
70 |
$this->chargerChorologie();
|
60 |
$this->chargerChorologie();
|
71 |
$this->chargerComplements();
|
61 |
$this->chargerComplements();
|
72 |
}
|
62 |
}
|
73 |
|
63 |
|
74 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_taxon', $this->donnees));
|
64 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_taxon', $this->donnees));
|
75 |
}
|
65 |
}
|
76 |
}
|
66 |
}
|
77 |
|
67 |
|
78 |
private function chargerNomenclature() {
|
68 |
private function chargerNomenclature() {
|
79 |
$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']);
|
80 |
if (strpos($this->donnees['nom'], ' x ') ) {
|
70 |
if (strpos($this->donnees['nom'], ' x ') ) {
|
81 |
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'] != '') {
|
82 |
$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']);
|
83 |
$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom_retenu']);
|
73 |
$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom_retenu']);
|
84 |
} else {
|
74 |
} else {
|
85 |
$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']);
|
86 |
}
|
76 |
}
|
87 |
} else {
|
77 |
} else {
|
88 |
if ($this->donnees['num_nom'] != $this->donnees['num_nom_retenu'] && $this->donnees['num_nom_retenu'] != '') {
|
78 |
if ($this->donnees['num_nom'] != $this->donnees['num_nom_retenu'] && $this->donnees['num_nom_retenu'] != '') {
|
89 |
$this->donnees['retenu'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom_retenu']);
|
79 |
$this->donnees['retenu'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom_retenu']);
|
90 |
}
|
80 |
}
|
91 |
}
|
81 |
}
|
92 |
}
|
82 |
}
|
93 |
|
83 |
|
94 |
// recherche les synonymes (à compléter)
|
84 |
// recherche les synonymes (à compléter)
|
95 |
private function chargerSynonymie() {
|
85 |
private function chargerSynonymie() {
|
96 |
$rechercheDao = new RechercheDao();
|
86 |
$rechercheDao = new RechercheDao();
|
97 |
$this->donnees['type_synonymie'] = $this->type_synonymie;
|
- |
|
98 |
// recherche des synonymes nomenclaturaux et taxonomiques
|
87 |
// recherche des synonymes nomenclaturaux et taxonomiques
|
99 |
$parametres = $this->parserChaineDeRecherche('nn:'.$this->donnees['num_nom'].' tax:1');
|
88 |
$parametres = $this->parserChaineDeRecherche('nn:'.$this->donnees['num_nom'].' tax:1');
|
100 |
$parametres['ref']= $this->referentiel;
|
89 |
$parametres['ref']= $this->referentiel;
|
101 |
$synonymes = $rechercheDao->chercher('ParTaxon', $parametres);
|
90 |
$synonymes = $rechercheDao->chercher('ParTaxon', $parametres);
|
102 |
if ($synonymes != '') {
|
91 |
if ($synonymes != '') {
|
103 |
foreach ($synonymes as $synonyme) {
|
92 |
foreach ($synonymes as $synonyme) {
|
104 |
$this->trierSynonymesNomenclaturauxTaxonomiques($synonyme);
|
93 |
$this->trierSynonymesNomenclaturauxTaxonomiques($synonyme);
|
105 |
$this->trierSynonymesMalAppliques($synonyme);
|
94 |
$this->trierSynonymesMalAppliques($synonyme);
|
106 |
$this->trierSynonymesOrthographiques($synonyme);
|
95 |
$this->trierSynonymesOrthographiques($synonyme);
|
107 |
}
|
96 |
}
|
108 |
}
|
97 |
}
|
109 |
// synonyme douteux
|
- |
|
110 |
if ($this->donnees['info']['synonyme_douteux'] == 1) {
|
- |
|
111 |
$this->donnees['fiche_synonymie']['d']['num_nom'] = $this->donnees['info'];
|
- |
|
112 |
}
|
- |
|
113 |
// synonyme proparte
|
98 |
// synonyme proparte
|
114 |
if ($this->donnees['info']['synonyme_proparte'] != ''){
|
99 |
if ($this->donnees['info']['synonyme_proparte'] != ''){
|
115 |
$propartes = preg_split('/;/', $this->donnees['info']['synonyme_proparte']);
|
100 |
$propartes = preg_split('/;/', $this->donnees['info']['synonyme_proparte']);
|
116 |
foreach ($propartes as $protarte) {
|
101 |
foreach ($propartes as $protarte) {
|
117 |
$this->donnees['fiche_synonymie']['pp'] =
|
- |
|
118 |
$this->taxonDao->getTaxonAffichage($this->referentiel, $proparte);
|
102 |
$this->donnees['pp'] = $this->taxonDao->getTaxonAffichage($this->referentiel, $proparte);
|
119 |
}
|
103 |
}
|
120 |
}
|
104 |
}
|
121 |
// homonymie
|
105 |
// homonymie
|
122 |
$nom = $this->encodeChaine($this->donnees['info']['nom_complet']);
|
106 |
$nom = $this->encodeChaine($this->donnees['info']['nom_complet']);
|
123 |
$homonymes = $this->taxonDao->getHomonyme($this->referentiel, $nom);
|
107 |
$homonymes = $this->taxonDao->getHomonyme($this->referentiel, $nom);
|
124 |
if (count($homonymes) > 1) {
|
108 |
if (count($homonymes) > 1) {
|
125 |
foreach ($homonymes as $id => &$homonyme) {
|
109 |
foreach ($homonymes as $id => &$homonyme) {
|
126 |
$homonyme['statut'] = $homonyme['homonyme'];
|
110 |
$homonyme['statut'] = $homonyme['homonyme'];
|
127 |
}
|
111 |
}
|
128 |
|
112 |
|
129 |
$this->donnees['fiche_synonymie']['h'] = $homonymes;
|
113 |
$this->donnees['h'] = $homonymes;
|
130 |
}
|
114 |
}
|
131 |
// Même basionyme
|
115 |
// Même basionyme
|
132 |
if ($this->donnees['info']['basionyme'] != '') {
|
116 |
if ($this->donnees['info']['basionyme'] != '') {
|
133 |
$basionyme_commun = $this->taxonDao->getNomsBasionymeCommun($this->referentiel, $this->donnees['info']['basionyme']);
|
117 |
$basionyme_commun = $this->taxonDao->getNomsBasionymeCommun($this->referentiel, $this->donnees['info']['basionyme']);
|
134 |
foreach ($basionyme_commun as $nom) {
|
118 |
foreach ($basionyme_commun as $nom) {
|
135 |
if ($nom['num_nom_retenu'] != $this->donnees['num_nom_retenu']) {
|
119 |
if ($nom['num_nom_retenu'] != $this->donnees['num_nom_retenu']) {
|
136 |
$this->donnees['fiche_synonymie']['b'][] = $nom;
|
120 |
$this->donnees['b'][] = $nom;
|
137 |
}
|
121 |
}
|
138 |
}
|
122 |
}
|
139 |
}
|
123 |
}
|
140 |
}
|
124 |
}
|
141 |
|
125 |
|
142 |
private function trierSynonymesNomenclaturauxTaxonomiques($synonyme) {
|
126 |
private function trierSynonymesNomenclaturauxTaxonomiques($synonyme) {
|
143 |
if ($this->donnees['num_nom'] != $synonyme['num_nom'] && $synonyme['basionyme'] != null) {
|
127 |
if ($this->donnees['num_nom'] != $synonyme['num_nom'] && $synonyme['basionyme'] != null) {
|
144 |
if (($this->donnees['num_nom'] != $synonyme['num_nom']) && ($synonyme['basionyme'] ==
|
128 |
if (($this->donnees['num_nom'] != $synonyme['num_nom']) && ($synonyme['basionyme'] ==
|
145 |
$this->donnees['num_nom'] || $this->donnees['info']['basionyme'] == $synonyme['num_nom'] ||
|
129 |
$this->donnees['num_nom'] || $this->donnees['info']['basionyme'] == $synonyme['num_nom'] ||
|
146 |
$this->donnees['info']['basionyme'] == $synonyme['basionyme'])) {
|
130 |
$this->donnees['info']['basionyme'] == $synonyme['basionyme'])) {
|
147 |
$this->donnees['fiche_synonymie']['n'][] = $synonyme;
|
131 |
$this->donnees['n'][] = $synonyme;
|
148 |
} elseif ($this->donnees['num_nom'] != $synonyme['num_nom'] && $synonyme['basionyme'] != null &&
|
132 |
} elseif ($this->donnees['num_nom'] != $synonyme['num_nom'] && $synonyme['basionyme'] != null &&
|
149 |
$this->donnees['info']['basionyme'] != null) {
|
133 |
$this->donnees['info']['basionyme'] != null) {
|
150 |
$this->donnees['fiche_synonymie']['t'][] = $synonyme;
|
134 |
$this->donnees['t'][] = $synonyme;
|
151 |
}
|
135 |
}
|
152 |
} elseif ($this->donnees['num_nom'] != $synonyme['num_nom']) {
|
136 |
} elseif ($this->donnees['num_nom'] != $synonyme['num_nom']) {
|
153 |
$this->donnees['fiche_synonymie']['i'][] = $synonyme;
|
137 |
$this->donnees['i'][] = $synonyme;
|
154 |
}
|
138 |
}
|
155 |
}
|
139 |
}
|
156 |
|
140 |
|
157 |
private function trierSynonymesMalAppliques($synonyme) {
|
141 |
private function trierSynonymesMalAppliques($synonyme) {
|
158 |
if ($synonyme['synonyme_mal_applique'] == 1) {
|
142 |
if ($synonyme['synonyme_mal_applique'] == 1) {
|
159 |
if ($synonyme['num_nom'] == $synonyme['num_nom_retenu']) {
|
143 |
if ($synonyme['num_nom'] == $synonyme['num_nom_retenu']) {
|
160 |
$synonyme['statut'] = 'posséde des synonymes mal appliqués';
|
144 |
$synonyme['statut'] = 'posséde des synonymes mal appliqués';
|
161 |
} else {
|
145 |
} else {
|
162 |
$synonyme['statut'] = 'est synonyme mal appliqué du num_nom '.$synonyme['num_nom_retenu'];
|
146 |
$synonyme['statut'] = 'est synonyme mal appliqué du num_nom '.$synonyme['num_nom_retenu'];
|
163 |
}
|
147 |
}
|
164 |
$this->donnees['fiche_synonymie']['ma'][] = $synonyme;
|
148 |
$this->donnees['ma'][] = $synonyme;
|
165 |
}
|
149 |
}
|
166 |
}
|
150 |
}
|
167 |
|
151 |
|
168 |
private function trierSynonymesOrthographiques($synonyme) {
|
152 |
private function trierSynonymesOrthographiques($synonyme) {
|
169 |
if (isset($synonyme['synonyme_orthographique']) && $synonyme['synonyme_orthographique'] != '') {
|
153 |
if (isset($synonyme['synonyme_orthographique']) && $synonyme['synonyme_orthographique'] != '') {
|
170 |
if ($synonyme['synonyme_orthographique'] == $synonyme['num_nom']) {
|
154 |
if ($synonyme['synonyme_orthographique'] == $synonyme['num_nom']) {
|
171 |
$synonyme['statut'] = 'posséde des synonymes orthographiques';
|
155 |
$synonyme['statut'] = 'posséde des synonymes orthographiques';
|
172 |
} else {
|
156 |
} else {
|
173 |
$synonyme['statut'] = 'est synonyme orthographique du num_nom '.$synonyme['synonyme_orthographique'];
|
157 |
$synonyme['statut'] = 'est synonyme orthographique du num_nom '.$synonyme['synonyme_orthographique'];
|
174 |
}
|
158 |
}
|
175 |
$this->donnees['fiche_synonymie']['o'][] = $synonyme;
|
159 |
$this->donnees['o'][] = $synonyme;
|
176 |
}
|
160 |
}
|
177 |
}
|
161 |
}
|
178 |
|
162 |
|
179 |
private function chargerChorologie() {
|
163 |
private function chargerChorologie() {
|
180 |
$this->chargerTableauManuel('presence');
|
164 |
$this->chargerTableauManuel('presence');
|
181 |
$this->chargerTableauManuel('statuts_origine');
|
165 |
$this->chargerTableauManuel('statuts_origine');
|
182 |
$this->chargerTableauManuel('statuts_introduction');
|
166 |
$this->chargerTableauManuel('statuts_introduction');
|
183 |
$this->chargerTableauManuel('statuts_culture');
|
167 |
$this->chargerTableauManuel('statuts_culture');
|
184 |
foreach ($this->donnees['info'] as $param => $valeur) {
|
168 |
foreach ($this->donnees['info'] as $param => $valeur) {
|
185 |
if ($param == 'presence') {
|
169 |
if ($param == 'presence') {
|
186 |
$this->donnees['chorologie']['Présence']['France']['code'] = $valeur;
|
170 |
$this->donnees['chorologie']['Présence']['France']['code'] = $valeur;
|
187 |
$this->donnees['chorologie']['Présence']['France']['valeur'] = $this->tableau_manuel['presence'][$valeur];
|
171 |
$this->donnees['chorologie']['Présence']['France']['valeur'] = $this->tableau_manuel['presence'][$valeur];
|
188 |
} elseif (preg_match('/presence_(.*)/', $param, $lieu)) {
|
172 |
} elseif (preg_match('/presence_(.*)/', $param, $lieu)) {
|
189 |
$this->donnees['chorologie']['Présence'][$lieu['1']]['code'] = $valeur;
|
173 |
$this->donnees['chorologie']['Présence'][$lieu['1']]['code'] = $valeur;
|
190 |
$this->donnees['chorologie']['Présence'][$lieu['1']]['valeur'] = $this->tableau_manuel['presence'][$valeur];
|
174 |
$this->donnees['chorologie']['Présence'][$lieu['1']]['valeur'] = $this->tableau_manuel['presence'][$valeur];
|
191 |
} elseif ($param == 'statut_origine') {
|
175 |
} elseif ($param == 'statut_origine') {
|
192 |
$this->donnees['chorologie']['Statut d\'origine']['France']['code'] = $valeur;
|
176 |
$this->donnees['chorologie']['Statut d\'origine']['France']['code'] = $valeur;
|
193 |
$this->donnees['chorologie']['Statut d\'origine']['France']['valeur'] =
|
177 |
$this->donnees['chorologie']['Statut d\'origine']['France']['valeur'] =
|
194 |
$this->tableau_manuel['statuts_origine'][$valeur];
|
178 |
$this->tableau_manuel['statuts_origine'][$valeur];
|
195 |
} elseif (preg_match('/statut_origine_(.*)/', $param, $lieu)) {
|
179 |
} elseif (preg_match('/statut_origine_(.*)/', $param, $lieu)) {
|
196 |
$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['code'] = $valeur;
|
180 |
$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['code'] = $valeur;
|
197 |
$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['valeur'] =
|
181 |
$this->donnees['chorologie']['Statut d\'origine'][$lieu['1']]['valeur'] =
|
198 |
$this->tableau_manuel['statuts_origine'][$valeur];
|
182 |
$this->tableau_manuel['statuts_origine'][$valeur];
|
199 |
} elseif ($param == 'statut_introduction') {
|
183 |
} elseif ($param == 'statut_introduction') {
|
200 |
$this->donnees['chorologie']['Statut d\'introduction']['France']['code'] = $valeur;
|
184 |
$this->donnees['chorologie']['Statut d\'introduction']['France']['code'] = $valeur;
|
201 |
$this->donnees['chorologie']['Statut d\'introduction']['France']['valeur'] =
|
185 |
$this->donnees['chorologie']['Statut d\'introduction']['France']['valeur'] =
|
202 |
$this->tableau_manuel['statuts_introduction'][$valeur];
|
186 |
$this->tableau_manuel['statuts_introduction'][$valeur];
|
203 |
} elseif (preg_match('/statut_introduction_(.*)/', $param, $lieu)) {
|
187 |
} elseif (preg_match('/statut_introduction_(.*)/', $param, $lieu)) {
|
204 |
$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['code'] = $valeur;
|
188 |
$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['code'] = $valeur;
|
205 |
$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['valeur'] =
|
189 |
$this->donnees['chorologie']['Statut d\'introduction'][$lieu['1']]['valeur'] =
|
206 |
$this->tableau_manuel['statuts_introduction'][$valeur];
|
190 |
$this->tableau_manuel['statuts_introduction'][$valeur];
|
207 |
} elseif ($param == 'statut_culture') {
|
191 |
} elseif ($param == 'statut_culture') {
|
208 |
$this->donnees['chorologie']['Statut de culture']['France']['code'] = $valeur;
|
192 |
$this->donnees['chorologie']['Statut de culture']['France']['code'] = $valeur;
|
209 |
$this->donnees['chorologie']['Statut de culture']['France']['valeur'] =
|
193 |
$this->donnees['chorologie']['Statut de culture']['France']['valeur'] =
|
210 |
$this->tableau_manuel['statuts_culture'][$valeur];
|
194 |
$this->tableau_manuel['statuts_culture'][$valeur];
|
211 |
} elseif (preg_match('/statut_culture_(.*)/', $param, $lieu)) {
|
195 |
} elseif (preg_match('/statut_culture_(.*)/', $param, $lieu)) {
|
212 |
$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['code'] = $valeur;
|
196 |
$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['code'] = $valeur;
|
213 |
$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['valeur'] =
|
197 |
$this->donnees['chorologie']['Statut de culture'][$lieu['1']]['valeur'] =
|
214 |
$this->tableau_manuel['statuts_culture'][$valeur];
|
198 |
$this->tableau_manuel['statuts_culture'][$valeur];
|
215 |
}
|
199 |
}
|
216 |
}
|
200 |
}
|
217 |
foreach ($this->donnees['chorologie']['Présence'] as $lieu => $valeur) {
|
201 |
foreach ($this->donnees['chorologie']['Présence'] as $lieu => $valeur) {
|
218 |
if (!isset($this->donnees['chorologie']['Statut d\'origine'][$lieu])) {
|
202 |
if (!isset($this->donnees['chorologie']['Statut d\'origine'][$lieu])) {
|
219 |
$this->donnees['chorologie']['Statut d\'origine'][$lieu]['code'] = '';
|
203 |
$this->donnees['chorologie']['Statut d\'origine'][$lieu]['code'] = '';
|
220 |
}
|
204 |
}
|
221 |
if (!isset($this->donnees['chorologie']['Statut d\'introduction'][$lieu])) {
|
205 |
if (!isset($this->donnees['chorologie']['Statut d\'introduction'][$lieu])) {
|
222 |
$this->donnees['chorologie']['Statut d\'introduction'][$lieu]['code'] = '';
|
206 |
$this->donnees['chorologie']['Statut d\'introduction'][$lieu]['code'] = '';
|
223 |
}
|
207 |
}
|
224 |
if (!isset($this->donnees['chorologie']['Statut de culture'][$lieu])) {
|
208 |
if (!isset($this->donnees['chorologie']['Statut de culture'][$lieu])) {
|
225 |
$this->donnees['chorologie']['Statut de culture'][$lieu]['code'] = '';
|
209 |
$this->donnees['chorologie']['Statut de culture'][$lieu]['code'] = '';
|
226 |
}
|
210 |
}
|
227 |
}
|
211 |
}
|
228 |
}
|
212 |
}
|
229 |
|
213 |
|
230 |
private function chargerClassification() {
|
214 |
private function chargerClassification() {
|
231 |
$this->chargerTableauManuel('signification_rang');
|
215 |
$this->chargerTableauManuel('signification_rang');
|
232 |
$this->donnees['valeur_rang'] = $this->tableau_manuel['signification_rang'];
|
216 |
$this->donnees['valeur_rang'] = $this->tableau_manuel['signification_rang'];
|
233 |
if ($this->donnees['info']['num_tax_sup'] != '' || isset($this->donnees['retenu']['num_tax_sup'])) {
|
217 |
if ($this->donnees['info']['num_tax_sup'] != '' || isset($this->donnees['retenu']['num_tax_sup'])) {
|
234 |
if ($this->donnees['num_nom'] == $this->donnees['num_nom_retenu']) {
|
218 |
if ($this->donnees['num_nom'] == $this->donnees['num_nom_retenu']) {
|
235 |
$this->donnees['classification']['supérieurs'] = array_reverse($this->taxonDao->getClassification
|
219 |
$this->donnees['classification']['supérieurs'] = array_reverse($this->taxonDao->getClassification
|
236 |
('Superieur', $this->referentiel, $this->donnees['info']['num_tax_sup']));
|
220 |
('Superieur', $this->referentiel, $this->donnees['info']['num_tax_sup']));
|
237 |
} else {
|
221 |
} else {
|
238 |
$this->donnees['classification']['supérieurs'] = array_reverse($this->taxonDao->getClassification
|
222 |
$this->donnees['classification']['supérieurs'] = array_reverse($this->taxonDao->getClassification
|
239 |
('Superieur', $this->referentiel, $this->donnees['retenu']['num_tax_sup']));
|
223 |
('Superieur', $this->referentiel, $this->donnees['retenu']['num_tax_sup']));
|
240 |
}
|
224 |
}
|
241 |
}
|
225 |
}
|
242 |
if ($this->donnees['num_nom_retenu'] != '') {
|
226 |
if ($this->donnees['num_nom_retenu'] != '') {
|
243 |
$class_inf = $this->taxonDao->getClassification
|
227 |
$class_inf = $this->taxonDao->getClassification
|
244 |
('Inferieur', $this->referentiel, $this->donnees['num_nom_retenu']);
|
228 |
('Inferieur', $this->referentiel, $this->donnees['num_nom_retenu']);
|
245 |
if ($class_inf != '') {
|
229 |
if ($class_inf != '') {
|
246 |
$this->donnees['classification']['inférieurs'] = $class_inf['inf'];
|
230 |
$this->donnees['classification']['inférieurs'] = $class_inf['inf'];
|
247 |
$this->donnees['niveau'] = $class_inf['niveau'];
|
231 |
$this->donnees['niveau'] = $class_inf['niveau'];
|
248 |
}
|
232 |
}
|
249 |
}
|
233 |
}
|
250 |
}
|
234 |
}
|
251 |
|
235 |
|
252 |
private function chargerComplements() {
|
236 |
private function chargerComplements() {
|
253 |
$champs_manuel_technique = explode(',', $this->manuel['champs']);
|
237 |
$champs_manuel_technique = explode(',', $this->manuel['champs']);
|
254 |
$champs_base_donnees = key($this->donnees['info']);
|
238 |
$champs_base_donnees = key($this->donnees['info']);
|
255 |
$champs_supp_base = array_diff_key($this->donnees['info'], array_flip($champs_manuel_technique));
|
239 |
$champs_supp_base = array_diff_key($this->donnees['info'], array_flip($champs_manuel_technique));
|
256 |
foreach ($champs_supp_base as $champ=>$valeur) {
|
240 |
foreach ($champs_supp_base as $champ=>$valeur) {
|
257 |
if (!(preg_match('/presence_(.*)/',$champ) || preg_match('/statut_origine_(.*)/', $champ) ||
|
241 |
if (!(preg_match('/presence_(.*)/',$champ) || preg_match('/statut_origine_(.*)/', $champ) ||
|
258 |
preg_match('/statut_introduction_(.*)/', $champ) || preg_match('/statut_culture_(.*)/', $champ))) {
|
242 |
preg_match('/statut_introduction_(.*)/', $champ) || preg_match('/statut_culture_(.*)/', $champ))) {
|
259 |
$this->donnees['complement'][$champ] = $valeur;
|
243 |
$this->donnees['complement'][$champ] = $valeur;
|
260 |
}
|
244 |
}
|
261 |
}
|
245 |
}
|
262 |
}
|
246 |
}
|
263 |
|
247 |
|
264 |
private function parserChaineDeRecherche($chaine) {
|
248 |
private function parserChaineDeRecherche($chaine) {
|
265 |
$mots = preg_split('/ /i', $chaine, -1, PREG_SPLIT_NO_EMPTY);
|
249 |
$mots = preg_split('/ /i', $chaine, -1, PREG_SPLIT_NO_EMPTY);
|
266 |
$parametres = array('mots' => '');
|
250 |
$parametres = array('mots' => '');
|
267 |
$cle_precedente = null;
|
251 |
$cle_precedente = null;
|
268 |
foreach ($mots as $mot) {
|
252 |
foreach ($mots as $mot) {
|
269 |
if (preg_match('/^(sg|gen|sp|ssp|au|an|nn|bib|nr|tax):(.*)$/', $mot, $match)) {
|
253 |
if (preg_match('/^(sg|gen|sp|ssp|au|an|nn|bib|nr|tax):(.*)$/', $mot, $match)) {
|
270 |
$cle = $match[1];
|
254 |
$cle = $match[1];
|
271 |
$cle_precedente = $cle;
|
255 |
$cle_precedente = $cle;
|
272 |
$valeur = $match[2];
|
256 |
$valeur = $match[2];
|
273 |
$parametres[$cle] = $valeur;
|
257 |
$parametres[$cle] = $valeur;
|
274 |
} else if (!is_null($cle_precedente)) {
|
258 |
} else if (!is_null($cle_precedente)) {
|
275 |
$parametres[$cle_precedente] .= ' '.$mot;
|
259 |
$parametres[$cle_precedente] .= ' '.$mot;
|
276 |
} else if (is_null($cle_precedente)) {
|
260 |
} else if (is_null($cle_precedente)) {
|
277 |
if (empty($parametres['mots'])) {
|
261 |
if (empty($parametres['mots'])) {
|
278 |
$parametres['mots'] = $mot;
|
262 |
$parametres['mots'] = $mot;
|
279 |
} else {
|
263 |
} else {
|
280 |
$parametres['mots'] .= ' '.$mot;
|
264 |
$parametres['mots'] .= ' '.$mot;
|
281 |
}
|
265 |
}
|
282 |
}
|
266 |
}
|
283 |
}
|
267 |
}
|
284 |
return $parametres;
|
268 |
return $parametres;
|
285 |
}
|
269 |
}
|
286 |
|
270 |
|
287 |
public function encodeChaine($chaine) {
|
271 |
public function encodeChaine($chaine) {
|
288 |
if (Config::get('sortie_encodage') != Config::get('appli_encodage')) {
|
272 |
if (Config::get('sortie_encodage') != Config::get('appli_encodage')) {
|
289 |
$chaine = mb_convert_encoding($chaine, Config::get('sortie_encodage'), Config::get('appli_encodage'));
|
273 |
$chaine = mb_convert_encoding($chaine, Config::get('sortie_encodage'), Config::get('appli_encodage'));
|
290 |
}
|
274 |
}
|
291 |
$chaine = urlencode($chaine);
|
275 |
$chaine = urlencode($chaine);
|
292 |
return $chaine;
|
276 |
return $chaine;
|
293 |
}
|
277 |
}
|
294 |
|
278 |
|
295 |
// retourne l'url de la fiche taxon pour les liens
|
279 |
// retourne l'url de la fiche taxon pour les liens
|
296 |
public static function getUrlFicheTaxon($params, $type) {
|
280 |
public static function getUrlFicheTaxon($params, $type) {
|
297 |
$taxon = null;
|
281 |
$taxon = null;
|
298 |
switch ($type) {
|
282 |
switch ($type) {
|
299 |
case 'bas' :
|
283 |
case 'bas' :
|
300 |
$taxon['num_nom'] = $params['bas_num'];
|
284 |
$taxon['num_nom'] = $params['bas_num'];
|
301 |
break;
|
285 |
break;
|
302 |
case 'p1' :
|
286 |
case 'p1' :
|
303 |
$taxon['num_nom'] = $params['p1_num'];
|
287 |
$taxon['num_nom'] = $params['p1_num'];
|
304 |
break;
|
288 |
break;
|
305 |
case 'p2' :
|
289 |
case 'p2' :
|
306 |
$taxon['num_nom'] = $params['p2_num'];
|
290 |
$taxon['num_nom'] = $params['p2_num'];
|
307 |
break;
|
291 |
break;
|
308 |
default :
|
292 |
default :
|
309 |
break;
|
293 |
break;
|
310 |
}
|
294 |
}
|
311 |
return Recherche::getUrlFicheTaxon($taxon);
|
295 |
return Recherche::getUrlFicheTaxon($taxon);
|
312 |
}
|
296 |
}
|
313 |
|
297 |
|
314 |
// charger tableau de $this->manuel
|
298 |
// charger tableau de $this->manuel
|
315 |
private function chargerTableauManuel($titreTableau) {
|
299 |
private function chargerTableauManuel($titreTableau) {
|
316 |
$champs = explode(',', $this->manuel[$titreTableau]);
|
300 |
$champs = explode(',', $this->manuel[$titreTableau]);
|
317 |
foreach ($champs as $champ) {
|
301 |
foreach ($champs as $champ) {
|
318 |
list($champ_nom, $type) = explode('=', trim($champ));
|
302 |
list($champ_nom, $type) = explode('=', trim($champ));
|
319 |
$this->tableau_manuel[$titreTableau][$champ_nom] = $type;
|
303 |
$this->tableau_manuel[$titreTableau][$champ_nom] = $type;
|
320 |
}
|
304 |
}
|
321 |
}
|
305 |
}
|
322 |
|
306 |
|
323 |
|
307 |
|
324 |
}
|
308 |
}
|