Code

07c07d427cccf039b5cd8c3b6040e1660fbd5c73
[gosa.git] / plugins / admin / systems / services / glpi / class_goGlpiServer.inc
1 <?php
3 class goGlpiServer extends goService {
4         
5   var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
6   var $cli_description  = "Some longer text\nfor help";
7   var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
9   /* This plugin only writes its objectClass */
10   var $objectclasses    = array("goGlpiServer");
11   var $attributes       = array("goGlpiAdmin","goGlpiDatabase","goGlpiPassword");
12   var $StatusFlag       = "goGlpiServerStatus";
13  
14   /* This class can't be assigned twice so it conflicts with itsself */
15   var $conflicts        = array("goGlpiServer");
17   var $DisplayName      = "";
18   var $dn               = NULL;
19   var $cn               = "";
20   var $acl;
22   var $goGlpiServerStatus ="";
23   var $goGlpiAdmin        ="";
24   var $goGlpiDatabase     ="";
25   var $goGlpiPassword     ="";
26   var $view_logged  =FALSE;
27  
28  
29   function goGlpiServer(&$config,$dn)
30   {
31     goService::goService($config,$dn);
32     $this->DisplayName = _("Inventory database");
33   }
36   function execute()
37   { 
38     if($this->is_account && !$this->view_logged){
39       $this->view_logged = TRUE;
40       new log("view","server/".get_class($this),$this->dn);
41     }
43     $smarty = get_smarty(); 
44     foreach($this->attributes as $attr){
45       $smarty->assign($attr,$this->$attr);
46     }
47     $tmp = $this->plInfo();
48     foreach($tmp['plProvidedAcls'] as $name => $translation ){
49       $smarty->assign($name."ACL",$this->getacl($name));
50     }
51     return($smarty->fetch(get_template_path("goGlpiServer.tpl",TRUE,dirname(__FILE__))));
52   }
55   function getListEntry()
56   {
57     $fields               = goService::getListEntry();
58     $fields['Message']    = _("Inventory database service");
59     $fields['AllowEdit']  = true;
60     return($fields);
61   }
63   function check()
64   { 
65     $message = plugin::check();
66     if(empty($this->goGlpiAdmin)){
67       $message[]= _("The attribute user is empty or contains invalid characters.");
68     }
69     if(empty($this->goGlpiDatabase)){
70       $message[]= _("The attribute database is empty or contains invalid characters.");
71     }
72     return($message);
73   }
74   
76   function save_object()
77   {
78     if(isset($_POST['goGlpiServer_posted'])){
79       plugin::save_object();
80     }
81   } 
83   /* Return plugin informations for acl handling */
84   static function plInfo()
85   {
86     return (array(
87           "plShortName"   => _("Inventory database"),
88           "plDescription" => _("Inventory database")." ("._("Services").")" ,
89           "plSelfModify"  => FALSE,
90           "plDepends"     => array(),
91           "plPriority"    => 93,
92           "plSection"     => array("administration"),
93           "plCategory"    => array("server"),
95           "plProvidedAcls"=> array(
96             "start"         => _("Start"),
97             "stop"          => _("Stop"),
98             "restart"       => _("Restart"),
100             "goGlpiAdmin"    => _("Admin"), 
101             "goGlpiDatabase" => _("Database"),
102             "goGlpiPassword" => _("Password"))
103           ));
104   }
106  
108 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
109 ?>