Code

Environment Settings added
[gosa.git] / plugins / personal / environment / class_environment.inc
1 <?php
3 class environment extends plugin
4 {
5   /* CLI vars */
6   var $cli_summary          = "Manage server basic objects";
7   var $cli_description      = "Some longer text\nfor help";
8   var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
10   /* attribute list for save action */
11   var $ignore_account       = FALSE;
12   var $plHeadline           = "Environment";
13   var $plDescription        = "This does something";
14   var $in_dialog            = false;    // Indicates that we are currently editing in an seperate dialog
16   /* Attribute definition
17    */
19   /* profile managment */
20   var $useProfile         = false;  // Specifies if we want to use a Server 
21   var $goProfileServer    = "";     // Specifies the selected profile server
22   var $goProfileServers   = array();// Specifies all available and selectable servers
23   var $gotoProfileFlags   = "";     // Flags enabled  ? only used to set ACL and save 
24   var $gotoProfileFlag_C  = "";     // Flag is set to C if we have the profile caching fucntion enabled 
25   
26   var $gotoXResolution    = "";     // The selected resolution eg: 1024x768
27   var $gotoXResolutions   = array();// Contains all available resolutions for this account
28   var $gotoProfileFlag_L  = "";     // Flag is set to L to enable runtime resolution change 
30   /* Login script section*/
31   var $gotoLoginScripts   = array();// Contains all available Login Scripts  
32   var $gotoLoginScript    = "";     // The selected Login Script
34   /* Printer */
35   var $gotoPrinters       = array();// All available Printer
36   var $gotoPrinter        = "";     //  The selected Printer
38   /* Share */
39   var $gotoShares         = array();// Currently Share Option
40   var $gotoShare          = "";     // currently selected Share Option
41   var $gotoShareSelections= array();// Available Shares for this account
42   
43   /* Kiosk profile */
44   var $gotoKioskProfile   = "";     // The selected Kiosk Profile
45   var $gotoKioskProfiles  = array();// All available Kiosk profiles
47   /* Hotplug Devices */
48   var $gotoHotplugDevice  = "";     // Selected hotplug
49   var $gotoHotplugDevices = array();// Already configured hotplug devices 
52   /* general settings */
53   // Sets the attributes which will kept on page reload, which will be saved, ...
54   var $attributes           = array("useProfile","goProfileServer","goProfileServers","gotoProfileFlags","gotoProfileFlag_C",
55                                     "gotoXResolution","gotoXResolutions","gotoProfileFlag_L",
56                                     "gotoLoginScripts","gotoLoginScript",
57                                     "gotoPrinters","gotoPrinter",
58                                     "gotoShares","gotoShare","gotoShareSelections",
59                                     "gotoKioskProfile","gotoKioskProfiles",
60                                     "gotoHotplugDevice","gotoHotplugDevices");
61   var $objectclasses        = array("whatever"); // Specifies the objectClass which contains the attributes edited here 
68   function environment ($config, $dn= NULL)
69   {
70     plugin::plugin ($config, $dn);
71   }
73   function execute()
74   {
75     /* Fill templating stuff */
76     $smarty= get_smarty();
77     $display= "";
79     /* Is accout enabled | are we editing from usermenu or admin menu 
80        All these tab managment is done here
81     */
83     // 1. Account disabled . Editing from usermenu
84     if((!isset($this->parent))&&(!$this->is_account)){
85       /* We are currently editing this tab from usermenu, but htis account is not enabled */
86       $smarty->assign("is_account",$this->is_account);
87       /* Load template */
88       $display .= $smarty->fetch(get_template_path('environment.tpl', TRUE));
89       /* Avoid the "You are currently editing ...." message when you leave this tab */
90       $display .= back_to_main(); 
91       /* Display our message to the user */
92       return $display;
94     // Account is enabled
95     }else{
96       /* Tell smarty that this accoutn is enabled */
97       $smarty->assign("is_account","true");
99       /* Do we need to flip is_account state? */
100       if (isset($_POST['modify_state'])){
101         $this->is_account= !$this->is_account;
102       }
103       if(!isset($this->parent)){
104           // 3. ? Account Enabled . Editing from usermenu        
106       }else{
107         // 3. Account enabled . Editing from adminmenu
108         if ($this->is_account){
109           $display= $this->show_header(_("Remove environment extension"),
110               _("This server has environment extension enabled. You can disable it by clicking below."));
111         } else {
112         // 4. Account disabled . Editing from adminmenu
113           $display= $this->show_header(_("Add environment extension"),
114               _("This server has environment extension disabled. You can enable it by clicking below."));
115           return $display;
116         }
117       }
118     }
119     /* Account is Account : is_accounbt=true.
120      * Else we won't reach this. 
121      */
122    
123     /* Prepare all variables for smarty */
124     foreach($this->attributes as $s_attr){
125       /* Set value*/
126       $smarty->assign($s_attr,$this->$s_attr);
127      
128       /* Set checkbox state*/
129       if(empty($this->$s_attr)){
130         $smarty->assign($s_attr."CHK","");
131       }else{
132         $smarty->assign($s_attr."CHK"," checked ");
133       }
134     
135       /* Prepare ACL settings*/
136       if(chkacl($this->acl,$s_attr)=="") {
137         $smarty->assign($s_attr."ACL","");
138       }else{
139         $smarty->assign($s_attr."ACL"," disabled ");
140       }
141  
142     }
143  
144     /* Als smarty vars are set. Get smarty template and generate output */
145     $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
146     return($display);
147   }
149   function remove_from_parent()
150   {
151     /* This cannot be removed... */
152   }
155   /* Save data to object */
156   function save_object()
157   {
158     plugin::save_object();
159   }
162   /* Check supplied data */
163   function check()
164   {
165     $message= array();
167     return ($message);
168   }
171   /* Save to LDAP */
172   function save()
173   {
174     plugin::save();
176     /* Optionally execute a command after we're done */
177     #$this->handle_post_events($mode);
178   }
182 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
183 ?>