Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2458 Rev 2461
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Cas d'utilisation :
-
 
5
 * Service recherche du nombre a partir de divers critères
4
 * Service recherche du nombre d'images à partir de divers critères.
6
 *
5
 *
-
 
6
 * Cas d'utilisation :
7
 * 2: Le service recherche le nombre d'images correspondant aux critères demandés
7
 * 2: Le service recherche le nombre d'images correspondant aux critères demandés
8
 * 3: Le service renvoie le nombre calculé
8
 * 3: Le service renvoie le nombre calculé
9
 *
9
 *
10
 * @internal   Mininum PHP version : 5.2
10
 * @internal   Mininum PHP version : 5.2
11
 * @category   CEL
11
 * @category   CEL
12
 * @package    Services
12
 * @package    Services
13
 * @subpackage Images
13
 * @subpackage Images
14
 * @version    0.1
14
 * @version    0.1
15
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
15
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
16
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
16
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
17
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
17
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
18
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
18
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
19
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
19
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
20
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
20
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
21
 */
21
 */
22
class InventoryImageCount extends Cel {
22
class InventoryImageCount extends Cel {
23
 
23
 
24
	/**
24
	/**
25
	 * Renvoie le nombre d'images correspondant aux criteres
25
	 * Renvoie le nombre d'images correspondant aux criteres
26
	 * uid[0] : utilisateur obligatoire
26
	 * uid[0] : utilisateur obligatoire
27
	 */
27
	 */
28
	public function getElement($uid) {
28
	public function getElement($uid) {
29
		// Controle detournement utilisateur
29
		// Controle detournement utilisateur
30
		$this->controleUtilisateur($uid[0]);
30
		$this->controleUtilisateur($uid[0]);
31
 
-
 
32
		$criteres = $_GET;
31
 
33
		$chercheurImages = new RechercheImage($this->config);
32
		$chercheurImages = new RechercheImage($this->config);
34
		$retour = $chercheurImages->compterImages($uid[0], $criteres);
33
		$retour = $chercheurImages->compterImages($uid[0], $_GET);
35
 
34
 
36
		$retour_encode = json_encode($retour);
35
		$retour_encode = json_encode($retour);
37
		$retour_encode = $this->nettoyerCaracteresNuls($retour_encode);
36
		$retour_encode = $this->nettoyerCaracteresNuls($retour_encode);
38
		header('content-type: application/json');
37
		header('content-type: application/json');
39
		print $retour_encode ;
38
		print $retour_encode ;
40
		exit() ;
39
		exit() ;
41
	}
40
	}
42
 
41
 
43
	private function nettoyerCaracteresNuls($chaine) {
42
	private function nettoyerCaracteresNuls($chaine) {
44
		return str_replace('\u0000','',$chaine);
43
		return str_replace('\u0000','',$chaine);
45
	}
44
	}
46
}
45
}