Rev 660 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
// in : utf8
// out : utf8
// Liste les date de releves par utilisateur
Class ImageDateList extends Cel {
function getElement($uid){
// uid[0] : utilisateur obligatoire
// uid[1] : si absent : valeur 'all' (annee)
// uid[2] : si absent : valeur 'all' (mois)
// uid[3] : si absent : valeur 'all' (jour)
// Controle detournement utilisateur
session_start();
$this->controleUtilisateur($uid[0]);
$select = "ci_meta_date" ;
if (!isset($uid[1]) || $uid[1]=="" || $uid[1]=="all" ) {
$uid[1]="all";
if ($select=="") $select="year(ci_meta_date) ";
}
else {
$query_year=" AND year(ci_meta_date)='".$this->bdd->quote($uid[1])."' ";
}
if (!isset($uid[2]) || $uid[2]=="" || $uid[2]=="all" ) {
$uid[2]="all";
if ($select=="") $select="month(ci_meta_date) ";
}
else {
$query_month=" AND month(ci_meta_date)='".$this->bdd->quote($uid[2])."' ";
}
if (!isset($uid[3]) || $uid[3]=="" || $uid[3]=="all" ) {
$uid[3]="all";
if ($select=="") $select="day(ci_meta_date) ";
}
else {
$query_day=" AND day(ci_meta_date)='".$this->bdd->quote($uid[3])."' ";
}
$value=array();
$query="SELECT DISTINCT ".
$select. " AS id" .
" FROM cel_images WHERE ci_ce_utilisateur=".$this->bdd->quote($uid[0])." " .
$query_year.
$query_month.
$query_day.
" ORDER BY ".$select;
$res = $this->executerRequete($query);
foreach($res as $date_obs) {
if($date_obs['id'] == null || $date_obs['id'] == 'null') {
$date_obs['id']="0000-00-00";
}
$value[]=array($date_obs['id']);
}
$output = json_encode($value);
print($output);
return true;
}
}
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
* Revision 1.4 2008-01-30 08:57:28 ddelon
* fin mise en place mygwt
*
* Revision 1.3 2007-05-22 12:54:09 ddelon
* Securisation acces utilisateur
*
*
*
*/
?>