Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1395 → Rev 2458

/trunk/jrest/services/InventoryImageListPublic.php
1,51 → 1,45
<?php
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
// declare(encoding='UTF-8');
/**
* PHP Version 5
*
* @category PHP
* @package jrest
* @author Aurélien Peronnet <aurelien@tela-botania.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/jrest/
*/
/**
* in : utf8
* out : utf8
*
* Service recherche d'images publique a partir de divers critères
*
*/
* Service recherche d'images publique a partir de divers critères.
*
* @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 InventoryImageListPublic extends Cel {
 
const start_defaut = 0;
const limit_defaut = 100;
const tri_defaut = 'ci.date_creation';
const dir_defaut = 'DESC';
 
function getRessource() {
public function getRessource() {
 
}
 
function getElement($uid)
{
// restriction aux observations publiques
$criteres = array('transmission' => '1');
if($uid[0] != '*' && empty($_GET)) {
public function getElement($uid) {
// restriction aux observations publiques
$criteres = array('transmission' => '1');
 
if ($uid[0] != '*' && empty($_GET)) {
header("content-type: application/json");
$images_json = json_encode(array());
print $images_json;
exit() ;
exit();
}
 
$this->start = isset($_GET['start']) ? $_GET['start'] : self::start_defaut;
$this->limit = isset($_GET['limit']) ? $_GET['limit'] : self::limit_defaut;
$this->limit = isset($_GET['limit']) ? $_GET['limit'] : self::limit_defaut;
 
$criteres['mots_cles'] = isset($_GET['tag']) ? $_GET['tag'] : null;
$criteres['auteur'] = isset($_GET['auteur']) ? $_GET['auteur'] : null;
$criteres['zone_geo'] = isset($_GET['commune']) ? $_GET['commune'] : null;
55,20 → 49,17
$criteres['recherche'] = isset($_GET['recherche']) ? $_GET['recherche'] : null;
$criteres['tri'] = isset($_GET['tri']) ? $_GET['tri'] : self::tri_defaut;
$criteres['dir'] = isset($_GET['dir']) ? $_GET['dir'] : self::dir_defaut;
 
$chercheur_images = new RechercheImage($this->config);
$total = $chercheur_images->compterImages(null, $criteres);
$images = $chercheur_images->rechercherImages(null, $criteres, $this->start, $this->limit);
 
$resultat = array('total' => $total,'images' => $images);
$images_json = json_encode($resultat) ;
$resultat = array('total' => $total,'images' => $images);
$images_json = json_encode($resultat);
$images_json = str_replace('\u0000','',$images_json);
 
header("content-type: application/json") ;
print $images_json ;
exit() ;
header("content-type: application/json");
print $images_json;
exit();
}
}
?>
}