Subversion Repositories eFlore/Applications.cel

Rev

Rev 2458 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
// declare(encoding='UTF-8');
/**
 * Service recherche du nombre d'images à partir de divers critères.
 *
 * Cas d'utilisation :
 * 2: Le service recherche le nombre d'images correspondant aux critères demandés
 * 3: Le service renvoie le nombre calculé
 *
 * @internal   Mininum PHP version : 5.2
 * @category   CEL
 * @package    Services
 * @subpackage Images
 * @version    0.1
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
 */
class InventoryImageCount extends Cel {

        /**
         * Renvoie le nombre d'images correspondant aux criteres
         * uid[0] : utilisateur obligatoire
         */
        public function getElement($uid) {
                // Controle detournement utilisateur
                $this->controleUtilisateur($uid[0]);

                $chercheurImages = new RechercheImage($this->config);
                $retour = $chercheurImages->compterImages($uid[0], $_GET);

                $retour_encode = json_encode($retour);
                $retour_encode = $this->nettoyerCaracteresNuls($retour_encode);
                header('content-type: application/json');
                print $retour_encode ;
                exit() ;
        }

        private function nettoyerCaracteresNuls($chaine) {
                return str_replace('\u0000','',$chaine);
        }
}