1 <?php
3 class SelectDeviceType extends plugin
4 {
5 /* attribute list for save action */
6 var $ignore_account= TRUE;
7 var $attributes= array("ObjectGroup","SystemType");
8 var $objectclasses= array("whatever");
10 var $ObjectGroups = array();
11 var $SystemTypes = array();
13 var $ObjectGroup = "";
14 var $SystemType = "";
16 function SelectDeviceType (&$config, $dn= NULL)
17 {
18 plugin::plugin ($config, $dn);
20 /* Get object groups */
21 $ldap = $this->config->get_ldap_link();
22 $ldap->cd ($this->config->current['BASE']);
23 $ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("cn"));
24 $this->ObjectGroups['none']=_("none");
25 while($attrs = $ldap->fetch()){
26 $this->ObjectGroups[$attrs['dn']]= $attrs['cn'][0];
27 }
29 $this->SystemTypes =array("workstation"=>_("Workstation"), "terminal"=>_("Terminal"), "server"=>_("Server"));
30 }
32 function execute()
33 {
34 /* Call parent execute */
35 plugin::execute();
37 /* Fill templating stuff */
38 $smarty= get_smarty();
39 $display= "";
41 $smarty->assign("ObjectGroups" ,$this->ObjectGroups);
42 $smarty->assign("ObjectGroupKeys" ,array_flip($this->ObjectGroups));
43 $smarty->assign("SystemTypes" ,$this->SystemTypes);
44 $smarty->assign("SystemTypeKeys" ,array_flip($this->SystemTypes));
46 $smarty->assign("ObjectGroup",$this->ObjectGroup);
47 $smarty->assign("SystemType",$this->SystemType);
49 $display.= $smarty->fetch(get_template_path('SelectDeviceType.tpl', TRUE,dirname(__FILE__)));
50 return($display);
51 }
53 /* Save data to object */
54 function save_object()
55 {
56 plugin::save_object();
57 foreach($this->attributes as $attr){
58 if(isset($_POST[$attr])){
59 $this->$attr = $_POST[$attr];
60 }
61 }
62 }
64 /* Check supplied data */
65 function check()
66 {
67 /* Call common method to give check the hook */
68 $message= plugin::check();
70 return ($message);
71 }
73 /* Save to LDAP */
74 function save()
75 {
76 }
77 }
79 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
80 ?>