/** * This method returns Statistics object to create the pie graph or the status list * @return Statistics */ public function getStat() { $count = array(); $size = array(); $blks = array(); $db_result = $this->db_request->select(null, ACCT_TABLE, array(STATUS), null); $stat = new Statistics(); foreach ($db_result as $line) { $stname = $this->db_request->statusName($line[STATUS]); $count[$stname] = $line['SUM(' . COUNT . ')']; $size[$stname] = $line['SUM(' . SIZE . ')']; $blks[$stname] = $line['SUM(' . BLOCKS . ')']; } $stat->setSize($size); $stat->setBlocks($blks); $stat->setCount($count); return $stat; }
/** * This method returns Statistics object to create the pie graph or the user list * @return Statistics */ public function getStat() { $count = array(); $size = array(); $blks = array(); $db_result = $this->db_request->select(null, ACCT_TABLE, array(GROUP), null); $stat = new Statistics(); foreach ($db_result as $line) { if ($line[GROUP] && $line['SUM(' . COUNT . ')'] && $line['SUM(' . SIZE . ')']) { $count[$line[GROUP]] = $line['SUM(' . COUNT . ')']; $size[$line[GROUP]] = $line['SUM(' . SIZE . ')']; $blks[$line[GROUP]] = $line['SUM(' . BLOCKS . ')']; } } $stat->setSize($size); $stat->setBlocks($blks); $stat->setCount($count); return $stat; }