Subversion Repositories Applications.annuaire

Rev

Rev 432 | 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){
442 jpm 18
		if (!isset($uid[0])) {
69 aurelien 19
			$id_annuaire = $uid[0];
442 jpm 20
		} else {
69 aurelien 21
			$id_annuaire = Config::get('annuaire_defaut');
442 jpm 22
		}
23
 
293 jpm 24
		if (isset($uid[1])) {
248 aurelien 25
			$type_stat = $uid[1];
442 jpm 26
		} else {
27
			$type_stat = '';
28
		}
29
 
30
		$controleur = new StatistiqueControleur();
31
 
32
		switch($type_stat) {
33
			case 'annee' :
34
				$annee = isset($uid[2]) ? $uid[2] : null;
35
				$graph = $controleur->obtenirStatistiquesPourAnnee($id_annuaire, $annee);
36
			break;
37
			case 'annees' :
38
				$graph = $controleur->obtenirStatistiquesParAnnees($id_annuaire);
39
				break;
40
			case 'continents' :
41
				$graph = $controleur->obtenirStatistiquesInscritsParContinents($id_annuaire);
42
				break;
43
			case 'europe' :
44
				$graph = $controleur->obtenirStatistiquesInscritsEurope($id_annuaire);
45
				break;
46
			case 'modification' :
47
				$graph = $controleur->obtenirStatistiquesModificationsProfil($id_annuaire);
48
				break;
49
			default:
50
				$graph = $controleur->obtenirStatistiquesParCritere($id_annuaire,$type_stat, '');
51
		}
248 aurelien 52
 
53
		// Envoi d'une image png
54
		header("Content-type: image/png charset=utf-8\n\n");
293 jpm 55
		imagepng($graph);
69 aurelien 56
	}
57
}
58
?>