Subversion Repositories eFlore/Applications.cel

Rev

Rev 1363 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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