Subversion Repositories Applications.annuaire

Rev

Rev 257 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
257 aurelien 1
<?php
293 jpm 2
// declare(encoding='UTF-8');
257 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 NbInscrits extends JRestService {
257 aurelien 16
 
17
	public function getRessource() {
18
		$this->getElement(array());
19
	}
20
 
21
	public function getElement($uid){
22
		$id_annuaire = Config::get('annuaire_defaut');
23
 
293 jpm 24
		if (isset($uid[0])) {
257 aurelien 25
			$id_annuaire = $uid[0];
26
		}
27
 
28
		$json = true;
293 jpm 29
		if (isset($uid[1]) && $uid[1] == 'html') {
257 aurelien 30
			$json = false;
31
		}
32
 
33
	    $controleur = new AnnuaireControleur();
34
		$valeurs = $controleur->chargerNombreAnnuaireListeInscrits($id_annuaire);
35
 
293 jpm 36
		if (!$json) {
37
			$valeurs =
38
			'<html>'."\n".
39
			'	</head>'."\n".
40
			'		<meta content="text/html; charset='.Config::get('sortie_encodage').'" http-equiv="Content-Type">'."\n".
41
			'	</head>'."\n".
42
			'	<body>'."\n".
43
			'		<div id="contenu">'.$valeurs.'</div>'."\n".
44
			'	</body>'."\n".
45
			'</html>';
257 aurelien 46
		}
47
 
293 jpm 48
		$this->envoyer($valeurs, 'text/html', Config::get('sortie_encodage'), $json);
257 aurelien 49
	}
50
}
51
?>