Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 565 → Rev 566

/trunk/metier/api_0.1/Graphiques.php
New file
0,0 → 1,82
<?php
// declare(encoding='UTF-8');
/**
* Classe gérant les graphiques et leurs légendes.
*
* @category PHP 5.2
* @package eflore-consultation
* @author Mathilde SALTHUN-LASSALLE <mathilde@tela-botanica.org>
* @copyright 2011 Tela-Botanica
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
* @version $Id$
*/
class Graphiques extends Eflore {
 
private $bdnt;
private $num_nom;
private $type_graph;
private $classe;
private $code;
private $codes = array ("VEL", "VET", "VEHA", "VEC", "VER", "VEHE", "VETX", "VEN", "VES","VEMO");
 
public function setType_graph($tg) {
$this->type_graph = $tg;
}
public function setCode($code) {
$this->code = $code;
}
public function setClasse($classe) {
$this->classe = $classe;
}
public function setBdnt($bdnt){
$this->bdnt = $bdnt;
}
public function setNum_nom($nn){
$this->num_nom = $nn;
}
public function getLegendeGraphique() {
$legende = array();
foreach ($this->codes as $cod){
$i = ($cod == "VES") ? 0 : 1 ;
$max = ($cod == "VEHE") ? 12 : 9 ;
while ($i < $max+1){
$this->setClasse($cod);
$this->setCode($i);
$url = $this->getUrlLegende();
$legende[$cod][$i] = $this->chargerDonnees($url);
$i++;
}
}
return $legende;
}
public function getUrlLegende() {
$tpl = Config::get('legendeGraphiqueTpl');
$params = array( 'code' => $this->code, 'classe' => $this->classe );
$url = $this->formaterUrl($tpl, $params);
return $url ;
}
public function getGraphique() {
$url = $this->getUrlInformation();
return $this->chargerDonnees($url);
}
public function getUrlGraphique() {
$tpl = Config::get('graphiqueTpl');
$params = array( 'bdnt' => $this->bdnt, 'num_nom' => $this->num_nom , 'type_graph' => $this->type_graph);
$url = $this->formaterUrl($tpl, $params);
return $url;
}
}
?>