Code

Added a first set of reference changes - nearly untested
[gosa.git] / plugins / admin / systems / class_SelectDeviceType.inc
1 <?php
3 class SelectDeviceType 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= TRUE;
12   var $attributes= array("ObjectGroup","SystemType");
13   var $objectclasses= array("whatever");
15   var $ObjectGroups   = array();
16   var $SystemTypes       = array();
18   var $ObjectGroup    = "";
19   var $SystemType        = "";
21   function SelectDeviceType  (&$config, $dn= NULL)
22   {
23     plugin::plugin ($config, $dn);
25     /* Get object groups */
26     $ldap = $this->config->get_ldap_link();
27     $ldap->cd ($this->config->current['BASE']);
28     $ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("cn"));
29     $this->ObjectGroups['none']=_("none");
30     while($attrs = $ldap->fetch()){
31       $this->ObjectGroups[$attrs['dn']]= $attrs['cn'][0];
32     }
34     $this->SystemTypes =array("workstation"=>_("Workstation"), "terminal"=>_("Terminal"), "server"=>_("Server"));
35   }
37   function execute()
38   {
39     /* Call parent execute */
40     plugin::execute();
42     /* Fill templating stuff */
43     $smarty= get_smarty();
44     $display= "";
46     $smarty->assign("ObjectGroups"    ,$this->ObjectGroups);
47     $smarty->assign("ObjectGroupKeys" ,array_flip($this->ObjectGroups));
48     $smarty->assign("SystemTypes"     ,$this->SystemTypes);
49     $smarty->assign("SystemTypeKeys"  ,array_flip($this->SystemTypes)); 
51     $smarty->assign("ObjectGroup",$this->ObjectGroup);
52     $smarty->assign("SystemType",$this->SystemType);
54     $display.= $smarty->fetch(get_template_path('SelectDeviceType.tpl', TRUE));
55     return($display);
56   }
58   /* Save data to object */
59   function save_object()
60   {
61     plugin::save_object();
62     foreach($this->attributes as $attr){
63       if(isset($_POST[$attr])){
64         $this->$attr = $_POST[$attr];
65       }
66     }
67   }
69   /* Check supplied data */
70   function check()
71   {
72     /* Call common method to give check the hook */
73     $message= plugin::check();
75     return ($message);
76   }
78   /* Save to LDAP */
79   function save()
80   {
81   }
82 }
84 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
85 ?>