Code

Added timezone selection
[gosa.git] / gosa-plugins / goto / admin / systems / goto / Device / class_InstallRecipe.inc
1 <?php
3 class InstallRecipe extends plugin
4 {
5     public $member = array();
6     public $ksTemplate = "";
7     public $ksKeyboardlayout = "";
8     public $ksSystemLocale = "";
9     public $ksTimezone = "";
10     public $ksTimeUTC = "";
11     public $ksNTPServer = "";
12     public $ksMirror = "";
13     public $ksMirrorTorrent = "";
14     public $ksRootEnabled = "";
15     public $ksRootPasswordHash = "";
16     public $ksKernelPackage = "";
17     public $ksPartitionTable = "";
19     public $objectclasses = array('installRecipe');
20     public $attributes = array("member","ksTemplate","ksKeyboardlayout","ksSystemLocale",
21             "ksTimezone","ksTimeUTC","ksNTPServer","ksMirror","ksMirrorTorrent",
22             "ksRootEnabled","ksRootPasswordHash","ksKernelPackage","ksPartitionTable");
24     function __construct(&$config, $dn)
25     {
26         plugin::plugin($config, $dn);
28         // Prepare list of timezones
29         $tmp = timezone::_get_tz_zones();
30         $list = array();
31         foreach($tmp['TIMEZONES'] as $name => $offset){
32             if($offset >= 0){
33                 $list[$name] = $name." ( + ".sprintf("%0.2f",$offset/(60*60))." "._("hours").")";
34             }else{
35                 $offset = $offset * -1;
36                 $list[$name] = $name." ( - ".sprintf("%0.2f",($offset/(60*60)))." "._("hours").")";
37             }
38         }   
39         $this->timezones = $list;
40     }
42     function execute()
43     {
44         plugin::execute();    
45         $smarty = get_smarty();
46         $smarty->assign('timezones', $this->timezones);
47         foreach($this->attributes as $attr){
48             $smarty->assign($attr, $this->$attr);
49         }
50         return($smarty->fetch(get_template_path('goto/Device/InstallRecipe.tpl', TRUE)));
51     }
54     function save()
55     {
56         $this->member = array();
57         plugin::save();
58         #$this->cleanup();
60         print_a($this->attrs);
62         $ldap=$this->config->get_ldap_link();
63         $ldap->cd($this->config->current['BASE']);
64         $ldap->cd($this->dn);
65         $ldap->modify($this->attrs);
66         new log("modify","Device/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
67         if (!$ldap->success()){
68             msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
69         }else{
70             $this->handle_post_events("modify");
71         }
72     }
74     static function plInfo()
75     {
76         return (array(
77                     "plShortName"   => _("Device"),
78                     "plDescription" => _("Registered device"),
79                     "plSelfModify"  => FALSE,
80                     "plDepends"     => array(),
81                     "plPriority"    => 1,
82                     "plSection"     => array("administration"),
83                     "plCategory"    => array("Device"),
84                     "plProvidedAcls" => array(
85                         "member" => _("Member"),
86                         "ksTemplate" => _("Template"),
87                         "ksKeyboardlayout" => _("Keyboard layout"),
88                         "ksSystemLocale" => _("System locale"),
89                         "ksTimezone" => _("Timezone"),
90                         "ksTimeUTC" => _("Time"),
91                         "ksNTPServer" => _("NTP-Server"),
92                         "ksMirror" => _("Kickstart mirror"),
93                         "ksMirrorTorrent" => _("Kickstart torrent mirror"),
94                         "ksRootEnabled" => _("Root login enabled"),
95                         "ksRootPasswordHash" => _("Root password hash"),
96                         "ksKernelPackage" => _("Kernal package"),
97                         "ksPartitionTable" => _("Partition table")
98                         )
99                         )
100                         );
101     }
104 ?>