Line 22... |
Line 22... |
22 |
private $informations = null;
|
22 |
private $informations = null;
|
23 |
private $mois = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août',
|
23 |
private $mois = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août',
|
24 |
'septembre', 'octobre', 'novembre', 'décembre');
|
24 |
'septembre', 'octobre', 'novembre', 'décembre');
|
25 |
private $CosteFormate;
|
25 |
private $CosteFormate;
|
26 |
private $CosteTexte;
|
26 |
private $CosteTexte;
|
- |
|
27 |
|
- |
|
28 |
private $referentiel = 'bdtfx';
|
- |
|
29 |
private $donnees = array();
|
Line 27... |
Line 30... |
27 |
|
30 |
|
28 |
public function __construct(Conteneur $conteneur) {
|
31 |
public function __construct(Conteneur $conteneur) {
|
29 |
$this->conteneur = $conteneur;
|
32 |
$this->conteneur = $conteneur;
|
- |
|
33 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
30 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
34 |
$this->referentiel = $this->conteneur->getParametre('referentiel');
|
31 |
$this->textes = $this->conteneur->getApiTextes();
|
35 |
$this->textes = $this->conteneur->getApiTextes();
|
32 |
$this->wikini = $this->conteneur->getApiWikini();
|
36 |
$this->wikini = $this->conteneur->getApiWikini();
|
33 |
$this->meta = $this->conteneur->getApiMetaDonnees();
|
37 |
$this->meta = $this->conteneur->getApiMetaDonnees();
|
34 |
$this->informations = $this->conteneur->getApiInformations();
|
38 |
$this->informations = $this->conteneur->getApiInformations();
|
35 |
$this->appUrls = $this->conteneur->getAppUrls();
|
39 |
$this->appUrls = $this->conteneur->getAppUrls();
|
Line 36... |
Line 40... |
36 |
}
|
40 |
}
|
37 |
|
41 |
|
38 |
public function obtenirDonnees() {
|
42 |
public function obtenirDonnees() {
|
39 |
$donnees = array();
|
- |
|
40 |
$donnees['wp'] = $this->getWikipedia();
|
43 |
$donnees = array();
|
41 |
$donnees['coste'] = $this->getCoste();
|
44 |
$this->getWikipedia();
|
42 |
$donnees['wikini'] = $this->getWikini();
|
45 |
$this->getWikini();
|
43 |
$donnees['baseflor'] = $this->getBaseflor();
|
46 |
$this->getDescriptionsDependantesReferentiel();
|
Line 44... |
Line 47... |
44 |
return $donnees;
|
47 |
return $this->donnees;
|
45 |
}
|
48 |
}
|
- |
|
49 |
|
46 |
|
50 |
public function obtenirDonneesExport() {
|
47 |
public function obtenirDonneesExport() {
|
51 |
$donnees = array();
|
- |
|
52 |
$this->getWikini();
|
- |
|
53 |
$this->getDescriptionsDependantesReferentiel();
|
- |
|
54 |
return $this->donnees;
|
- |
|
55 |
}
|
- |
|
56 |
|
- |
|
57 |
private function getDescriptionsDependantesReferentiel() {
|
48 |
$donnees = array();
|
58 |
$bases_descriptions = Config::get($this->referentiel.'.baseDescription');
|
- |
|
59 |
$bases_descriptions = explode(',',$bases_descriptions);
|
- |
|
60 |
|
49 |
$donnees['coste'] = $this->getCoste();
|
61 |
foreach ($bases_descriptions as $base) {
|
- |
|
62 |
if($this->aMethodeDescription($base)) {
|
- |
|
63 |
$fonction = 'get'.ucfirst($base);
|
- |
|
64 |
$this->$fonction();
|
- |
|
65 |
}
|
- |
|
66 |
}
|
- |
|
67 |
}
|
50 |
$donnees['wikini'] = $this->getWikini();
|
68 |
|
Line 51... |
Line 69... |
51 |
$donnees['baseflor'] = $this->getBaseflor();
|
69 |
private function aMethodeDescription($base) {
|
52 |
return $donnees;
|
70 |
return method_exists($this, 'get'.$base);
|
53 |
}
|
71 |
}
|
54 |
|
72 |
|
55 |
private function getBaseflor() {
|
73 |
private function getBaseflor() {
|
56 |
$baseflor = array();
|
74 |
$baseflor = array();
|
57 |
$this->informations ->setProjet('baseflor');
|
75 |
$this->informations ->setProjet('baseflor');
|
58 |
$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
|
76 |
$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
|
59 |
$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
|
77 |
$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
|
60 |
$informations = $this->informations->getInformationsDescription();
|
78 |
$informations = $this->informations->getInformationsDescription();
|
61 |
if ($informations){
|
79 |
if ($informations){
|
62 |
$baseflor['chorologie'] = $informations['chorologie'];
|
80 |
$baseflor['chorologie'] = isset($informations['chorologie']) ? $informations['chorologie'] : '';
|
63 |
$baseflor['inflorescence'] = $informations['inflorescence'];
|
81 |
$baseflor['inflorescence'] = isset($informations['inflorescence']) ? $informations['inflorescence'] : '';
|
64 |
$baseflor['sexualite'] = $informations['sexualite'];
|
82 |
$baseflor['sexualite'] = isset($informations['sexualite']) ? $informations['sexualite'] : '';
|
65 |
$baseflor['ordre_maturation'] = $informations['ordre_maturation'];
|
83 |
$baseflor['ordre_maturation'] = isset($informations['ordre_maturation']) ? $informations['ordre_maturation'] : '';
|
66 |
$baseflor['pollinisation'] = $informations['pollinisation'];
|
84 |
$baseflor['pollinisation'] = isset($informations['pollinisation']) ? $informations['pollinisation'] : '';
|
67 |
$baseflor['dissemination'] = $informations['dissemination'];
|
85 |
$baseflor['dissemination'] = isset($informations['dissemination']) ? $informations['dissemination'] : '';
|
68 |
$baseflor['fruit'] = $informations['fruit'];
|
86 |
$baseflor['fruit'] = isset($informations['fruit']) ? $informations['fruit'] : '';
|
69 |
$baseflor['couleur_fleur'] = $informations['couleur_fleur'];
|
87 |
$baseflor['couleur_fleur'] = isset($informations['couleur_fleur']) ? $informations['couleur_fleur'] : '';
|
70 |
$baseflor['macule'] = $informations['macule'];
|
88 |
$baseflor['macule'] = isset($informations['macule']) ? $informations['macule'] : '';
|
71 |
$baseflor['floraison'] = $this->changerFloraisonEnChaine($informations['floraison']);
|
89 |
$baseflor['floraison'] = isset($informations['floraison']) ? $this->changerFloraisonEnChaine($informations['floraison']) : '';
|
72 |
//récupérer dans ontologies
|
90 |
//récupérer dans ontologies
|
73 |
$baseflor['type_bio'] = $informations['type_bio.libelle'];
|
91 |
$baseflor['type_bio'] = isset($informations['type_bio']) ? $informations['type_bio'] : '';
|
74 |
$baseflor['form_vegetale'] = $informations['form_vegetale'];
|
92 |
$baseflor['form_vegetale'] = isset($informations['form_vegetale']) ? $informations['form_vegetale'] : '';
|
75 |
$baseflor['description']=$baseflor;
|
93 |
$baseflor['description']=$baseflor;
|
76 |
$this->meta->setProjet('baseflor');
|
94 |
$this->meta->setProjet('baseflor');
|
77 |
$meta = $this->meta->getMetaDonnees();
|
95 |
$meta = $this->meta->getMetaDonnees();
|
78 |
$citation = $meta[0]['citation'];
|
96 |
$citation = $meta[0]['citation'];
|
79 |
$baseflor['meta']['citation'] = $citation;
|
97 |
$baseflor['meta']['citation'] = $citation;
|
Line 80... |
Line 98... |
80 |
$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
|
98 |
$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
|
81 |
}
|
99 |
}
|
82 |
return $baseflor;
|
100 |
$this->donnees['baseflor'] = $baseflor;
|
Line 116... |
Line 134... |
116 |
$this->textes->setProjet('wikipedia');
|
134 |
$this->textes->setProjet('wikipedia');
|
117 |
$this->textes->setId($this->getIdWp());
|
135 |
$this->textes->setId($this->getIdWp());
|
118 |
$wp['titre'] = $donnees['titre'] = "Description de wikipedia";
|
136 |
$wp['titre'] = $donnees['titre'] = "Description de wikipedia";
|
119 |
$wp['lien'] = $this->textes->getPageUrl();
|
137 |
$wp['lien'] = $this->textes->getPageUrl();
|
120 |
$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
|
138 |
$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
|
121 |
|
- |
|
122 |
return $wp;
|
139 |
$this->donnees['wp'] = $wp;
|
123 |
}
|
140 |
}
|
Line 124... |
Line 141... |
124 |
|
141 |
|
125 |
private function getIdWp() {
|
142 |
private function getIdWp() {
|
126 |
$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
|
143 |
$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
|
Line 134... |
Line 151... |
134 |
$wikini['titre'] = 'Wikini';
|
151 |
$wikini['titre'] = 'Wikini';
|
135 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
152 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
136 |
$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
|
153 |
$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
|
137 |
$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
|
154 |
$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
|
138 |
$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
|
155 |
$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
|
139 |
return $wikini;
|
156 |
$this->donnees['wikini'] = $wikini;
|
140 |
}
|
157 |
}
|
Line 141... |
Line 158... |
141 |
|
158 |
|
142 |
public function getLienWikini() {
|
159 |
public function getLienWikini() {
|
143 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
160 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
Line 157... |
Line 174... |
157 |
$this->meta->setProjet('coste');
|
174 |
$this->meta->setProjet('coste');
|
158 |
$meta = $this->meta->getMetaDonnees();
|
175 |
$meta = $this->meta->getMetaDonnees();
|
159 |
$citation = $meta[0]['citation'];
|
176 |
$citation = $meta[0]['citation'];
|
160 |
$coste['meta']['citation'] = $citation;
|
177 |
$coste['meta']['citation'] = $citation;
|
161 |
$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
|
178 |
$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
|
162 |
return $coste;
|
179 |
$this->donnees['coste'] = $coste;
|
163 |
}
|
180 |
}
|
Line 164... |
Line 181... |
164 |
|
181 |
|
165 |
public function mettreEnFormeCoste($texte){
|
182 |
public function mettreEnFormeCoste($texte){
|
166 |
$this->CosteFormate = array();
|
183 |
$this->CosteFormate = array();
|
Line 201... |
Line 218... |
201 |
|
218 |
|
202 |
public function separerEcologie_a_Usages(){
|
219 |
public function separerEcologie_a_Usages(){
|
203 |
if ( preg_match('/\.[ ]*([A-ZÉÀÈ].+)$/',$this->CosteTexte, $retour)){
|
220 |
if ( preg_match('/\.[ ]*([A-ZÉÀÈ].+)$/',$this->CosteTexte, $retour)){
|
204 |
$this->CosteFormate['ecologie'] = $retour[1];
|
221 |
$this->CosteFormate['ecologie'] = $retour[1];
|
205 |
$this->CosteTexte = str_replace($retour[0],'.',$this->CosteTexte);
|
222 |
$this->CosteTexte = str_replace($retour[0],'.',$this->CosteTexte);
|
206 |
if ( preg_match('/–(.+)/', $this->CosteFormate['ecologie'] , $retour)){
|
223 |
if (isset($this->CosteFormate['ecologie']) && preg_match('/–(.+)/', $this->CosteFormate['ecologie'] , $retour)){
|
207 |
$this->CosteFormate['repartition'] = $retour[1];
|
224 |
$this->CosteFormate['repartition'] = $retour[1];
|
208 |
$this->CosteFormate['ecologie'] = str_replace($retour[0],'',$this->CosteFormate['ecologie']);
|
225 |
$this->CosteFormate['ecologie'] = str_replace($retour[0],'',$this->CosteFormate['ecologie']);
|
209 |
}
|
226 |
}
|
210 |
if ( preg_match('/=(.+)$/', $this->CosteFormate['repartition'], $retour)){
|
227 |
if (isset($this->CosteFormate['repartition']) && preg_match('/=(.+)$/', $this->CosteFormate['repartition'], $retour)){
|
211 |
$this->CosteFormate['floraison'] = $retour[1];
|
228 |
$this->CosteFormate['floraison'] = $retour[1];
|
212 |
$this->CosteFormate['repartition'] = str_replace($retour[0],'',$this->CosteFormate['repartition']);
|
229 |
$this->CosteFormate['repartition'] = str_replace($retour[0],'',$this->CosteFormate['repartition']);
|
213 |
}
|
230 |
}
|
214 |
if ( preg_match('/–(.+)$|\n(.+)$/',$this->CosteFormate['floraison'], $retour)){
|
231 |
if (isset($this->CosteFormate['floraison']) && preg_match('/–(.+)$|\n(.+)$/',$this->CosteFormate['floraison'], $retour)){
|
215 |
$this->CosteFormate['usages'] = isset($retour[1]) ? $retour[1] : $retour[2];
|
232 |
$this->CosteFormate['usages'] = isset($retour[1]) ? $retour[1] : $retour[2];
|
216 |
$this->CosteFormate['floraison'] = str_replace($retour[0],'.',$this->CosteFormate['floraison']);
|
233 |
$this->CosteFormate['floraison'] = str_replace($retour[0],'.',$this->CosteFormate['floraison']);
|
217 |
}
|
234 |
}
|
218 |
if ( preg_match('/([Ff]l\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
|
235 |
if (isset($this->CosteFormate['floraison']) && preg_match('/([Ff]l\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
|
219 |
$this->CosteFormate['floraison'] = $retour[2];
|
236 |
$this->CosteFormate['floraison'] = $retour[2];
|
220 |
$this->CosteFormate['floraison'] = str_replace($retour[1],'',$this->CosteFormate['floraison']);
|
237 |
$this->CosteFormate['floraison'] = str_replace($retour[1],'',$this->CosteFormate['floraison']);
|
221 |
}
|
238 |
}
|
222 |
if ( preg_match('/([Ff]r\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
|
239 |
if (isset($this->CosteFormate['floraison']) && preg_match('/([Ff]r\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
|
223 |
$this->CosteFormate['fructification'] = $retour[2];
|
240 |
$this->CosteFormate['fructification'] = $retour[2];
|
224 |
$this->CosteFormate['floraison'] = str_replace($retour[0],'',$this->CosteFormate['floraison']);
|
241 |
$this->CosteFormate['floraison'] = str_replace($retour[0],'',$this->CosteFormate['floraison']);
|
225 |
$this->CosteFormate['floraison'] = str_replace(',','',$this->CosteFormate['floraison']);
|
242 |
$this->CosteFormate['floraison'] = str_replace(',','',$this->CosteFormate['floraison']);
|
226 |
$this->CosteFormate['fructification'] = str_replace($retour[1],'',$this->CosteFormate['fructification']);
|
243 |
$this->CosteFormate['fructification'] = str_replace($retour[1],'',$this->CosteFormate['fructification']);
|