Code

Updated stats::dumpTables
[gosa.git] / gosa-core / plugins / generic / dashBoard / dbChannelStatus / class_dbChannelStatus.inc
1 <?php
3 class dbChannelStatus extends plugin
4 {
5     function __construct($config)
6     {
7         parent::__construct($config, NULL);
9         // Construct the channel list.
10         $this->channelList= new sortableListing();
11         $this->channelList->setDeleteable(false);
12         $this->channelList->setEditable(false);
13         $this->channelList->setColspecs(array('30px','120px','*','100px'));
14         $this->channelList->setHeader(array('?',_("Name"),_("Description"),_("Status")));
15         $this->channelList->setWidth("100%");
16         $this->channelList->setDefaultSortColumn(1);
17         $this->channelList->setHeight("200px");
18         $this->channelList->setAcl("rwcdm");
19     }
21     function execute()
22     {
23         // Transmit daily statistics to GOsa-Server
24         if(isset($_POST['transmitStatistics'])){
26             // First try to retrieve values via RPC
27             if ($this->config->get_cfg_value("core","gosaRpcServer") != ""){
28                 $tmp = stats::dumpTables();
29                 $dump = array();
30                 foreach($tmp as $entry){
31                     $dump[] = array_values($entry);
32                 }
34                 $rpc = $this->config->getRpcHandle(
35                         "http://10.3.64.59:4000",
36                         "65717fe6-9e3e-11df-b010-5452005f1250",
37                         "WyukwauWoid2", 
38                         TRUE);
39                 $rpc->updateInstanceStatus($dump);
40                 if(!$rpc->success()){
41                     msg_dialog::display(_("Error"),msgPool::rpcError($rpc->get_error()),ERROR_DIALOG);
42                 }
43             }
44         }
45     
48         $smarty = get_smarty();
50         $channel = array();
51         $channel[] = array(
52                         'icon' =>  image('images/true.png'),
53                         'name' =>  'GONICUS support',
54                         'desc' =>  'GONICUS helps you all time!',
55                         'stat' =>  'Online'
56                         );
57         $channel[] = array(
58                         'icon' =>  image('images/true.png'),
59                         'name' =>  'Free',
60                         'desc' =>  'Free channel, basic GOsa plugins!',
61                         'stat' =>  'Online'
62                         );
63         $channel[] = array(
64                         'icon' =>  image('images/small_error.png'),
65                         'name' =>  'Experimental',
66                         'desc' =>  'May be down for maintance!',
67                         'stat' =>  'Offline'
68                         );
71         $data = $lData = array();
72         foreach($channel as $key => $ch){
73             $data[$key] = $ch;
74             $lData[$key] = array('data' => array($ch['icon'],$ch['name'], $ch['desc'], $ch['stat']));
75         }
77         $this->channelList->setListData($data,$lData);
78         $this->channelList->update();
79         $smarty->assign('channelList', $this->channelList->render());
80         return($smarty->fetch(get_template_path('dbChannelStatus/contents.tpl', TRUE)));
81     }
83     function save_object()
84     {
85         parent::save_object();
86     }
88     function save()
89     {
90         parent::save();
91     }
93     function check()
94     {
95         return(parent::check());
96     }
98     function remove_from_parent()
99     {
100         parent::remove_from_parent();
101     }
104 ?>