Code

Updated statistics handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 12 Aug 2010 15:55:59 +0000 (15:55 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 12 Aug 2010 15:55:59 +0000 (15:55 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19387 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/generic/statistics/class_statistics.inc

index 8b5269da17e47b6b91ddda4dae2435d7be4f1791..f6806013287b7e6df94151d96f4b180c4a8f996f 100644 (file)
@@ -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');