Code

Added dummy graphs for plugin usage
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 4 Aug 2010 14:24:33 +0000 (14:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 4 Aug 2010 14:24:33 +0000 (14:24 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19360 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/generic/dashBoard/dbChannelStatus/class_dbChannelStatus.inc
gosa-core/plugins/generic/dashBoard/dbChannelStatus/contents.tpl

index a990197a8088ef1e816fe8f9d4dbfec0ad4bf355..394b5b187a347db75a912fd0a66f2ba1073bbf18 100644 (file)
@@ -1,7 +1,13 @@
 <?php
 
+
+
+
 class dbChannelStatus extends plugin
 {
+
+    var $receivedStats = array();
+
     function __construct($config)
     {
         parent::__construct($config, NULL);
@@ -42,11 +48,39 @@ class dbChannelStatus extends plugin
                 }
             }
         }
+
+        // Transmit daily statistics to GOsa-Server
+        if(isset($_POST['receiveStatistics'])){
+
+            // First try to retrieve values via RPC
+            if ($this->config->get_cfg_value("core","gosaRpcServer") != ""){
+                $rpc = $this->config->getRpcHandle(
+                        "http://10.3.64.59:4000",
+                        "65717fe6-9e3e-11df-b010-5452005f1250",
+                        "WyukwauWoid2", 
+                        TRUE);
+                $res = $rpc->getInstanceStats();
+                if(!$rpc->success()){
+                    msg_dialog::display(_("Error"),msgPool::rpcError($rpc->get_error()),ERROR_DIALOG);
+                }
+
+                $all = array_sum($res['category_count']);
+                $tmp = array();
+                $tmpRendered = array();
+                foreach($res['category_count'] as $category => $count){
+                    $tmp[$category] = floor(($count / $all) * 10000) / 100;
+                    $tmpRendered[$category] = progressbar($tmp[$category]);
+                }
+                $this->receivedStats = $tmpRendered;
+            }
+        }
+    
     
 
 
         $smarty = get_smarty();
-
+        $smarty->assign("receivedStats",$this->receivedStats);
+    
         $channel = array();
         $channel[] = array(
                         'icon' =>  image('images/true.png'),
index 1b91aba10bcaf2eafadb9354bbbb6fede1e043de..a95cd208b913967b6455f652e4827815f4a8f9c1 100644 (file)
@@ -1,6 +1,21 @@
 <h3>{t}Transmit daliy stats{/t}
 
 <button name='transmitStatistics'>{t}Send{/t}</button>
+<button name='receiveStatistics'>{t}Receive{/t}</button>
+
+{if $receivedStats}
+    <h3>{t}Transmit daliy stats{/t}</h3>
+    <table summary="{t}Generated usage statistics{/t}">
+    {foreach from=$receivedStats key=key item=item}
+        <tr>
+            <td>{$key}</td>
+            <td>{$item}</td>
+        </tr>
+    {/foreach}
+    </table>
+{/if}
+
+<hr>
 
 <h3>{t}Channels{/t}</h3>