Code

5788dbc9082a34acadd9af2da957e1e09896e74c
[gosa.git] / trunk / gosa-plugins / systems / admin / systems / class_askOgroup.inc
1 <?php
3 class askObjectGroup extends plugin
4 {
5   /* attribute list for save action */
6   var $ignore_account     = TRUE;
7   var $attributes         = array();
8   var $objectclasses      = array("whatever");
10   var $objectClass        = false;
11   var $ObjectGroup        = "";  
12   var $ObjectGroups       = array();
13   var $sw = "";
14   var $parent;
16   function askObjectGroup (&$config,$dn,$ui, $ObjectClass, $sw)
17   {
18     $this->ui = $ui;
19     plugin::plugin ($config, $dn);
20     $this->ObjectClass = $ObjectClass;
21     $this->sw = $sw;
23     /* Get a list of object groups */
24     $ldap = $this->config->get_ldap_link();
25     $ldap->cd($this->config->current['BASE']);
26     $ldap->search('(objectClass=gosaGroupOfNames)', array("cn"));
27     $tmp = array();
28     while($attrs = $ldap->fetch()) {
29       $tmp[$attrs['dn']] = $attrs['cn'][0];
30     }
31     asort($tmp, SORT_LOCALE_STRING);
32     $this->ObjectGroups = array_merge(array("" => _("None")), $tmp);
33   }
35   function execute()
36   {
37     /* Call parent execute */
38     plugin::execute();
40     /* Fill templating stuff */
41     $smarty = get_smarty();
42     $display= "";
44     /* Generate headline */
45     $str = "";
46     switch($this->ObjectClass) {
47       case "worktabs":  $str =_("Create workstation"); break;
48       default:  $str =_("Create");break;
49     }
50     $smarty->assign("headline", $str);
52     $smarty->assign("ogroups", $this->ObjectGroups);
53     $display.= $smarty->fetch(get_template_path('askObjectGroup.tpl', TRUE));
54     return($display);
55   }
57   /* Get posts and set class name 
58    */ 
59   function save_object()
60   {
61     if (isset($_POST['SelectedOgroup']) && isset($_POST['edit_continue'])) {
62       if ($this->ObjectGroup != _("None")) {
63           $this->ObjectGroup = $_POST['SelectedOgroup'];
64       }
65     }
66   }
68   /* Return the class name */
69   function save()
70   {
71     return($this->ObjectGroup);
72   }
74 }
76 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
77 ?>