Code

Added dummy functionality to send daily GOsa-usage stats
[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") != ""){
29                 $dump = stats::dumpTables();
30                 $rpc = $this->config->getRpcHandle();
31                 $hash = $rpc->updateInstanceStatus($dump);
32                 if(!$rpc->success()){
33                     msg_dialog::display(_("Error"),msgPool::rpcError($rpc->get_error()),ERROR_DIALOG);
34                     return("");
35                 }
36             }
37         }
38     
41         $smarty = get_smarty();
43         $channel = array();
44         $channel[] = array(
45                         'icon' =>  image('images/true.png'),
46                         'name' =>  'GONICUS support',
47                         'desc' =>  'GONICUS helps you all time!',
48                         'stat' =>  'Online'
49                         );
50         $channel[] = array(
51                         'icon' =>  image('images/true.png'),
52                         'name' =>  'Free',
53                         'desc' =>  'Free channel, basic GOsa plugins!',
54                         'stat' =>  'Online'
55                         );
56         $channel[] = array(
57                         'icon' =>  image('images/small_error.png'),
58                         'name' =>  'Experimental',
59                         'desc' =>  'May be down for maintance!',
60                         'stat' =>  'Offline'
61                         );
64         $data = $lData = array();
65         foreach($channel as $key => $ch){
66             $data[$key] = $ch;
67             $lData[$key] = array('data' => array($ch['icon'],$ch['name'], $ch['desc'], $ch['stat']));
68         }
70         $this->channelList->setListData($data,$lData);
71         $this->channelList->update();
72         $smarty->assign('channelList', $this->channelList->render());
73         return($smarty->fetch(get_template_path('dbChannelStatus/contents.tpl', TRUE)));
74     }
76     function save_object()
77     {
78         parent::save_object();
79     }
81     function save()
82     {
83         parent::save();
84     }
86     function check()
87     {
88         return(parent::check());
89     }
91     function remove_from_parent()
92     {
93         parent::remove_from_parent();
94     }
95 }
97 ?>