Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 752 | Rev 770 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
 
422 delphine 18
	public function __construct(Conteneur $conteneur) {
19
		$this->conteneur = $conteneur;
20
		$this->nomCourant = $this->conteneur->getNomCourant();
540 mathilde 21
		$this->informations = $this->conteneur->getApiInformations();
22
		$this->meta = $this->conteneur->getApiMetaDonnees();
422 delphine 23
		$this->wikini = $this->conteneur->getApiWikini();
540 mathilde 24
		$this->appUrls = $this->conteneur->getAppUrls();
568 mathilde 25
		$this->graphique = $this->conteneur->getApiGraphiques();
26
 
763 aurelien 27
		parent::__construct();
422 delphine 28
	}
29
 
30
	public function obtenirDonnees() {
417 aurelien 31
		$donnees = array();
32
		$donnees['wikini'] = $this->getWikini();
540 mathilde 33
		$donnees['baseflor'] = $this->getBaseflor();
272 delphine 34
		return $donnees;
35
	}
417 aurelien 36
 
697 mathilde 37
	public function obtenirDonneesEXport() {
38
		$donnees = array();
39
		$donnees['wikini'] = $this->getWikini();
40
		$donnees['baseflor'] = $this->getBaseflorExport();
41
		return $donnees;
42
	}
43
 
417 aurelien 44
	private function getWikini() {
45
		$wikini = array();
46
		$wikini['titre'] = 'Wikini';
47
		$referentiel = $this->conteneur->getParametre('referentiel');
48
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
49
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
418 aurelien 50
		$wikini['ecologie'] = $this->wikini->getTexteFormate($page_wiki, 'ecologie');
417 aurelien 51
		return $wikini;
52
	}
540 mathilde 53
 
558 mathilde 54
	public function getBloc() {
606 mathilde 55
		$donnees = array();
752 aurelien 56
		$donnees = $this->getBaseflor(false);
606 mathilde 57
		$donnees['titre'] = 'Optimum écologique';
558 mathilde 58
		return $donnees;
59
	}
60
 
697 mathilde 61
	private function getBaseflorExport() {
62
		$baseflor = array();
63
		$this->informations ->setProjet('baseflor');
64
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
65
		$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
66
		$informations = $this->informations->getInformationsEcologie();
67
		if($informations != ""){
68
			$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
69
			$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
70
			$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
71
			$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
72
			$this->graphique -> setProjet('baseflor');
73
			$baseflor['legende_eco'] = Config::get('chemin_images').'legende_formes.png';
74
			$this->meta->setProjet('baseflor');
75
			$meta = $this->meta->getMetaDonnees();
76
			$citation = $meta[0]['citation'];
77
			$baseflor['meta']['citation'] = $citation;
78
		}else {
79
			$baseflor['aucune'] = 'Aucunes données';
80
		}
81
		return $baseflor;
82
	}
83
 
752 aurelien 84
	private function getBaseflor($inclure_legende = true) {
763 aurelien 85
		$num_nom = $this->nomCourant->getNns();
86
		$cache = $this->obtenirCache('baseflor_graphique_'.$num_nom);
87
		if($cache != null) {
88
			$baseflor = $cache;
89
		} else {
90
			$baseflor = array();
91
			$this->informations ->setProjet('baseflor');
92
			$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
93
			$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
94
			$informations = $this->informations->getInformationsEcologie();
95
			if($informations != ""){
96
				$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
97
				$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
98
				$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
99
				$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
100
				$this->graphique -> setProjet('baseflor');
101
				if($inclure_legende) {
102
					$graphique = $this->graphique->getLegendeGraphique();
103
					$baseflor['legende'] =  $graphique ;
104
				}
105
				$this->meta->setProjet('baseflor');
106
				$meta = $this->meta->getMetaDonnees();
107
				$citation = $meta[0]['citation'];
108
				$baseflor['meta']['citation'] = $citation;
109
				$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
110
				$baseflor['description']['climat_url'] = $informations['graphique_climat']['href']."?retour.format=420";
111
				$baseflor['description']['sol_url'] = $informations['graphique_sol']['href']."?retour.format=420";
112
				$baseflor['description']['climat_url_png'] = $informations['graphique_climat']['href']."?retour.format=420&retour=image/png";
113
				$baseflor['description']['sol_url_png'] = $informations['graphique_sol']['href']."?retour.format=420&retour=image/png";
114
				$this->mettreEnCache('baseflor_graphique_'.$num_nom, $baseflor);
115
			}else {
116
				$baseflor['aucune'] = 'Aucunes données';
752 aurelien 117
			}
540 mathilde 118
		}
119
		return $baseflor;
120
	}
272 delphine 121
}
122
?>