Subversion Repositories Applications.annuaire

Rev

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

Rev Author Line No. Line
69 aurelien 1
<?php
293 jpm 2
// declare(encoding='UTF-8');
69 aurelien 3
/**
293 jpm 4
 * Service
5
 *
6
 * @category	php 5.2
7
 * @package		Annuaire::Services
8
 * @author		Aurélien PERONNET <aurelien@tela-botanica.org>
9
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
10
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
11
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
13
 * @version		$Id$
14
 */
15
class StatistiquesAnnuaire extends JRestService {
69 aurelien 16
 
17
	public function getElement($uid){
18
 
293 jpm 19
	    if (!isset($uid[0])) {
69 aurelien 20
			$id_annuaire = $uid[0];
21
	    } else {
22
			$id_annuaire = Config::get('annuaire_defaut');
23
	    }
248 aurelien 24
 
293 jpm 25
		if (isset($uid[1])) {
248 aurelien 26
			$type_stat = $uid[1];
27
	    } else {
28
	    	$type_stat = '';
29
	    }
30
 
31
	    $controleur = new StatistiqueControleur();
32
 
33
	    switch($type_stat) {
34
	    	case 'annees' :
35
	    		$graph = $controleur->obtenirStatistiquesParAnnees($id_annuaire);
293 jpm 36
	    		break;
248 aurelien 37
	    	case 'continents' :
38
	    		$graph = $controleur->obtenirStatistiquesInscritsParContinents($id_annuaire);
293 jpm 39
	    		break;
248 aurelien 40
	    	case 'europe' :
41
	    		$graph = $controleur->obtenirStatistiquesInscritsEurope($id_annuaire);
293 jpm 42
	    		break;
248 aurelien 43
	    	case 'modification' :
44
	    		$graph = $controleur->obtenirStatistiquesModificationsProfil($id_annuaire);
293 jpm 45
	    		break;
248 aurelien 46
	    	default:
47
	    		$graph = $controleur->obtenirStatistiquesParCritere($id_annuaire,$type_stat, '');
48
	    }
49
 
50
		// Envoi d'une image png
51
		header("Content-type: image/png charset=utf-8\n\n");
293 jpm 52
		imagepng($graph);
69 aurelien 53
	}
54
}
55
?>