Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 856 → Rev 857

/trunk/jrest/services/InventoryLocationList.php
1,61 → 1,51
<?php
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
 
// In : utf8
// Out : utf8
/**
* @author David Delon <aurelien@tela-botanica.org>
* @author Aurélien Peronnet <david@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $Id$
* @copyright © 2010, David Delon, Aurélien Peronnet
*/
 
// Liste des communes par utilisateur
 
Class InventoryLocationList extends DBAccessor {
 
 
var $config;
 
function InventoryLocationList($config) {
 
$this->config=$config;
}
 
 
/**
* InventoryLocationList.php
*
* in : utf8
* out : utf8
* Cas d'utilisation :
* Service listage des zones géographiques d'un utilisateur
*/
class InventoryLocationList extends Cel {
function getElement($uid){
// Controle detournement utilisateur
session_start();
$this->controleUtilisateur($uid[0]);
 
$retour = array();
 
// Controle detournement utilisateur
session_start();
$this->controleUtilisateur($uid[0]);
$requete_zones_geo = 'SELECT DISTINCT ce_zone_geo, zone_geo, lieudit, station FROM cel_obs '.
'WHERE ce_utilisateur = '.$this->proteger($uid[0]).' '.
'ORDER BY ce_zone_geo ASC, zone_geo ASC, lieudit ASC, station ASC';
 
$DB=$this->connectDB($this->config,'database_cel');
$resultat_zones_geo = $this->requeter($requete_zones_geo);
 
$value=array();
if (is_array($resultat_zones_geo)) {
$retour = $resultat_zones_geo;
}
 
$query = 'SELECT DISTINCT id_location, location, lieudit, station FROM cel_inventory
WHERE identifiant="'.$DB->escapeSimple($uid[0]).'" ORDER BY id_location ASC, location ASC, lieudit ASC, station ASC' ;
$output = json_encode($retour);
 
//print $query
header("content-type: application/json");
print($output);
return true;
 
$res =& $DB->query($query);
 
if (DB::isError($res)) {
die($res->getMessage());
}
 
 
while ($row =& $res->fetchrow(DB_FETCHMODE_ORDERED)) {
$value[] = $row;
}
 
$output = json_encode($value);
 
print($output);
 
return true;
 
}
 
 
 
}
 
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
* Revision 1.6 2008-01-30 08:57:28 ddelon
67,5 → 57,4
*
*
*/
 
?>
?>