Subversion Repositories Applications.annuaire

Rev

Rev 432 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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