Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 932 Rev 1279
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
 
26
 
27
	function getRessource() {
27
	function getRessource() {
28
	
28
	
29
	}
29
	}
30
 
30
 
31
	function getElement($uid)
31
	function getElement($uid)
32
	{				
32
	{				
33
		$criteres = array('transmission' => '1');		
33
		$criteres = array('transmission' => '1');		
34
		
34
		
35
		if($uid[0] != '*' && empty($_GET)) {		
35
		if($uid[0] != '*' && empty($_GET)) {		
36
			header("content-type: application/json");
36
			header("content-type: application/json");
37
			$images_json = json_encode(array());
37
			$images_json = json_encode(array());
38
			print $images_json;
38
			print $images_json;
39
			exit() ;
39
			exit() ;
40
		}
40
		}
41
		
41
		
42
		$this->start = isset($_GET['start']) ? $_GET['start'] : self::start_defaut;
42
		$this->start = isset($_GET['start']) ? $_GET['start'] : self::start_defaut;
43
		$this->limit = isset($_GET['limit']) ? $_GET['limit'] : self::limit_defaut;		
43
		$this->limit = isset($_GET['limit']) ? $_GET['limit'] : self::limit_defaut;		
44
		
44
		
45
		$criteres['mots_cles'] = isset($_GET['tag']) ? $_GET['tag'] : null;
45
		$criteres['mots_cles'] = isset($_GET['tag']) ? $_GET['tag'] : null;
46
		$criteres['ce_utilisateur'] = isset($_GET['auteur']) ? $_GET['auteur'] : null;
46
		$criteres['auteur'] = isset($_GET['auteur']) ? $_GET['auteur'] : null;
47
		$criteres['zone_geo'] = isset($_GET['commune']) ? $_GET['commune'] : null;
47
		$criteres['zone_geo'] = isset($_GET['commune']) ? $_GET['commune'] : null;
48
		$criteres['taxon'] = isset($_GET['taxon']) ? $_GET['taxon'] : null;
48
		$criteres['taxon'] = isset($_GET['taxon']) ? $_GET['taxon'] : null;
49
		$criteres['ce_zone_geo'] = isset($_GET['dept']) ? $_GET['dept'] : null;
49
		$criteres['ce_zone_geo'] = isset($_GET['dept']) ? $_GET['dept'] : null;
-
 
50
		$criteres['recherche'] = isset($_GET['recherche']) ? $_GET['recherche'] : null;
50
		
51
		
51
		$chercheur_images = new RechercheImage($this->config);
52
		$chercheur_images = new RechercheImage($this->config);
52
		
53
		
53
		$total = $chercheur_images->compterImages($criteres['ce_utilisateur'], $criteres);
54
		$total = $chercheur_images->compterImages(null, $criteres);
54
		$images = $chercheur_images->rechercherImages($criteres['ce_utilisateur'], $criteres, $this->start, $this->limit);
55
		$images = $chercheur_images->rechercherImages(null, $criteres, $this->start, $this->limit);
55
 
56
 
56
    	$resultat = array('total' => $total,'images' => $images);
57
    	$resultat = array('total' => $total,'images' => $images);
57
    	
58
    	
58
		$images_json = json_encode($resultat) ;
59
		$images_json = json_encode($resultat) ;
59
		$images_json = str_replace('\u0000','',$images_json);
60
		$images_json = str_replace('\u0000','',$images_json);
60
 
61
 
61
		header("content-type: application/json") ;
62
		header("content-type: application/json") ;
62
		print $images_json ;
63
		print $images_json ;
63
		exit() ;
64
		exit() ;
64
	}
65
	}
65
}
66
}
66
?>
67
?>