Subversion Repositories eFlore/Applications.cel

Rev

Rev 423 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
416 aurelien 1
<?php
2
 
3
// In : utf8
4
// Out : utf8
5
 
6
// Liste des communes par utilisateur
7
 
8
Class InventoryLocationList extends DBAccessor {
9
 
10
 
11
	var $config;
12
 
13
	function InventoryLocationList($config) {
14
 
15
		$this->config=$config;
16
	}
17
 
18
 
19
	function getElement($uid){
20
 
21
 
22
			// Controle detournement utilisateur
23
		    session_start();
24
		 	$this->controleUtilisateur($uid[0]);
25
 
26
	     	$DB=$this->connectDB($this->config,'database_cel');
27
 
28
			$value=array();
29
 
30
	     	// cmc_mot_cle, cmc_id_mot_cle_utilisateur, cmc_id_parent
31
 
32
 
33
	     	/*$query0="SELECT \"racine_entite\"  ,  MD5(\"racine_entite\"), MD5(\"000null\") ".
34
	    			" FROM cel_inventory WHERE 1 " ;
35
 
36
	    	$query1="SELECT DISTINCT id_location   , MD5(CONCAT(id_location,\"racine_entite\")), MD5(\"racine_entite\") ".
37
	    			" FROM cel_inventory WHERE identifiant='".$DB->escapeSimple($uid[0])."' " .
38
	           		" ORDER BY id_location";
39
 
40
	        $query2="SELECT DISTINCT location  , MD5(CONCAT(location,id_location)), MD5(CONCAT(id_location,\"racine_entite\")) ".
41
	    			" FROM cel_inventory WHERE identifiant='".$DB->escapeSimple($uid[0])."' " .
42
	           		" ORDER BY location";
43
 
44
	        $query3="SELECT DISTINCT lieudit,  MD5(CONCAT(lieudit,location)), MD5(CONCAT(location,id_location)) ".
45
	    			" FROM cel_inventory WHERE identifiant='".$DB->escapeSimple($uid[0])."' " .
46
	           		" ORDER BY lieudit";
47
	        */
48
	      /*
49
	        $query4="SELECT DISTINCT station,  MD5(station), MD5(lieudit) ".
50
	    			" FROM cel_inventory WHERE identifiant='".$DB->escapeSimple($uid[0])."' " .
51
	           		" ORDER BY station";
52
	        */
53
 
54
	        //$query="(".$query0.") UNION (". $query1.") UNION (".$query2.") UNION (".$query3 .") UNION (".$query4 .")" ;
55
 
56
	        //$query="(".$query0.") UNION (". $query1.") UNION (".$query2.") UNION (".$query3 .") " ;
57
 
58
	        $query = 'SELECT DISTINCT id_location, location, lieudit, station FROM cel_inventory
59
			WHERE identifiant="'.$DB->escapeSimple($uid[0]).'" ORDER BY id_location ASC, location ASC, lieudit ASC, station ASC' ;
60
 
61
	        //print $query
62
 
63
	        $res =& $DB->query($query);
64
 
65
	        if (DB::isError($res)) {
66
    	        die($res->getMessage());
67
        	}
68
 
69
 
70
            while ($row =& $res->fetchrow(DB_FETCHMODE_ORDERED)) {
71
            	$value[] = $row;
72
    	    }
73
 
74
			$json = new Services_JSON();
75
			$output = $json->encode($value);
76
 
77
			print($output);
78
 
79
			return true;
80
 
81
 
82
	}
83
 
84
 
85
 
86
}
87
 
88
 
89
/* +--Fin du code ---------------------------------------------------------------------------------------+
90
* $Log$
91
* Revision 1.6  2008-01-30 08:57:28  ddelon
92
* fin mise en place mygwt
93
*
94
* Revision 1.5  2007-05-22 12:54:09  ddelon
95
* Securisation acces utilisateur
96
*
97
*
98
*
99
*/
100
 
101
?>