| Line 1... |
Line 1... |
| 1 |
<?php
|
1 |
<?php
|
| 2 |
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
|
2 |
// declare(encoding='UTF-8');
|
| 3 |
/**
|
3 |
/**
|
| 4 |
* PHP Version 5
|
4 |
* Service recherche d'images publique a partir de divers critères.
|
| 5 |
*
|
5 |
*
|
| - |
|
6 |
* @internal Mininum PHP version : 5.2
|
| 6 |
* @category PHP
|
7 |
* @category CEL
|
| 7 |
* @package jrest
|
8 |
* @package Services
|
| - |
|
9 |
* @subpackage Images
|
| - |
|
10 |
* @version 0.1
|
| 8 |
* @author Aurélien Peronnet <aurelien@tela-botania.org>
|
11 |
* @author Mathias CHOUET <mathias@tela-botanica.org>
|
| 9 |
* @copyright 2010 Tela-Botanica
|
12 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
| 10 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
13 |
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
|
| 11 |
* @version SVN: <svn_id>
|
14 |
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
|
| 12 |
* @link /doc/jrest/
|
15 |
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
|
| 13 |
*/
|
- |
|
| 14 |
|
- |
|
| 15 |
/**
|
- |
|
| 16 |
* in : utf8
|
- |
|
| 17 |
* out : utf8
|
- |
|
| 18 |
*
|
- |
|
| 19 |
* Service recherche d'images publique a partir de divers critères
|
16 |
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
|
| 20 |
*
|
- |
|
| 21 |
*/
|
17 |
*/
|
| 22 |
class InventoryImageListPublic extends Cel {
|
18 |
class InventoryImageListPublic extends Cel {
|
| 23 |
|
19 |
|
| 24 |
const start_defaut = 0;
|
20 |
const start_defaut = 0;
|
| 25 |
const limit_defaut = 100;
|
21 |
const limit_defaut = 100;
|
| 26 |
|
- |
|
| 27 |
const tri_defaut = 'ci.date_creation';
|
22 |
const tri_defaut = 'ci.date_creation';
|
| 28 |
const dir_defaut = 'DESC';
|
23 |
const dir_defaut = 'DESC';
|
| Line 29... |
Line 24... |
| 29 |
|
24 |
|
| 30 |
function getRessource() {
|
25 |
public function getRessource() {
|
| 31 |
|
26 |
|
| Line 32... |
Line 27... |
| 32 |
}
|
27 |
}
|
| 33 |
|
- |
|
| 34 |
function getElement($uid)
|
28 |
|
| 35 |
{
|
29 |
public function getElement($uid) {
|
| 36 |
// restriction aux observations publiques
|
30 |
// restriction aux observations publiques
|
| 37 |
$criteres = array('transmission' => '1');
|
31 |
$criteres = array('transmission' => '1');
|
| 38 |
|
32 |
|
| 39 |
if($uid[0] != '*' && empty($_GET)) {
|
33 |
if ($uid[0] != '*' && empty($_GET)) {
|
| 40 |
header("content-type: application/json");
|
34 |
header("content-type: application/json");
|
| 41 |
$images_json = json_encode(array());
|
35 |
$images_json = json_encode(array());
|
| 42 |
print $images_json;
|
36 |
print $images_json;
|
| 43 |
exit() ;
|
37 |
exit();
|
| 44 |
}
|
38 |
}
|
| 45 |
|
39 |
|
| 46 |
$this->start = isset($_GET['start']) ? $_GET['start'] : self::start_defaut;
|
40 |
$this->start = isset($_GET['start']) ? $_GET['start'] : self::start_defaut;
|
| 47 |
$this->limit = isset($_GET['limit']) ? $_GET['limit'] : self::limit_defaut;
|
41 |
$this->limit = isset($_GET['limit']) ? $_GET['limit'] : self::limit_defaut;
|
| 48 |
|
42 |
|
| 49 |
$criteres['mots_cles'] = isset($_GET['tag']) ? $_GET['tag'] : null;
|
43 |
$criteres['mots_cles'] = isset($_GET['tag']) ? $_GET['tag'] : null;
|
| 50 |
$criteres['auteur'] = isset($_GET['auteur']) ? $_GET['auteur'] : null;
|
44 |
$criteres['auteur'] = isset($_GET['auteur']) ? $_GET['auteur'] : null;
|
| 51 |
$criteres['zone_geo'] = isset($_GET['commune']) ? $_GET['commune'] : null;
|
45 |
$criteres['zone_geo'] = isset($_GET['commune']) ? $_GET['commune'] : null;
|
| 52 |
$criteres['taxon'] = isset($_GET['taxon']) ? $_GET['taxon'] : null;
|
46 |
$criteres['taxon'] = isset($_GET['taxon']) ? $_GET['taxon'] : null;
|
| 53 |
$criteres['ce_zone_geo'] = isset($_GET['dept']) ? $_GET['dept'] : null;
|
47 |
$criteres['ce_zone_geo'] = isset($_GET['dept']) ? $_GET['dept'] : null;
|
| 54 |
$criteres['famille'] = isset($_GET['famille']) ? $_GET['famille'] : null;
|
48 |
$criteres['famille'] = isset($_GET['famille']) ? $_GET['famille'] : null;
|
| 55 |
$criteres['recherche'] = isset($_GET['recherche']) ? $_GET['recherche'] : null;
|
49 |
$criteres['recherche'] = isset($_GET['recherche']) ? $_GET['recherche'] : null;
|
| 56 |
$criteres['tri'] = isset($_GET['tri']) ? $_GET['tri'] : self::tri_defaut;
|
50 |
$criteres['tri'] = isset($_GET['tri']) ? $_GET['tri'] : self::tri_defaut;
|
| 57 |
$criteres['dir'] = isset($_GET['dir']) ? $_GET['dir'] : self::dir_defaut;
|
51 |
$criteres['dir'] = isset($_GET['dir']) ? $_GET['dir'] : self::dir_defaut;
|
| 58 |
|
- |
|
| 59 |
$chercheur_images = new RechercheImage($this->config);
|
52 |
|
| 60 |
|
53 |
$chercheur_images = new RechercheImage($this->config);
|
| Line 61... |
Line 54... |
| 61 |
$total = $chercheur_images->compterImages(null, $criteres);
|
54 |
$total = $chercheur_images->compterImages(null, $criteres);
|
| 62 |
$images = $chercheur_images->rechercherImages(null, $criteres, $this->start, $this->limit);
|
- |
|
| 63 |
|
55 |
$images = $chercheur_images->rechercherImages(null, $criteres, $this->start, $this->limit);
|
| 64 |
$resultat = array('total' => $total,'images' => $images);
|
56 |
|
| Line 65... |
Line 57... |
| 65 |
|
57 |
$resultat = array('total' => $total,'images' => $images);
|
| 66 |
$images_json = json_encode($resultat) ;
|
58 |
$images_json = json_encode($resultat);
|
| 67 |
$images_json = str_replace('\u0000','',$images_json);
|
59 |
$images_json = str_replace('\u0000','',$images_json);
|
| 68 |
|
60 |
|
| 69 |
header("content-type: application/json") ;
|
- |
|
| 70 |
print $images_json ;
|
- |
|
| 71 |
exit() ;
|
61 |
header("content-type: application/json");
|
| - |
|
62 |
print $images_json;
|
| 72 |
}
|
63 |
exit();
|