Code

Updated chart generation
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 24 Aug 2010 14:38:04 +0000 (14:38 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 24 Aug 2010 14:38:04 +0000 (14:38 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19439 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/generic/statistics/graphClasses/class_categoryActionOverTime.inc
gosa-core/plugins/generic/statistics/graphClasses/class_statChart.inc

index 2fcae6a14c8cf88a7be562150027a9f485bab9fb..a82c3fa7772212ee81477c06a55b91b3aa6b0ee0 100644 (file)
@@ -3,17 +3,12 @@
 class categoryActionsOverTime extends statChart
 {
     var $title = 'Plugin usage over time';
-    var $gID = 0;
-
-    var $graphData = array();    
-    var $seriesList = array();
-
-    var $enableCaching = FALSE;
+    var $enableCaching = TRUE;
 
     function __construct(&$config)
     {
         parent::__construct($config);
-        $this->gID = get_class();
+        $this->graphName = get_class();
     }
 
 
@@ -40,6 +35,14 @@ class categoryActionsOverTime extends statChart
             $seriesCnt ++;
         }
 
+        // Keep a list of all selecteable data-series, to allow the user to disable
+        //  or enable series on demand.
+        $this->seriesList = array();
+        foreach($gData['actionsPerInterval'] as $key => $data){
+            $this->seriesList[$key] = $this->getCategoryTranslation($key); 
+        }
+        $this->seriesList['errorsPerInterval'] = _("Error");
+
         // Create a dataSet containing all series 
         $allSeriesDataSet = clone $dataSet;
         if(!in_array('errorsPerInterval', $this->skipSeries)){
@@ -118,14 +121,6 @@ class categoryActionsOverTime extends statChart
         session::set('statistics::graphFile'.$this->graphID,$file);
         $pCache->WriteToCache(get_class(),$allSeriesDataSet->GetData(),$chart);   
 
-        // Keep a list of all selecteable data-series, to allow the user to disable
-        //  or enable series on demand.
-        $this->seriesList = array();
-        foreach($gData['actionsPerInterval'] as $key => $data){
-            $this->seriesList[$key] = $this->getCategoryTranslation($key); 
-        }
-        $this->seriesList['errorsPerInterval'] = _("Error");
-
         return;
     }
 
index 3087bf361dd6968705e7c18d4de8d3bc859e0519..fcbd6f17c1502c60fe05a18dac6fc8a5a982bc1a 100644 (file)
@@ -13,6 +13,10 @@ class statChart{
     
     var $skipSeries = array();
 
+    var $graphName = 0;
+
+    var $seriesList = array();
+
     function __construct(&$config,$gData = array())
     {
         $this->config = $config;
@@ -74,12 +78,12 @@ class statChart{
 
     function getSeriesSelector()
     {
-        $str = "<input type='hidden' name='{$this->gID}_posted' value='1'>";
+        $str = "<input type='hidden' name='{$this->graphName}_posted' value='1'>";
         $list = $this->getSeriesList();
         foreach($list as $key => $item){
             $checked = (in_array($key, $this->skipSeries))? '': 'checked';
             $str .= "<span style='padding-right:20px'>".
-                    "   <input type='checkbox' name='addSeries_{$this->gID}_{$key}' value='1'".
+                    "   <input type='checkbox' name='addSeries_{$this->graphName}_{$key}' value='1'".
                     "       onClick=\"document.mainform.submit();\" ".
                     "       {$checked}>{$item}".
                     "   </span>";
@@ -89,11 +93,12 @@ class statChart{
 
     function save_object()
     {
-        if(!isset($_POST["{$this->gID}_posted"])) return;
+        if(!isset($_POST["{$this->graphName}_posted"])) return;
 
         // Get series to enable or disable
+        $this->skipSeries = array();
         foreach($this->seriesList as $seriesName => $seriesDesc){
-            if(!isset($_POST["addSeries_{$this->gID}_{$seriesName}"])){
+            if(!isset($_POST["addSeries_{$this->graphName}_{$seriesName}"])){
                 $this->skipSeries[] = $seriesName;
             }
         }