Code

c3bfcd8362c44d921cc11363e749f9e58741d4aa
[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 $dialog               = false;    // Indicates that we are currently editing in an seperate dialog
16   /* Attribute definition
17    */
19   /* profile management */
20   var $useProfile         = false;  // Specifies if we want to use a Server 
21   var $gotoProfileServer  = "";     // Specifies the selected profile server
22   var $gotoProfileServers = 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 
29   var $gotoProfileQuota   = "";     // User Quota Settings
31   /* Logon script section*/
32   var $gotoLogonScripts   = array();// Contains all available Logon Scripts  
33   var $gotoLogonScript    = "";     // The selected Logon Script
35   /* Printer */
36   var $gotoPrinters       = array();// All available Printer
37   var $gotoPrinter        = "";     //  The selected Printer
39   /* Share */
40   var $gotoShares         = array();// Currently Share Option
41   var $gotoShare          = "";     // currently selected Share Option
42   var $gotoShareSelections= array();// Available Shares for this account in Listbox format
43   var $gotoAvailableShares= array();// Available Shares for this account
44   
45   /* Kiosk profile */
46   var $gotoKioskProfile   = "";     // The selected Kiosk Profile
47   var $gotoKioskProfiles  = array();// All available Kiosk profiles
49   /* Hotplug Devices */
50   var $gotoHotplugDevice  = "";     // Selected hotplug
51   var $gotoHotplugDevices = array();// Already configured hotplug devices 
54   /* general settings */
55   // Sets the attributes which will kept on page reload, which will be saved, ...
56   var $attributes         = array("uid","useProfile","gotoProfileServer","gotoProfileServers","gotoProfileFlags","gotoProfileFlag_C",
57                                     "gotoXResolution","gotoXResolutions","gotoProfileFlag_L","gotoProfileQuota",
58                                     "gotoLogonScripts","gotoLogonScript",
59                                     "gotoPrinters","gotoPrinter",
60                                     "gotoShares","gotoShare","gotoShareSelections",
61                                     "gotoKioskProfile","gotoKioskProfiles",
62                                     "gotoHotplugDevice","gotoHotplugDevices");
63   var $objectclasses      = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here 
65   function environment ($config, $dn= NULL)
66   {
67     plugin::plugin ($config, $dn);
69     /* Get all Printer assignments */
70     $ldap = $this->config->get_ldap_link();
71     $ldap->cd($this->config->current['BASE']);
72     $ldap->search("(&(objectClass=gotoPrinter)(gotoUserPrinter=".$this->uid."))",array("*"));
73     while($printer = $ldap->fetch()){
74       $this->gotoPrinters[$printer['cn'][0]]=$printer;
75       $this->gotoPrinters[$printer['cn'][0]]['mode']="user";
76     }
77     $ldap->search("(&(objectClass=gotoPrinter)(gotoAdminPrinter=".$this->uid."))",array("*"));
78     while($printer = $ldap->fetch()){
79       $this->gotoPrinters[$printer['cn'][0]]=$printer;
80       $this->gotoPrinters[$printer['cn'][0]]['mode']="admin";
81     }
82     
83     /* prepare hotplugs */
84     if((isset($this->attrs['gotoHotplugDevice']))&&(is_array($this->attrs['gotoHotplugDevice']))){
85       unset($this->attrs['gotoHotplugDevice']['count']);
86       foreach($this->attrs['gotoHotplugDevice'] as $device){
87         $tmp = $tmp2 = array();
88         $tmp = split("\|",$device);
89         $tmp2['name']        = $tmp[0]; 
90         $tmp2['description'] = $tmp[1]; 
91         $tmp2['id']          = $tmp[2]; 
92         $this->gotoHotplugDevices[$tmp[0]]=$tmp2;
93       }
94     }
95     
96     /* Prepare Shares */
97     if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
98       unset($this->attrs['gotoShare']['count']);
99       foreach($this->attrs['gotoShare'] as $share){
100         $tmp = $tmp2 = array();
101         $tmp = split("\|",$share);
102         $tmp2['name']      =$tmp[0];
103         $tmp2['mountPoint']=$tmp[1];
104         $this->gotoShares[$tmp[0]]=$tmp2;
105       }
106     }
108     for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){
109       $chr = $this->gotoProfileFlags[$i];
110       $name = "gotoProfileFlag_".$chr;
111       $this->$name=$chr;
112     }
114     if((!empty($this->gotoProfileServer))||($this->gotoProfileFlag_C=="C")){
115       $this->useProfile = true;
116     }else{
117       $this->useProfile = false;
118     }
120   }
122   function execute()
123   {
124     /* Fill templating stuff */
125     $smarty= get_smarty();
126     $display= "";
127     /* Is accout enabled | are we editing from usermenu or admin menu 
128        All these tab management is done here
129     */
131     // 1. Account disabled . Editing from usermenu
132     if((!isset($this->parent))&&(!$this->is_account)){
133       /* We are currently editing this tab from usermenu, but htis account is not enabled */
134       $smarty->assign("is_account",$this->is_account);
135       /* Load template */
136       $display .= $smarty->fetch(get_template_path('environment.tpl', TRUE));
137       /* Avoid the "You are currently editing ...." message when you leave this tab */
138       $display .= back_to_main(); 
139       /* Display our message to the user */
140       return $display;
142     // Account is enabled
143     }else{
144       /* Tell smarty that this accoutn is enabled */
145       $smarty->assign("is_account","true");
147       /* Do we need to flip is_account state? */
148       if (isset($_POST['modify_state'])){
149         $this->is_account= !$this->is_account;
150       }
151       if(!isset($this->parent)){
152           // 3. ? Account Enabled . Editing from usermenu        
154       }else{
155         // 3. Account enabled . Editing from adminmenu
156         if ($this->is_account){
157           $display= $this->show_header(_("Remove environment extension"),
158               _("This server has environment extension enabled. You can disable it by clicking below."));
159         } else {
160         // 4. Account disabled . Editing from adminmenu
161           $display= $this->show_header(_("Add environment extension"),
162               _("This server has environment extension disabled. You can enable it by clicking below."));
163           return $display;
164         }
165       }
166     }
167     /* Account is Account : is_accounbt=true.
168      * Else we won't reach this. 
169      */
170    
171     /* Prepare all variables for smarty */
172     foreach($this->attributes as $s_attr){
173       /* Set value*/
174       $smarty->assign($s_attr,$this->$s_attr);
175      
176       /* Set checkbox state*/
177       if(empty($this->$s_attr)){
178         $smarty->assign($s_attr."CHK","");
179       }else{
180         $smarty->assign($s_attr."CHK"," checked ");
181       }
182     
183       /* Prepare ACL settings*/
184       if(chkacl($this->acl,$s_attr)=="") {
185         $smarty->assign($s_attr."ACL","");
186       }else{
187         $smarty->assign($s_attr."ACL"," disabled ");
188       }
189  
190     }
191   
192     /* HANDLE Profile Settings here 
193      * Assign available Quota and resolution settings
194      * Get all available profile server
195      * Get cache checkbox
196      * Assign this all to Smarty 
197      */
199     if(empty($this->useProfile)){
200       $smarty->assign("gotoProfileACL","disabled"); 
201       $smarty->assign("useProfileCHK",""); 
202     }else{
203       $smarty->assign("gotoProfileACL",""); 
204       $smarty->assign("useProfileCHK"," checked "); 
205     }
207     $this->gotoXResolutions = array("640x480","800x600","1024x768","1280x768","1280x1024");
208     $this->gotoProfileServers = array("none","none1");
210     $smarty->assign("gotoXResolutions",$this->gotoXResolutions);
211     $smarty->assign("gotoProfileServers",$this->gotoProfileServers);
213     /* Handle kiosk profiles 
214      * Read available from filesystem
215      * Open management if post is transmitted
216      */
217     $tmp = new kioskManagementDialog($this->config,$this->dn);
218     $list = $tmp->getKioskProfiles();
220     $smarty->assign("gotoKioskProfiles",$list);
221     $smarty->assign("gotoKioskProfileKeys",array_flip($list));
223     /* Open Management Dialog */
224     if(isset($_POST['KioskManagementDialog'])){
225       $this->dialog = new kioskManagementDialog($this->config,$this->dn); 
226       $this->is_dialog = true;
227     }
229     /* Save */
230     if(isset($_POST['KioskClose'])){
231       unset($this->dialog);
232       $this->dialog=NULL;
233       $this->is_dialog = false;
234     }
236     /* Logonscript Management
237      * Get available LogonScripts (possibly grey out (or mark) these script that are defined for the group) 
238      * Perform add Delete edit Posts 
239      */
241     $this->gotoLogonScripts = array("asdf"=>"one","aaaa"=>"two","121"=>"3");
242   
243     $smarty->assign("gotoLogonScripts",$this->gotoLogonScripts);
244     $smarty->assign("gotoLogonScriptKeys",array_flip($this->gotoLogonScripts));
245    
246     /* Check Edit Del New Posts for a selected LogonScript */ 
247     if(isset($_POST['gotoLogonScriptNew'])||isset($_POST['gotoLogonScriptEdit'])||isset($_POST['gotoLogonScriptDel'])){
249       /* New Logon Script: Open an edit dialog, we don't need a $_POST['gotoLogonScript'] here.
250        * In this case we create a new Logon Script.
251        */
252       if(isset($_POST['gotoLogonScriptNew'])){
253         $this->is_dialog = true;
254         $this->dialog = new logonManagementDialog($this->config,$this->dn);
255       }
257       /* If we receive a Delete request and there is a Script selected in the selectbox, delete this one.
258        * We only can delete if there is an entry selected.
259        */
260       if((isset($_POST['gotoLogonScriptDel']))&&(isset($_POST['gotoLogonScript']))){
261         $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
262         print "Deleting ".$is_entry;
263       }
264       
265       /* In this case we want to edit an existing entry, we open a new Dialog to allow editing.
266        * There must be an entry selected to perform edit request.
267        */
268       if((isset($_POST['gotoLogonScriptEdit']))&&(isset($_POST['gotoLogonScript']))){
269         $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
270         $this->is_dialog = true;
271         $this->dialog = new logonManagementDialog($this->config,$this->dn,$is_entry);
272       }
273     }
274     
275     /* In this section server shares will be defined 
276      * A user can select one of the given shares and a mount point
277      *  and attach this combination to his setup.
278      */
279     
280     $this->gotoShareSelections    = $this->getShareList(true);
281     $this->gotoAvailableShares    = $this->getShareList(false);  
283     $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
284     $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
286     /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry 
287      * This entry will be, a combination of mountPoint and sharedefinitions 
288      */
289     if(isset($_POST['gotoShareAdd'])){
290       /* We assign a share to this user, if we don't know where to mount the share */
291       if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))){
292         print_red("You must specify a valid mount point.");
293       }else{
294         $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
295         $s_mount = $_POST['gotoShareMountPoint'];
297         /* Preparing the new assignment */ 
298         $this->gotoShares[$a_share['name']]=$a_share;
299         $this->gotoShares[$a_share['name']]['mountPoint']=$s_mount;
300       }
301     }  
303     /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
304      * If there is no defined share selected, we will abort the deletion without any message 
305      */
306     if((isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare']))){
307       unset($this->gotoShares[$_POST['gotoShare']]);
308     }
310     $smarty->assign("gotoShares",$this->printOutAssignedShares());
311     $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
313     /* Hotplug devices will be handled here 
314      * There are 3 possible methods for this feature
315      * Create a new Hotplug, A Dialog will open where you can specify some hotplug information
316      * Delete will erase an entry, the entry must be selcted in the ListBox first
317      * Editing an entry will open a dialog where the informations about the selcted entry can be changed
318      */
320     /* If there is a new entry wanted, open a new entry by initilising the dialog */
321     if(isset($_POST['gotoHotplugDeviceNew'])){
322       $this->dialog = new hotplugDialog($this->config,$this->dn);
323       $this->is_dialog = true;
324     }
326     /* We have to delete the selected hotplug from the list*/
327     if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice']))){
328       unset($this->gotoHotplugDevices[$_POST['gotoHotplugDevice']]);
329     }
331     /* There are already defined hotplugs from other users we could use */
332     if(isset($_POST['gotoHotplugDeviceUse'])){
333       $this->dialog = new hotplugDialog($this->config,$this->dn,true);
334       $this->is_dialog = true;
335     }
337     /* Dialog Aborted */
338     if(isset($_POST['HotPlugCancel'])){
339       unset($this->dialog);
340       $this->dialog= NULL;
341       $this->is_dialog = false;
342     }
343  
344     /* Dialod saved */
345     if(isset($_POST['HotPlugSave'])){
346       $this->dialog->save_object();
347       if(count($this->dialog->check())!=0){
348         foreach($this->dialog->check() as $msg){
349           print_red($msg);
350         }
351       }else{
352         $this->dialog->save_object();
353         $a_tmp = $this->dialog->save();
354         if(is_array($a_tmp)){
355           $this->gotoHotplugDevices[$a_tmp['name']]= $a_tmp; 
356         }
357         unset($this->dialog);
358         $this->dialog= NULL;
359         $this->is_dialog = false;
360       }
361     }
362     
363     $smarty->assign("gotoHotplugDevices",$this->printOutHotPlugDevices());
364     $smarty->assign("gotoHotplugDeviceKeys",array_flip($this->printOutHotPlugDevices()));
365   
366     /* Printer Assignment will managed below 
367      * A printer can be assigned in two different ways and two different types
368      * There are 2 types of users assigned to a printer : user and admin
369      * They only differ in the member attribute they will be assigned to. user: gotoUserPrinter admin: gotoadminPrinter
370      * The different types of assigning a user are : 1 assigning a user to a printer 2. assigning a group to a printer
371      */ 
372     
373     /* First handle Add Post. Open a dialog that allows us to select a printer or two */ 
374     if(isset($_POST['gotoPrinterAdd'])){
375       $this->is_dialog=true;
376       $this->dialog = new selectPrinterDialog($this->config,$this->dn);
377     }
379     if(isset($_POST['PrinterCancel'])){
380         $this->is_dialog=false;
381         unset($this->dialog);
382         $this->dialog=NULL;
383     }
385     if(isset($_POST['PrinterSave'])){
386       if(count($this->dialog->check())!=0){
387         $tmp = $this->dialog->check();
388         foreach($tmp as $msg){
389           print_red($msg);
390         } 
391       }else{
392         $this->dialog->save_object();
393         $tmp = $this->dialog->save();
394         $tmp2= $this->dialog->getPrinter(true);
395         $this->gotoPrinters[$tmp]=$tmp2[$tmp];
396         $this->gotoPrinters[$tmp]['mode']="user";
397         $this->is_dialog=false;
398         unset($this->dialog);
399         $this->dialog   =NULL;
400       }
401     }
402   
403     if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinter']))&&(!empty($_POST['gotoPrinter']))){
404       $printer = $_POST['gotoPrinter'];
405       unset($this->gotoPrinters[$printer]);
406     }
408     if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinter']))&&(!empty($_POST['gotoPrinter']))){
409       $printer = $_POST['gotoPrinter'];
410       if($this->gotoPrinters[$printer]['mode']=="user"){
411         $this->gotoPrinters[$printer]['mode']="admin";
412       }else{
413         $this->gotoPrinters[$printer]['mode']="user";
414       }
415     }
417     $smarty->assign("gotoPrinters",$this->printOutPrinterDevices());
418     $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
419  
420     /* General behavior */
421     if((isset($this->dialog))&&($this->dialog!=NULL)&&(!empty($this->dialog))){
422       $this->dialog->save_object();
423       return ($this->dialog->execute());
424     }
425  
426     /* Als smarty vars are set. Get smarty template and generate output */
427     $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
428     
429     return($display);
430   }
432   function remove_from_parent()
433   {
434     /* only if it was an account*/
435     if (!$this->initially_was_account){
436       return;
437     }
439     /* include global link_info */
440     $ldap= $this->config->get_ldap_link();
442     /* Remove and write to LDAP */
443     plugin::remove_from_parent();
445     /* Don't save our template variables */
446     $skip = array("useProfile","uid","gotoProfileServers","gotoProfileFlag_C","gotoXResolutions","gotoProfileFlag_L",
447                   "gotoLogonScripts","gotoPrinters","gotoShares","gotoShareSelections","gotoKioskProfiles","gotoHotplugDevices",
448                   "gotoPrinter");
449     /* Skip all these attributes */
450     foreach($skip as $del){
451       unset($this->attrs[$del]);
452     }
454     @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
456     $ldap->cd($this->dn);
457     $ldap->modify($this->attrs);
459     show_ldap_error($ldap->get_error());
461     /* Optionally execute a command after we're done */
462     $this->handle_post_events("remove");
463   }
466   /* Save data to object */
467   function save_object()
468   {
469     /* Get all Posted vars 
470      * Setup checkboxes 
471      */
472     
473     if(isset($_POST['iamposted'])){
474       plugin::save_object();
475       foreach($this->attributes as $s_attr){
476         if(in_array($s_attr,array("gotoShares","gotoHotplugDevices","gotoPrinters"))) continue;
477         if(isset($_POST[$s_attr])){
478           $this->$s_attr = $_POST[$s_attr];
479         }else{
480           $this->$s_attr = false;
481         }
482       }
483     }
484   }
487   /* Check supplied data */
488   function check()
489   {
490     $message= array();
491     return ($message);
492   }
495   /* Save to LDAP */
496   function save()
497   {
498     plugin::save();
499     $ldap= $this->config->get_ldap_link();
501     $realyUsedAttrs= array();
502     
503     /* Save already used objectClasses */
504     $ocs        = $this->attrs['objectClass'];
505     unset($ocs['count']);
506     $this->attrs = array();
507     $this->attrs['objectClass']= $ocs;
508     foreach($this->objectclasses as $objc){
509       if(!in_array($objc,$this->attrs['objectClass'])){
510         $this->attrs['objectClass'][]=$objc;
511       }
512     }
515     /* Save usersettings to Printer */
516     foreach($this->gotoPrinters as $printer) {
517       $ldap->cd($printer['dn']);
518       $ldap->cat($printer['dn']);
519       $attrs= $ldap->fetch();
520       $attrs_used = array(); 
521       foreach($attrs as $key=>$val){
522         if((!is_numeric($key))&&($key!="count")){
523           if(is_array($val)&&isset($val['count'])){
524             unset($val['count']);
525           }
526           $attrs_used[$key]=$val;
527         }
528       }
529       $attrs= $attrs_used;
531       /* Filter entries */
532  
533       if($printer['mode'] == "user"){
534         $attribute  = "gotoUserPrinter";
535         $attribute2 = "gotoAdminPrinter";
536       }else{
537         $attribute  = "gotoAdminPrinter";
538         $attribute2 = "gotoUserPrinter";
539       }
540       
541       /* If this user is already assigned to $attribute2 
542        * delete user from $attribute2, to be albe to attach him to $attribute
543        * A user can't be admin and normal user for one printer
544        */
545       if(!isset($printer[$attribute2])){
546         $printer[$attribute2]=array();
547       }else{
548         if(in_array($this->uid,$printer[$attribute2])){ 
549           $tmp = array_flip($attrs[$attribute2]);
550           unset($tmp[$this->uid]);
551           $attrs[$attribute2]=$tmp;
552         }
553         /* If Last entry removed, clear attribute*/
554         if(empty($attrs[$attribute2])){
555           $attrs[$attribute2]=array();
556         }
557       }
559       /* Attach user to the $attribute, if he is'nt already attached
560        */
561       if(!isset($attrs[$attribute])){
562         $attrs[$attribute]=array($this->uid);
563       }else{
564         unset($attrs[$attribute]['count']);
565         if(!in_array($this->uid,$attrs[$attribute])){
566           $attrs[$attribute][]=$this->uid;
567         }
568       }
569       $ldap->cd($attrs['dn']);
570       unset($attrs['dn']);
571       $ldap->modify($attrs);
572       if($ldap->get_error()!="Success"){
573         print_red($ldap->get_error());
574       }
575     }
576     
577     /* Prepare HotPlug devices */
578     $this->attrs['gotoHotplugDevice'] = array();
579     foreach($this->gotoHotplugDevices as $name => $device){
580       $this->attrs['gotoHotplugDevice'][] = $device['name']."|".$device['description']."|".$device['id'];
581     }
583     /* Prepare Shares */
584     $this->attrs['gotoShare']=array();
585     foreach($this->gotoShares as $name => $share){
586       $this->attrs['gotoShare'][] = $share['name']."|".$share['mountPoint'];
587     }
589     if(!empty($this->gotoKioskProfile)){
590       $this->attrs['gotoKioskProfile']= $this->gotoKioskProfile;
591     }else{
592       $this->attrs['gotoKioskProfile']= array();
593     }
595     $saveThis = array("gotoKioskProfile","gotoProfileQuota","gotoXResolution","gotoProfileServer");
596   
597     foreach($saveThis as $tosave){
598       if(!empty($this->$tosave)){
599         $this->attrs[$tosave]=$this->$tosave;
600       }else{
601         $this->attrs[$tosave]=array();
602       }
603     }
604  
605     /* Prepare Flags */
606     $this->attrs['gotoProfileFlags'] = array($this->gotoProfileFlag_C.$this->gotoProfileFlag_L);
607     if(empty($this->attrs['gotoProfileFlags'][0])){
608       $this->attrs['gotoProfileFlags']=array();
609       }
611     if($this->useProfile == false){
612       $this->attrs['gotoProfileFlags'] = preg_replace("/C/i","",$this->attrs['gotoProfileFlags']);
613       $this->attrs['gotoProfileServer']= array(); 
614     }
616     $ldap->cat ($this->dn);
617     if ($ldap->fetch()){
618       $mode= "modify";
619     } else {
620       $mode= "add";
621       $ldap->cd($this->config->current['BASE']);
622       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
623     }
625     $ldap->cd($this->dn);
626     $ldap->$mode($this->attrs);
627     if($ldap->get_error()!="Success"){
628       print_red($ldap->get_error());
629     }
630     $this->handle_post_events($mode);
631   }
636 /* This function returns all available Shares defined in this ldap 
637  * There are two ways to call this function, if listboxEntry is true
638  *  only name and path are attached to the array, in it is false, the whole 
639  *  entry will be parsed an atached to the result.
640  */
641   function getShareList($listboxEntry = false)
642   {
643     $ldap= $this->config->get_ldap_link();
644     $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry"));
645     $return= array();
646     while($entry = $ldap->fetch($a_res)){
647       $shareAttrs = split("\|",$entry['goExportEntry'][0]);
648       if($listboxEntry) { 
649         $return[$shareAttrs[0]] = $shareAttrs[0]." - ".$shareAttrs[3];
650       }else{
651         $return[$shareAttrs[0]]['name']         = $shareAttrs[0]; 
652         $return[$shareAttrs[0]]['description']  = $shareAttrs[1]; 
653         $return[$shareAttrs[0]]['type']         = $shareAttrs[2]; 
654         $return[$shareAttrs[0]]['charset']      = $shareAttrs[3]; 
655         $return[$shareAttrs[0]]['path']         = $shareAttrs[4]; 
656         $return[$shareAttrs[0]]['option']       = $shareAttrs[5]; 
657       }
658     }
659     return($return);
660   }
663 /* Generate ListBox frindly output for the defined shares 
664  * Possibly Add or remove an attribute here, 
665  */
666   function printOutAssignedShares()
667   {
668     $a_return = array();
669     if(is_array($this->gotoShares)){
670       foreach($this->gotoShares as $share){
671         $a_return[$share['name']]= $share['name']." ".$share['mountPoint'];
672       }
673     }
674     return($a_return);
675   }
677 /* Generate ListBox frindly output for the definedhotplugs 
678  * Possibly Add or remove an attribute here,
679  */
680 function printOutHotPlugDevices()
681   {
682     $a_return= array();
683     if(is_array($this->gotoHotplugDevices)){
684       foreach($this->gotoHotplugDevices as $key=>$device){
685         $a_return[$key] = $device['name']." - ".$device['id'];
686       }
687     }
688     return($a_return);
689   }
691 /* Generates ListBox frienly output of used printer devices 
692  * Append ' - admin' if printer is used in admin mode
693  */
694 function printOutPrinterDevices()
695   {
696   $a_return = array();
697   if(is_array($this->gotoPrinters)){
698     foreach($this->gotoPrinters as $printer){
699         if($printer['mode'] == "admin"){
700          $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Admin");
701         }else{
702          $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
703         }
704       }
705     }
706   return($a_return);
707   }
718 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
719 ?>