Code

Added gray out to navigation icons in divlist
[gosa.git] / plugins / admin / systems / class_goNtpServer.inc
1 <?php
3 require_once("class_goService.inc");
5 class goNtpServer extends goService{
7   var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports NTP service.";
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("goNtpServer");
13   var $attributes       = array("goTimeSource");
14   var $StatusFlag       = "goNtpServerStatus";
16   /* This class can't be assigned twice so it conflicts with itsself */
17   var $conflicts        = array("goNtpServer");
19   var $DisplayName      = "";
20   var $dn               = NULL;
21   var $goTimeSource     = array();
22   var $goNtpServerStatus= "";
23   var $acl;
24   var $cn               = "";
26   function goNtpServer($config,$dn)
27   {
28     plugin::plugin($config,$dn);
29     $this->DisplayName = _("Time service (NTP)");
31     /* Load arrays */
32     $tmp = array();
33     if (isset($this->attrs['goTimeSource'])){
34       for ($i= 0; $i<$this->attrs['goTimeSource']['count']; $i++){
35         $tmp[$this->attrs['goTimeSource'][$i]]= $this->attrs['goTimeSource'][$i];
36       }
37     }
38     $this->goTimeSource= $tmp;
39   }
42   function execute()
43   { 
44     $smarty = get_smarty(); 
46     /* Here we add a new entry  */
47     if(isset($_POST['NewNTPAdd']) && $_POST['NewNTPExport'] != "" && $this->acl_is_writeable("goTimeSource")) {
48       $this->goTimeSource[$_POST['NewNTPExport']]= $_POST['NewNTPExport'];
49       asort($this->goTimeSource);
50     }
52     /* Deleting an Entry, is a bit more complicated than adding one*/
53     if((isset($_POST['DelNTPEnt'])) && (isset($_POST['goTimeSource'])) && $this->acl_is_writeable("goTimeSource")) {
54       foreach ($_POST['goTimeSource'] as $entry){
55         if (isset($this->goTimeSource[$entry])){
56           unset($this->goTimeSource[$entry]);
57         }
58       }
59     }
61     $smarty->assign("goNtpServerACL", $this->getacl("goNtpServer")) ;
62     $smarty->assign("goTimeSource" , $this->goTimeSource); 
63     return($smarty->fetch(get_template_path("goNtpServer.tpl",TRUE,dirname(__FILE__))));
64   }
67   function getListEntry()
68   {
69     $fields               = goService::getListEntry();
70     $fields['Message']    = _("Time service (NTP)");
71     $fields['AllowEdit']  = true;
72     return($fields);
73   }
76   function save()
77   {
78     plugin::save();
79     $this->attrs['goTimeSource'] =array();
80     foreach($this->goTimeSource as $entry){
81       $this->attrs['goTimeSource'][] = $entry;
82     }
83     /* Check if this is a new entry ... add/modify */
84     $ldap = $this->config->get_ldap_link();
85     $ldap->cat($this->dn,array("objectClass"));
86     if($ldap->count()){
87       $ldap->cd($this->dn);
88       $ldap->modify($this->attrs);
89     }else{
90       $ldap->cd($this->dn);
91       $ldap->add($this->attrs);
92     }
93     show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/goNtpServer with dn '%s' failed."),$this->dn));
94     if($this->initially_was_account){
95       $this->handle_post_events("modify");
96     }else{
97       $this->handle_post_events("add");
98     }
99   }
102   /* Return plugin informations for acl handling */
103   function plInfo()
104   {
105     return (array(
106           "plShortName"   => _("Time service"),
107           "plDescription" => _("Time service - NTP")." ("._("Services").")",
108           "plSelfModify"  => FALSE,
109           "plDepends"     => array(),
110           "plPriority"    => 91,
111           "plSection"     => array("administration"),
112           "plCategory"    => array("server"),
114           "plProvidedAcls"=> array(
115             "goTimeSource"        =>_("Ntp source"))
116           ));
117   }
120   function check(){ return array();}
122   function save_object(){;}
124 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
125 ?>