Subversion Repositories Applications.annuaire

Rev

Rev 403 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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