Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 2293 → Rev 2294

/branches/v2.4-fourche/jrest/services/InventoryImageListPublic.php
New file
0,0 → 1,74
<?php
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
/**
* 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
*
*/
class InventoryImageListPublic extends Cel {
const start_defaut = 0;
const limit_defaut = 100;
const tri_defaut = 'ci.date_creation';
const dir_defaut = 'DESC';
 
function getRessource() {
}
 
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() ;
}
$this->start = isset($_GET['start']) ? $_GET['start'] : self::start_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;
$criteres['taxon'] = isset($_GET['taxon']) ? $_GET['taxon'] : null;
$criteres['ce_zone_geo'] = isset($_GET['dept']) ? $_GET['dept'] : null;
$criteres['famille'] = isset($_GET['famille']) ? $_GET['famille'] : null;
$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) ;
$images_json = str_replace('\u0000','',$images_json);
 
header("content-type: application/json") ;
print $images_json ;
exit() ;
}
}
?>