Code

Switched log call
[gosa.git] / plugins / admin / systems / class_gosaLogServer.inc
1 <?php
2 require_once("class_goService.inc");
4 class gosaLogServer extends goService{
5         
6   /* This plugin only writes its objectClass */
7   var $objectclasses    = array("gosaLogServer");
8   var $attributes       = array("cn","goLogDB","goLogDBUser","goLogDBPassword");
9   var $StatusFlag       = "";
11   /* This class can't be assigned twice so it conflicts with itsself */
12   var $conflicts        = array("gosaLogServer");
14   var $DisplayName      = "";
15   var $dn               = NULL;
16   var $acl;
17   var $cn                 = "";
18   var $goLogDBServerStatus= "";
19   var $goLogDBUser        = "";
20   var $goLogDBPassword    = "";  
21   var $goLogDB            = "";  
22   var $view_logged  =FALSE;
25   function gosaLogServer($config,$dn)
26   {
27     goService::goService($config,$dn);
28     $this->DisplayName = _("GOsa logging service");
29   }
32   function execute()
33   { 
34     $smarty = get_smarty(); 
36     if($this->is_account && !$this->view_logged){
37       $this->view_logged = TRUE;
38       new log("view","server/".get_class($this),$this->dn);
39     }
41     $tmp = $this->plInfo();
42     foreach($tmp['plProvidedAcls'] as $name => $translation){
43       $smarty->assign($name."ACL",$this->getacl($name));
44     }
46     foreach($this->attributes as $attr){
47       $smarty->assign($attr,$this->$attr);
48     }
49     return($smarty->fetch(get_template_path("gosaLogServer.tpl",TRUE,dirname(__FILE__))));
50   }
53   function getListEntry()
54   {
55     $fields = goService::getListEntry();
56     $fields['Message']      = _("GOsa logging service");
57     $fields['AllowEdit']    = true;
58     $fields['AllowStart']   = FALSE;
59     $fields['AllowStop']    = FALSE;
60     $fields['AllowRestart'] = FALSE;
61     return($fields);
62   }
65   function check()
66   { 
67     $message = plugin::check();
68     if (empty($this->goLogDBUser)){
69       $message[]= sprintf_("The attribute user is empty or contains invalid characters.");
70     }
71     if (empty($this->goLogDBPassword)){
72       $message[]= sprintf_("The attribute password is empty or contains invalid characters.");
73     }
74     if (empty($this->goLogDB)){
75       $message[]= sprintf_("The attribute database is empty or contains invalid characters.");
76     }
77     return($message);
78   }
81   function save_object()
82   {
83     if(isset($_POST['gosaLogServerPosted'])){
84       plugin::save_object();
85     }
86   } 
88   /* Return plugin informations for acl handling */
89   function plInfo()
90   {
91     return (array(
92           "plShortName"   => _("GOsa logging service"),
93           "plDescription" => _("GOsa logging service")." ("._("Services").")",
94           "plSelfModify"  => FALSE,
95           "plDepends"     => array(),
96           "plPriority"    => 98,
97           "plSection"     => array("administration"),
98           "plCategory"    => array("server"),
100           "plProvidedAcls"=> array(
101             "goLogDB"         => _("Database"),
102             "goLogDBUser"     => _("User"),
103             "goLogDBPassword" => _("Password")) 
104           ));
105   }
107 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
108 ?>