Code

Updated usage of registration classes
[gosa.git] / gosa-core / plugins / generic / dashBoard / class_dashBoard.inc
index 6dce8e7faf17eaa25240531c6278669b75e1b742..b0e8e7f4630d887a5537fd451b8e7bae0c948f5e 100644 (file)
@@ -2,18 +2,83 @@
 
 class dashBoard extends plugin
 {
-   var $plHeadline = 'dashBoard.png';
-   var $plDescription = 'dashBoard.png';
-   var $plShortIcon = 'dashBoard.png';
-   var $plIcon = 'dashBoard.png';
+    var $plHeadline = 'Dash board';
+    var $plDescription = 'Dash board';
+    var $plShortIcon = 'dashBoard.png';
+    var $plIcon = 'plugin.png';
 
+    private $dbPluginStatus = NULL;
+    private $dbChannelStatus = NULL;
+    private $dbNotifications = NULL;
+    private $dbInformation = NULL;
+
+    function __construct($config)
+    {
+        plugin::plugin($config, NULL);
+
+        // Instantiate child classes
+        $this->dbPluginStatus = new dbPluginStatus($config);
+        $this->dbChannelStatus = new dbChannelStatus($config);
+        $this->dbNotifications = new dbNotifications($config);
+        $this->dbInformation = new dbInformation($config);
+
+
+        // Detect registration status 
+        $this->RegistrationDialog = new RegistrationDialog($config);
+    }
 
     function execute()
     {
-        $smarty = get_smarty();
+        if(!$this->config->registration->isRegistered()){
+            return($this->RegistrationDialog->execute());
+        }
 
+        $smarty = get_smarty();
+        $smarty->assign('dbPluginStatus', $this->dbPluginStatus->execute());
+        $smarty->assign('dbChannelStatus', $this->dbChannelStatus->execute());
+        $smarty->assign('dbNotifications', $this->dbNotifications->execute());
+        $smarty->assign('dbInformation', $this->dbInformation->execute());
         return($smarty->fetch(get_template_path('dashBoard.tpl', TRUE)));
+    }
+
+    function check()
+    {
+        $messages = plugin::check();
+        $messages = array_merge($this->dbPluginStatus->check());    
+        $messages = array_merge($this->dbChannelStatus->check());    
+        $messages = array_merge($this->dbNotifications->check());    
+        $messages = array_merge($this->dbInformation->check());    
+        return($messages);
+    }
+
+    function save_object()
+    {
+        plugin::save_object();
         
+        if(!$this->config->registration->isRegistered()) $this->RegistrationDialog->save_object();
+
+        $this->dbPluginStatus->save_object();
+        $this->dbChannelStatus->save_object();
+        $this->dbNotifications->save_object();
+        $this->dbInformation->save_object();
+    }
+
+    function save()
+    {
+        plugin::save();
+        $this->dbPluginStatus->save();
+        $this->dbChannelStatus->save();
+        $this->dbNotifications->save();
+        $this->dbInformation->save();
+    }
+
+    function remove_from_parent()
+    {
+        plugin::remove_from_parent();
+        $this->dbPluginStatus->remove_from_parent();
+        $this->dbChannelStatus->remove_from_parent();
+        $this->dbNotifications->remove_from_parent();
+        $this->dbInformation->remove_from_parent();
     }
 }