Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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