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 ="";
30 function goGlpiServer($config,$dn)
31 {
32 plugin::plugin($config,$dn);
33 $this->DisplayName = _("Inventory database");
34 }
37 function execute()
38 {
39 $smarty = get_smarty();
40 foreach($this->attributes as $attr){
41 $smarty->assign($attr,$this->$attr);
42 }
43 $tmp = $this->plInfo();
44 foreach($tmp['plProvidedAcls'] as $name => $translation ){
45 $smarty->assign($name."ACL",$this->getacl($name));
46 }
47 return($smarty->fetch(get_template_path("goGlpiServer.tpl",TRUE,dirname(__FILE__))));
48 }
51 function getListEntry()
52 {
53 $fields = goService::getListEntry();
54 $fields['Message'] = _("Inventory database service");
55 $fields['AllowEdit'] = true;
56 return($fields);
57 }
59 function check()
60 {
61 $message = plugin::check();
62 if(empty($this->goGlpiAdmin)){
63 $message[]= _("The attribute user is empty or contains invalid characters.");
64 }
65 if(empty($this->goGlpiDatabase)){
66 $message[]= _("The attribute database is empty or contains invalid characters.");
67 }
68 return($message);
69 }
72 function save_object()
73 {
74 if(isset($_POST['goGlpiServer_posted'])){
75 plugin::save_object();
76 }
77 }
79 /* Return plugin informations for acl handling */
80 function plInfo()
81 {
82 return (array(
83 "plShortName" => _("Inventory database"),
84 "plDescription" => _("Inventory database")." ("._("Services").")" ,
85 "plSelfModify" => FALSE,
86 "plDepends" => array(),
87 "plPriority" => 93,
88 "plSection" => array("administration"),
89 "plCategory" => array("server"),
91 "plProvidedAcls"=> array(
92 "start" => _("Start"),
93 "stop" => _("Stop"),
94 "restart" => _("Restart"),
96 "goGlpiAdmin" => _("Admin"),
97 "goGlpiDatabase" => _("Database"),
98 "goGlpiPassword" => _("Password"))
99 ));
100 }
103 }
104 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
105 ?>