X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fgofon%2Ffonreports%2Fclass_fonreport.inc;h=5b810f60b6be0d3d04e86f5e74f96cf9d27bfba9;hb=fc062d415b59d3560ae0b071bb6f0b4581b02392;hp=893112c574b0cfd326d3ed06d16a7606552ae428;hpb=56575791ac3c2eee7b8c804e7e4861e6902a89f7;p=gosa.git diff --git a/plugins/gofon/fonreports/class_fonreport.inc b/plugins/gofon/fonreports/class_fonreport.inc index 893112c57..5b810f60b 100644 --- a/plugins/gofon/fonreports/class_fonreport.inc +++ b/plugins/gofon/fonreports/class_fonreport.inc @@ -56,9 +56,17 @@ class fonreport extends plugin /* Call parent execute */ plugin::execute(); - /* Get template engine */ + /* GVet template engine */ $smarty= get_smarty(); + foreach($this->fields as $field){ + if(chkacl($this->acl,$field)==""){ + $smarty->assign($field."ACL",""); + }else{ + $smarty->assign($field."ACL"," disabled "); + } + } + $months= array(); $months[1]= _("January"); $months[2]= _("February"); $months[3]= _("March"); $months[4]= _("April"); $months[5]= _("May"); $months[6]= _("June"); $months[7]= _("July"); $months[8]= _("August"); @@ -171,9 +179,17 @@ class fonreport extends plugin $this->userfilter= preg_replace("/OR $/", "", $this->userfilter); } - /* Perform SQL query */ -##### FIXME ACL, FILTER ###### -# if ($this->userfilter){ + $fields_str = "calldate, "; + + foreach($this->fields as $field){ + if($field == "calldate") continue; + if(chkacl($this->acl,$field)==""){ + $fields_str .= $field.", "; + } + } + + $fields_str = preg_replace("/, $/","",$fields_str); + if ($this->sort_direction == "down"){ $desc= "DESC"; } else { @@ -181,8 +197,7 @@ class fonreport extends plugin } $start= date ("YmdHis", mktime(0,0,0,$this->month,1,$this->year)); $end= date ("YmdHis", mktime(23,59,59,$this->month+1,0,$this->year)); - $query = "SELECT calldate, channel, src, clid, lastapp, lastdata, dst, ". - "disposition, duration FROM cdr ". + $query = "SELECT ".$fields_str." FROM cdr ". "WHERE calldate <= $end AND ". "calldate >= $start ORDER BY ".$this->fields[$this->sort]." $desc;"; @@ -199,20 +214,23 @@ class fonreport extends plugin } $report_list= array(); while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { + $append_str = ""; $hour= substr($line["calldate"], 11, 2); $minute=substr($line["calldate"], 14, 2); $format= _("Y-M-D"); $date= preg_replace("/Y/", substr($line["calldate"], 0, 4), $format); $date= preg_replace("/M/", substr($line["calldate"], 5, 2), $date); $date= preg_replace("/D/", substr($line["calldate"], 8, 2), $date); - - $report_list[]= "$date $hour:$minute". - "".$line["src"]."". - "".$line["dst"]."". - "".$line["channel"]."". - "".$line["lastapp"]."". - "".$line["disposition"]."". - "".$this->gen_duration($line["duration"]).""; + $append_str .= "$date $hour:$minute"; + foreach(array("src","dst","channel","lastapp","disposition") as $atr){ + if(isset($line[$atr])){ + $append_str .= "".$line[$atr].""; + } + } + if(isset($line['duration'])){ + $append_str .= "".$this->gen_duration($line["duration"]).""; + } + $report_list[] = $append_str; } $this->report_list= $report_list;