From e5daabd24dd55cda2b7dc3c76d613e0a4e3d9ca3 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 18 Aug 2010 15:04:47 +0000 Subject: [PATCH] Updated statistic generation git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19408 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../generic/statistics/class_statistics.inc | 19 ++++++++++++--- .../plugins/generic/statistics/statistics.tpl | 24 +++++++++++-------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/gosa-core/plugins/generic/statistics/class_statistics.inc b/gosa-core/plugins/generic/statistics/class_statistics.inc index 15db5bc17..433e33833 100644 --- a/gosa-core/plugins/generic/statistics/class_statistics.inc +++ b/gosa-core/plugins/generic/statistics/class_statistics.inc @@ -70,6 +70,11 @@ class statistics extends plugin $available = $this->getLocalStatisticsFiles(); $alreadyTransmitted = $this->getStatisticsDatesFromServer(); $unsubmitted = array_intersect($available,$alreadyTransmitted); + + // Exclude statistic collection from today, they are still active and cannot be submitted. + $curDate = date('Y-m-d'); + if(isset($unsubmitted)) unset($unsubmitted[$curDate]); + return($unsubmitted); } @@ -202,6 +207,7 @@ class statistics extends plugin $dates = array(); $DataSet2 = new pData; $max = 1; + $seriesNumber = 0; foreach($res['actionsPerInterval'] as $category => $entriesPerDate){ // Collect data per category and store used timestamps @@ -227,6 +233,7 @@ class statistics extends plugin $DataSet2->SetSerieName(_($category), $category); $Test->setLabel($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1",0,"Daily incomes"); $DataSet2->AddSerie($category); + $seriesNumber++; // Detect maximum value, to adjust the Y-Axis $tmpMax = max($dataArray[$category]); @@ -264,7 +271,6 @@ class statistics extends plugin if(count($dates)){ $Test2->drawScale($DataSet2->GetData(),$DataSet2->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2); - $DataSet2->RemoveSerie('date'); } // Draw the cubic curve graph @@ -283,7 +289,9 @@ class statistics extends plugin $DataSet2->AddPoint($errors, 'Errors'); $DataSet2->SetSerieName('Errors', 'Errors'); $DataSet2->AddSerie('Errors'); - + $seriesNumber ++; + + $Test2->setColorPalette($seriesNumber-1,255,0,0); // Draw legend $Test2->drawLegend(650,30,$DataSet2->GetDataDescription(),255,255,255); @@ -296,7 +304,7 @@ class statistics extends plugin // Draw right scale (Errors per day) $Test2->setFixedScale(0.0001,(max($errors) +1) *1.1); $Test2->drawRightScale($DataSet2->GetData(),$DataSet2->GetDataDescription(),SCALE_NORMAL,120,150,150,TRUE,0,2); - $Test2->drawBarGraph($DataSet2->GetData(),$DataSet2->GetDataDescription(),TRUE); + $Test2->drawBarGraph($DataSet2->GetData(),$DataSet2->GetDataDescription()); $file = '/tmp/graph_'.$this->graphID_2; $Test2->Render($file); @@ -307,6 +315,11 @@ class statistics extends plugin $smarty->assign('graphID_1', $this->graphID_1); $smarty->assign('graphID_2', $this->graphID_2); + $smarty->assign('unsbmittedFiles', count($this->unsbmittedFiles)); + $smarty->assign('unsbmittedFilesMsg', + sprintf( + _("You have currently %s unsubmitted statistic collection, do you want to transmit them now?"), + count($this->unsbmittedFiles))); return($smarty->fetch(get_template_path('statistics.tpl', TRUE))); } diff --git a/gosa-core/plugins/generic/statistics/statistics.tpl b/gosa-core/plugins/generic/statistics/statistics.tpl index 47fd7a832..71572b762 100644 --- a/gosa-core/plugins/generic/statistics/statistics.tpl +++ b/gosa-core/plugins/generic/statistics/statistics.tpl @@ -10,14 +10,16 @@ {else} - - + {if $unsbmittedFiles != 0} + {$unsbmittedFilesMsg} + +
+ {/if} -
- +
- - + - - - - + +
{t}Start{/t} + {t}Generate report for{/t}
{t}Stop{/t} + - + +
+
-- 2.30.2