Subversion Repositories eFlore/Applications.cel

Rev

Rev 423 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

// In : utf8
// Out : utf8

// Liste des communes par utilisateur

Class InventoryLocationList extends DBAccessor {


        var $config;

        function InventoryLocationList($config) {

                $this->config=$config;
        }


        function getElement($uid){


                        // Controle detournement utilisateur
                    session_start();
                        $this->controleUtilisateur($uid[0]);

                $DB=$this->connectDB($this->config,'database_cel');

                        $value=array();

                // cmc_mot_cle, cmc_id_mot_cle_utilisateur, cmc_id_parent


                /*$query0="SELECT \"racine_entite\"  ,  MD5(\"racine_entite\"), MD5(\"000null\") ".
                                " FROM cel_inventory WHERE 1 " ;

                $query1="SELECT DISTINCT id_location   , MD5(CONCAT(id_location,\"racine_entite\")), MD5(\"racine_entite\") ".
                                " FROM cel_inventory WHERE identifiant='".$DB->escapeSimple($uid[0])."' " .
                                " ORDER BY id_location";

                $query2="SELECT DISTINCT location  , MD5(CONCAT(location,id_location)), MD5(CONCAT(id_location,\"racine_entite\")) ".
                                " FROM cel_inventory WHERE identifiant='".$DB->escapeSimple($uid[0])."' " .
                                " ORDER BY location";

                $query3="SELECT DISTINCT lieudit,  MD5(CONCAT(lieudit,location)), MD5(CONCAT(location,id_location)) ".
                                " FROM cel_inventory WHERE identifiant='".$DB->escapeSimple($uid[0])."' " .
                                " ORDER BY lieudit";
                */
              /*
                $query4="SELECT DISTINCT station,  MD5(station), MD5(lieudit) ".
                                " FROM cel_inventory WHERE identifiant='".$DB->escapeSimple($uid[0])."' " .
                                " ORDER BY station";
                */

                //$query="(".$query0.") UNION (". $query1.") UNION (".$query2.") UNION (".$query3 .") UNION (".$query4 .")" ;

                //$query="(".$query0.") UNION (". $query1.") UNION (".$query2.") UNION (".$query3 .") " ;

                $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' ;

                //print $query

                $res =& $DB->query($query);

                if (DB::isError($res)) {
                die($res->getMessage());
                }


            while ($row =& $res->fetchrow(DB_FETCHMODE_ORDERED)) {
                $value[] = $row;
            }

                        $json = new Services_JSON();
                        $output = $json->encode($value);

                        print($output);

                        return true;


        }



}


/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
* Revision 1.6  2008-01-30 08:57:28  ddelon
* fin mise en place mygwt
*
* Revision 1.5  2007-05-22 12:54:09  ddelon
* Securisation acces utilisateur
*
*
*
*/

?>