Rev 1395 | Rev 3857 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
// declare(encoding='UTF-8');
/**
* 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';
public function getRessource() {
}
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();
}
$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();
}
}