Subversion Repositories eFlore/Applications.cel

Rev

Rev 1279 | Rev 1395 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
456 aurelien 1
<?php
932 aurelien 2
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
3
/**
4
* PHP Version 5
5
*
6
* @category  PHP
7
* @package   jrest
8
* @author    Aurélien Peronnet <aurelien@tela-botania.org>
9
* @copyright 2010 Tela-Botanica
10
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
* @version   SVN: <svn_id>
12
* @link      /doc/jrest/
13
*/
14
 
15
/**
16
* in : utf8
17
* out : utf8
18
*
19
* Service recherche d'images publique a partir de divers critères
20
*
21
*/
874 aurelien 22
class InventoryImageListPublic extends Cel {
932 aurelien 23
 
24
	const start_defaut = 0;
25
	const limit_defaut = 100;
456 aurelien 26
 
27
	function getRessource() {
28
 
29
	}
30
 
31
	function getElement($uid)
1363 aurelien 32
	{
33
		// restriction aux observations publiques
932 aurelien 34
		$criteres = array('transmission' => '1');
456 aurelien 35
 
932 aurelien 36
		if($uid[0] != '*' && empty($_GET)) {
37
			header("content-type: application/json");
38
			$images_json = json_encode(array());
39
			print $images_json;
40
			exit() ;
456 aurelien 41
		}
42
 
932 aurelien 43
		$this->start = isset($_GET['start']) ? $_GET['start'] : self::start_defaut;
44
		$this->limit = isset($_GET['limit']) ? $_GET['limit'] : self::limit_defaut;
605 aurelien 45
 
932 aurelien 46
		$criteres['mots_cles'] = isset($_GET['tag']) ? $_GET['tag'] : null;
1279 aurelien 47
		$criteres['auteur'] = isset($_GET['auteur']) ? $_GET['auteur'] : null;
932 aurelien 48
		$criteres['zone_geo'] = isset($_GET['commune']) ? $_GET['commune'] : null;
49
		$criteres['taxon'] = isset($_GET['taxon']) ? $_GET['taxon'] : null;
50
		$criteres['ce_zone_geo'] = isset($_GET['dept']) ? $_GET['dept'] : null;
1363 aurelien 51
		$criteres['famille'] = isset($_GET['famille']) ? $_GET['famille'] : null;
1279 aurelien 52
		$criteres['recherche'] = isset($_GET['recherche']) ? $_GET['recherche'] : null;
605 aurelien 53
 
932 aurelien 54
		$chercheur_images = new RechercheImage($this->config);
874 aurelien 55
 
1279 aurelien 56
		$total = $chercheur_images->compterImages(null, $criteres);
57
		$images = $chercheur_images->rechercherImages(null, $criteres, $this->start, $this->limit);
456 aurelien 58
 
761 aurelien 59
    	$resultat = array('total' => $total,'images' => $images);
605 aurelien 60
 
61
		$images_json = json_encode($resultat) ;
761 aurelien 62
		$images_json = str_replace('\u0000','',$images_json);
456 aurelien 63
 
932 aurelien 64
		header("content-type: application/json") ;
605 aurelien 65
		print $images_json ;
66
		exit() ;
67
	}
456 aurelien 68
}
69
?>