From: hickert Date: Thu, 12 Aug 2010 15:55:59 +0000 (+0000) Subject: Updated statistics handling X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=62e68332c33811653e1cacf5259a9e0284baf7dc;p=gosa.git Updated statistics handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19387 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 8b5269da1..f68060132 100644 --- a/gosa-core/plugins/generic/statistics/class_statistics.inc +++ b/gosa-core/plugins/generic/statistics/class_statistics.inc @@ -109,33 +109,45 @@ class statistics extends plugin $DataSet2 = new pData; $dates = array(); $max = 0; + foreach($res['action_per_date'] as $id => $data){ $category = $data['category']; - $date = date('d .m', $data['date']); + $date = $data['date']; if(!isset($mostUsedCategories[$category])) continue; if($data['count'] > $max) $max = $data['count']; $tmp[$category][$date] = $data['count']; - $dates[] = $date; + $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_unique($dates); + $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; + $tmp[$category][$date] = 0; } } - + ksort($tmp[$category]); + $DataSet2->AddPoint($tmp[$category], $category); $DataSet2->SetSerieName(_($category), $category); } + $DataSet2->AddAllSeries(); - $DataSet2->AddPoint($dates, 'date'); + $tmp = array(); + foreach($dates as $date) $tmp[] = date('d.m', $date); + + $DataSet2->AddPoint($tmp, 'date'); $DataSet2->SetAbsciseLabelSerie('date'); $DataSet2->RemoveSerie('date');