Subversion Repositories eFlore/Applications.cel

Rev

Rev 423 | Rev 1014 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 423 Rev 857
Line 1... Line 1...
1
<?php
1
<?php
-
 
2
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
Line 2... Line -...
2
 
-
 
3
// In : utf8
-
 
4
// Out : utf8
3
 
5
 
4
/**
6
// Liste des communes par utilisateur
-
 
7
 
5
 * @author David Delon <aurelien@tela-botanica.org>
8
Class InventoryLocationList extends DBAccessor {
-
 
9
 
-
 
-
 
6
 * @author Aurélien Peronnet <david@tela-botanica.org>
-
 
7
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
10
 
8
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
11
	var $config;
-
 
12
 
9
 * @version $Id$
13
	function InventoryLocationList($config) {
-
 
14
 
-
 
15
		$this->config=$config;
10
 * @copyright © 2010, David Delon, Aurélien Peronnet
16
	}
-
 
Line -... Line 11...
-
 
11
*/
-
 
12
 
-
 
13
/**
-
 
14
 * InventoryLocationList.php  
-
 
15
 * 
-
 
16
 * in : utf8
-
 
17
 * out : utf8
-
 
18
 * Cas d'utilisation :
-
 
19
 * Service listage des zones géographiques d'un utilisateur
-
 
20
 */ 
17
 
21
class InventoryLocationList extends Cel {
-
 
22
	
-
 
23
	function getElement($uid){
-
 
24
		
-
 
25
		// Controle detournement utilisateur
Line -... Line 26...
-
 
26
	    session_start();
Line 18... Line 27...
18
 
27
	 	$this->controleUtilisateur($uid[0]);
19
	function getElement($uid){
-
 
20
 
28
 
21
 
-
 
22
			// Controle detournement utilisateur
29
		$retour = array();
23
		    session_start();
-
 
24
		 	$this->controleUtilisateur($uid[0]);
-
 
Line 25... Line 30...
25
 
30
 
26
	     	$DB=$this->connectDB($this->config,'database_cel');
-
 
Line -... Line 31...
-
 
31
        $requete_zones_geo = 'SELECT DISTINCT ce_zone_geo, zone_geo, lieudit, station FROM cel_obs '.
27
 
32
							 'WHERE ce_utilisateur = '.$this->proteger($uid[0]).' '.
-
 
33
							 'ORDER BY ce_zone_geo ASC, zone_geo ASC, lieudit ASC, station ASC';
Line 28... Line 34...
28
			$value=array();
34
 
Line 29... Line -...
29
 
-
 
30
	        $query = 'SELECT DISTINCT id_location, location, lieudit, station FROM cel_inventory
-
 
31
			WHERE identifiant="'.$DB->escapeSimple($uid[0]).'" ORDER BY id_location ASC, location ASC, lieudit ASC, station ASC' ;
-
 
32
 
-
 
33
	        //print $query
-
 
34
 
-
 
35
	        $res =& $DB->query($query);
-
 
36
 
-
 
37
	        if (DB::isError($res)) {
-
 
38
    	        die($res->getMessage());
35
        $resultat_zones_geo = $this->requeter($requete_zones_geo);
39
        	}
-
 
40
 
36
 
41
 
-
 
42
            while ($row =& $res->fetchrow(DB_FETCHMODE_ORDERED)) {
37
        if (is_array($resultat_zones_geo)) {
Line 43... Line 38...
43
            	$value[] = $row;
38
	        $retour = $resultat_zones_geo;
44
    	    }
-
 
45
 
-
 
46
			$output = json_encode($value);
-
 
47
 
39
    	}
48
			print($output);
-
 
49
 
-
 
50
			return true;
40
 
51
 
41
		$output = json_encode($retour);
52
	}
42
 
53
 
43
		header("content-type: application/json");
54
 
44
		print($output);
Line 65... Line 55...
65
* Securisation acces utilisateur
55
* Securisation acces utilisateur
66
*
56
*
67
*
57
*
68
*
58
*
69
*/
59
*/
70
 
-
 
71
?>
60
?>
72
61