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