From: hickert Date: Fri, 13 Aug 2010 15:40:02 +0000 (+0000) Subject: Updated stats plugin X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8e2d2c9d65d43daf7d7c334be21c27369e8d89e5;p=gosa.git Updated stats plugin git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19395 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/generic/statistics/class_statistics.inc b/gosa-core/plugins/generic/statistics/class_statistics.inc index a0a81ccde..c3fa0645b 100644 --- a/gosa-core/plugins/generic/statistics/class_statistics.inc +++ b/gosa-core/plugins/generic/statistics/class_statistics.inc @@ -60,7 +60,14 @@ class statistics extends plugin // First try to retrieve values via RPC if ($this->config->get_cfg_value("core","gosaRpcServer") != ""){ - $res = $this->rpcHandle->getInstanceStats(); + + + $days = 40; + $interval = 1; + $start = time() - ($days*86400); + $stop = time(); + + $res = $this->rpcHandle->getInstanceStats($start,$stop,'day',$interval); if(!$this->rpcHandle->success()){ msg_dialog::display(_("Error"),msgPool::rpcError($this->rpcHandle->get_error()),ERROR_DIALOG); } @@ -75,8 +82,8 @@ class statistics extends plugin // -------- // Get most used categories, but only eight at once. - arsort($res['category_count']); - $mostUsedCategories = array_slice($res['category_count'],0,8); + arsort($res['actionsPerCategory']); + $mostUsedCategories = array_slice($res['actionsPerCategory'],0,8); // Dataset definition $DataSet = new pData; @@ -110,7 +117,7 @@ class statistics extends plugin $dates = array(); $max = 0; - foreach($res['action_per_date'] as $id => $data){ + foreach($res['actionsPerInterval'] as $id => $data){ $category = $data['category']; $date = $data['date']; @@ -121,27 +128,14 @@ class statistics extends plugin $tmp[$category][$date] = $data['count']; $dates[$date] = $date; } - $dMin = min($dates); - $dMax = max($dates); - for($i = $dMin; $i < $dMax; $i += (24*60*60)){ - if(!in_array($i,$dates)) $dates[$i] = $i; - } $dates = array_values($dates); sort($dates); foreach($tmp as $category => $data){ - reset($dates); - foreach($dates as $date){ - if(!isset($tmp[$category][$date])){ - $tmp[$category][$date] = 0; - } - } ksort($tmp[$category]); - $DataSet2->AddPoint($tmp[$category], $category); $DataSet2->SetSerieName(_($category), $category); } - $DataSet2->AddAllSeries(); $tmp = array(); @@ -165,8 +159,8 @@ class statistics extends plugin $Test2->drawTreshold(0,143,55,72,TRUE,TRUE); // Draw the cubic curve graph -# $Test2->drawBarGraph($DataSet2->GetData(),$DataSet2->GetDataDescription(),TRUE); -# $Test2->drawLineGraph($DataSet2->GetData(),$DataSet2->GetDataDescription(),TRUE); + #$Test2->drawBarGraph($DataSet2->GetData(),$DataSet2->GetDataDescription(),TRUE); + #$Test2->drawLineGraph($DataSet2->GetData(),$DataSet2->GetDataDescription(),TRUE); $Test2->drawFilledLineGraph($DataSet2->GetData(),$DataSet2->GetDataDescription(),50,TRUE); // Finish the graph