Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
566 mathilde 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Classe gérant les graphiques et leurs légendes.
5
 *
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
8
 * @author		Mathilde SALTHUN-LASSALLE <mathilde@tela-botanica.org>
9
 * @copyright	2011 Tela-Botanica
10
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
11
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
12
 * @version		$Id$
13
 */
14
class Graphiques  extends Eflore {
15
 
16
	private $bdnt;
17
	private $num_nom;
18
	private $type_graph;
19
	private $classe;
20
	private $code;
21
	private $codes =  array ("VEL", "VET", "VEHA", "VEC", "VER", "VEHE", "VETX", "VEN", "VES","VEMO");
22
 
23
 
24
 
25
	public function setType_graph($tg) {
26
		$this->type_graph = $tg;
27
	}
28
 
29
	public function setCode($code) {
30
		$this->code = $code;
31
	}
32
 
33
	public function setClasse($classe) {
34
		$this->classe = $classe;
35
	}
36
 
37
	public function setBdnt($bdnt){
38
		$this->bdnt = $bdnt;
39
	}
40
 
41
	public function setNum_nom($nn){
42
		$this->num_nom = $nn;
43
	}
44
 
45
 
46
	public function getLegendeGraphique() {
47
		$legende = array();
48
		foreach ($this->codes as $cod){
49
			$i = ($cod == "VES") ?  0 : 1 ;
50
			$max = ($cod == "VEHE") ?  12 : 9 ;
51
			while ($i < $max+1){
52
				$this->setClasse($cod);
53
				$this->setCode($i);
54
				$url = $this->getUrlLegende();
55
				$legende[$cod][$i] = $this->chargerDonnees($url);
56
				$i++;
57
			}
58
		}
59
		return $legende;
60
	}
61
 
62
	public function getUrlLegende() {
63
		$tpl = Config::get('legendeGraphiqueTpl');
64
		$params = array( 'code' => $this->code, 'classe' => $this->classe );
65
		$url = $this->formaterUrl($tpl, $params);
66
		return $url ;
67
	}
68
 
69
	public function getGraphique() {
70
		$url = $this->getUrlInformation();
71
		return $this->chargerDonnees($url);
72
	}
73
 
74
	public function getUrlGraphique() {
75
		$tpl = Config::get('graphiqueTpl');
76
		$params = array( 'bdnt' => $this->bdnt, 'num_nom' => $this->num_nom , 'type_graph' => $this->type_graph);
77
		$url = $this->formaterUrl($tpl, $params);
78
		return $url;
79
	}
80
 
81
}
82
?>