272 |
delphine |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Classe mère du module Liste.
|
|
|
5 |
*
|
|
|
6 |
* @category PHP 5.2
|
|
|
7 |
* @package eflore-consultation
|
|
|
8 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
|
|
9 |
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
|
558 |
mathilde |
10 |
* @author Mathilde Salthun-lassalle <mathilde@tela-botanica.org>
|
272 |
delphine |
11 |
* @copyright 2011 Tela-Botanica
|
|
|
12 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
|
|
|
13 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
|
|
|
14 |
* @version $Id$
|
|
|
15 |
*/
|
422 |
delphine |
16 |
class Ecologie extends aControleur {
|
568 |
mathilde |
17 |
|
957 |
aurelien |
18 |
private $referentiel = 'bdtfx';
|
|
|
19 |
private $donnees = array();
|
|
|
20 |
|
422 |
delphine |
21 |
public function __construct(Conteneur $conteneur) {
|
|
|
22 |
$this->conteneur = $conteneur;
|
|
|
23 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
957 |
aurelien |
24 |
$this->referentiel = $this->conteneur->getParametre('referentiel');
|
540 |
mathilde |
25 |
$this->informations = $this->conteneur->getApiInformations();
|
|
|
26 |
$this->meta = $this->conteneur->getApiMetaDonnees();
|
422 |
delphine |
27 |
$this->wikini = $this->conteneur->getApiWikini();
|
540 |
mathilde |
28 |
$this->appUrls = $this->conteneur->getAppUrls();
|
568 |
mathilde |
29 |
$this->graphique = $this->conteneur->getApiGraphiques();
|
770 |
mathilde |
30 |
$this->syntaxons = $this->conteneur->getApiSyntaxons();
|
568 |
mathilde |
31 |
|
763 |
aurelien |
32 |
parent::__construct();
|
422 |
delphine |
33 |
}
|
|
|
34 |
|
|
|
35 |
public function obtenirDonnees() {
|
417 |
aurelien |
36 |
$donnees = array();
|
957 |
aurelien |
37 |
$this->getWikini();
|
|
|
38 |
$this->getBaseflor();
|
|
|
39 |
$this->getBaseveg();
|
|
|
40 |
$this->donnees['urls'] = $this->appUrls;
|
|
|
41 |
return $this->donnees;
|
272 |
delphine |
42 |
}
|
417 |
aurelien |
43 |
|
770 |
mathilde |
44 |
public function obtenirDonneesExport() {
|
697 |
mathilde |
45 |
$donnees = array();
|
957 |
aurelien |
46 |
$this->getWikini();
|
|
|
47 |
$this->getBaseflorExport();
|
|
|
48 |
$this->getBaseveg();
|
|
|
49 |
return $this->donnees;
|
697 |
mathilde |
50 |
}
|
|
|
51 |
|
770 |
mathilde |
52 |
public function getBaseflorCatminat($depart, $limite) {
|
|
|
53 |
$baseflorCatminat = array();
|
957 |
aurelien |
54 |
$this->informations->setProjet('baseflor');
|
|
|
55 |
$this->informations->setBdnt($this->conteneur->getParametre('referentiel'));
|
987 |
delphine |
56 |
$this->informations->setNum_nom($this->nomCourant->getNnr());
|
957 |
aurelien |
57 |
$this->informations->setDepart($depart);
|
|
|
58 |
$this->informations->setLimite($limite);
|
770 |
mathilde |
59 |
$informations = $this->informations->getInformationsRelationCatminat();
|
|
|
60 |
if($informations != ""){
|
|
|
61 |
$baseflorCatminat['catminat'] = $informations['resultat'][0]['catminat_code'];
|
987 |
delphine |
62 |
$baseflorCatminat['lien-liste-fancy'] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_taxons',$this->conteneur->getParametre('referentiel'),$this->nomCourant->getNnr(),$baseflorCatminat['catminat']);
|
770 |
mathilde |
63 |
}else {
|
|
|
64 |
$baseflorCatminat['aucune'] = 'Aucunes données';
|
|
|
65 |
}
|
|
|
66 |
return $baseflorCatminat;
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
private function getBaseveg() {
|
957 |
aurelien |
70 |
if (Config::get($this->referentiel.'.basePhytosocio') != "") {
|
|
|
71 |
$baseveg = array();
|
|
|
72 |
$baseflor = $this->getBaseflorCatminat(0,500);
|
|
|
73 |
$baseveg['baseflor'] = $baseflor;
|
|
|
74 |
if (isset($baseflor['catminat'])) {
|
|
|
75 |
$this->syntaxons->setProjet('baseveg');
|
|
|
76 |
$catminat = str_replace('/','-',$baseflor['catminat']);
|
|
|
77 |
$this->syntaxons->setCatminat($catminat);
|
|
|
78 |
$syntaxonsSup = $this->syntaxons->getSyntaxonsSuperieurs();
|
|
|
79 |
$baseveg['syntaxons-sup'] = $syntaxonsSup['resultat'];
|
|
|
80 |
$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
|
|
|
81 |
$baseveg['syntaxon-courant'] = $syntaxonsCourant['resultat'];
|
|
|
82 |
foreach ($baseveg['syntaxons-sup'] as $cle => $valeurs) {
|
|
|
83 |
$catminat_sup = str_replace('/','-',$valeurs['code_catminat']);
|
987 |
delphine |
84 |
$baseveg['synonymes']['lien-liste-fancy'][$valeurs['code_catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_synonymes',$this->conteneur->getParametre('referentiel'),$this->nomCourant->getNnr(),$catminat_sup);
|
|
|
85 |
$baseveg['ref']['lien-liste-fancy'][$valeurs['code_catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_ref',$this->conteneur->getParametre('referentiel'),$this->nomCourant->getNnr(),$catminat_sup);
|
|
|
86 |
$baseveg['taxons']['lien-liste-fancy'][$valeurs['code_catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_taxons_sup',$this->conteneur->getParametre('referentiel'),$this->nomCourant->getNnr(),$catminat_sup);
|
957 |
aurelien |
87 |
}
|
987 |
delphine |
88 |
$baseveg['synonymes']['lien-liste-fancy'][$baseflor['catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_synonymes',$this->conteneur->getParametre('referentiel'),$this->nomCourant->getNnr(),$catminat);
|
|
|
89 |
$baseveg['ref']['lien-liste-fancy'][$baseflor['catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_ref',$this->conteneur->getParametre('referentiel'),$this->nomCourant->getNnr(),$catminat);
|
957 |
aurelien |
90 |
$this->meta->setProjet('baseveg');
|
|
|
91 |
$meta = $this->meta->getMetaDonnees();
|
|
|
92 |
$citation = $meta[0]['citation'];
|
|
|
93 |
$baseveg['meta']['citation'] = $citation;
|
|
|
94 |
$baseveg['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseveg');
|
|
|
95 |
}else {
|
|
|
96 |
$baseveg['aucune'] = 'Aucunes données';
|
804 |
mathilde |
97 |
}
|
957 |
aurelien |
98 |
$this->donnees['baseveg'] = $baseveg;
|
770 |
mathilde |
99 |
}
|
|
|
100 |
}
|
|
|
101 |
|
824 |
mathilde |
102 |
private function getBasevegSyntaxonCourant() {
|
|
|
103 |
$baseveg = array();
|
|
|
104 |
$baseflor = $this->getBaseflorCatminat(0,500);
|
|
|
105 |
if (isset($baseflor['catminat'])) {
|
|
|
106 |
$this->syntaxons->setProjet('baseveg');
|
|
|
107 |
$catminat = str_replace('/','-',$baseflor['catminat']);
|
|
|
108 |
$this->syntaxons->setCatminat($catminat);
|
|
|
109 |
$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
|
|
|
110 |
$baseveg['description'] = $syntaxonsCourant['resultat'];
|
|
|
111 |
}
|
|
|
112 |
return $baseveg;
|
|
|
113 |
}
|
957 |
aurelien |
114 |
|
417 |
aurelien |
115 |
private function getWikini() {
|
|
|
116 |
$wikini = array();
|
|
|
117 |
$wikini['titre'] = 'Wikini';
|
|
|
118 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
|
|
119 |
$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
|
|
|
120 |
$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
|
418 |
aurelien |
121 |
$wikini['ecologie'] = $this->wikini->getTexteFormate($page_wiki, 'ecologie');
|
957 |
aurelien |
122 |
$this->donnees['wikini'] = $wikini;
|
417 |
aurelien |
123 |
}
|
540 |
mathilde |
124 |
|
558 |
mathilde |
125 |
public function getBloc() {
|
606 |
mathilde |
126 |
$donnees = array();
|
957 |
aurelien |
127 |
$this->getBaseflor(false);
|
|
|
128 |
$this->donnees['graph'] = $this->donnees['baseflor'];
|
|
|
129 |
$this->donnees['graph']['titre'] = 'Optimum écologique';
|
|
|
130 |
$this->donnees['phytosocio'] = $this->getBasevegSyntaxonCourant();
|
|
|
131 |
|
|
|
132 |
return $this->donnees;
|
558 |
mathilde |
133 |
}
|
|
|
134 |
|
697 |
mathilde |
135 |
private function getBaseflorExport() {
|
|
|
136 |
$baseflor = array();
|
|
|
137 |
$this->informations ->setProjet('baseflor');
|
|
|
138 |
$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
|
987 |
delphine |
139 |
$this->informations ->setNum_nom($this->nomCourant->getNnr());
|
697 |
mathilde |
140 |
$informations = $this->informations->getInformationsEcologie();
|
844 |
aurelien |
141 |
if(is_array($informations)){
|
697 |
mathilde |
142 |
$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
|
|
|
143 |
$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
|
|
|
144 |
$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
|
|
|
145 |
$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
|
|
|
146 |
$this->graphique -> setProjet('baseflor');
|
|
|
147 |
$baseflor['legende_eco'] = Config::get('chemin_images').'legende_formes.png';
|
|
|
148 |
$this->meta->setProjet('baseflor');
|
|
|
149 |
$meta = $this->meta->getMetaDonnees();
|
|
|
150 |
$citation = $meta[0]['citation'];
|
|
|
151 |
$baseflor['meta']['citation'] = $citation;
|
|
|
152 |
}else {
|
|
|
153 |
$baseflor['aucune'] = 'Aucunes données';
|
|
|
154 |
}
|
|
|
155 |
return $baseflor;
|
|
|
156 |
}
|
|
|
157 |
|
752 |
aurelien |
158 |
private function getBaseflor($inclure_legende = true) {
|
957 |
aurelien |
159 |
if (Config::get($this->referentiel.'.baseEcologie') != "") {
|
987 |
delphine |
160 |
$num_nom = $this->nomCourant->getNnr();
|
962 |
aurelien |
161 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
|
|
162 |
$cache = $this->obtenirCache('baseflor/graphique/'.$referentiel.'_'.$num_nom);
|
957 |
aurelien |
163 |
if($cache != null) {
|
|
|
164 |
$baseflor = $cache;
|
|
|
165 |
$this->graphique ->setProjet('baseflor');
|
|
|
166 |
$graphique = $this->graphique->getLegendeGraphique();
|
|
|
167 |
$baseflor['legende'] = $graphique ;
|
|
|
168 |
} else {
|
|
|
169 |
$baseflor = array();
|
|
|
170 |
$this->informations ->setProjet('baseflor');
|
|
|
171 |
$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
|
987 |
delphine |
172 |
$this->informations ->setNum_nom($this->nomCourant->getNnr());
|
957 |
aurelien |
173 |
$informations = $this->informations->getInformationsEcologie();
|
|
|
174 |
if(is_array($informations)){
|
|
|
175 |
if (isset($informations['graphique_climat'])) {
|
|
|
176 |
$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
|
|
|
177 |
$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
|
|
|
178 |
$baseflor['description']['climat_url'] = $informations['graphique_climat']['href']."?retour.format=420";
|
|
|
179 |
$baseflor['description']['climat_url_png'] = $informations['graphique_climat']['href']."?retour.format=420&retour=image/png";
|
|
|
180 |
|
|
|
181 |
}
|
|
|
182 |
if (isset($informations['graphique_sol'])) {
|
|
|
183 |
$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
|
|
|
184 |
$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
|
|
|
185 |
$baseflor['description']['sol_url'] = $informations['graphique_sol']['href']."?retour.format=420";
|
|
|
186 |
$baseflor['description']['sol_url_png'] = $informations['graphique_sol']['href']."?retour.format=420&retour=image/png";
|
|
|
187 |
|
|
|
188 |
}
|
|
|
189 |
if($inclure_legende) {
|
|
|
190 |
$this->graphique ->setProjet('baseflor');
|
|
|
191 |
$graphique = $this->graphique->getLegendeGraphique();
|
|
|
192 |
$baseflor['legende'] = $graphique ;
|
|
|
193 |
}
|
|
|
194 |
$this->meta->setProjet('baseflor');
|
|
|
195 |
$meta = $this->meta->getMetaDonnees();
|
|
|
196 |
$citation = $meta[0]['citation'];
|
|
|
197 |
$baseflor['meta']['citation'] = $citation;
|
|
|
198 |
$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
|
840 |
mathilde |
199 |
|
962 |
aurelien |
200 |
$this->mettreEnCache('baseflor/graphique/'.$referentiel.'_'.$num_nom, $baseflor);
|
957 |
aurelien |
201 |
} else {
|
|
|
202 |
$baseflor['aucune'] = 'Aucunes données';
|
838 |
mathilde |
203 |
}
|
752 |
aurelien |
204 |
}
|
957 |
aurelien |
205 |
$this->donnees['baseflor'] = $baseflor;
|
540 |
mathilde |
206 |
}
|
|
|
207 |
}
|
272 |
delphine |
208 |
}
|
|
|
209 |
?>
|