1 <?php
3 class worktabs extends tabs
4 {
6 function worktabs($config, $data, $dn,$category)
7 {
9 /* Save dn */
10 $this->dn= $dn;
11 $this->config= $config;
13 $baseobject= NULL;
15 foreach ($data as $tab){
16 $this->by_name[$tab['CLASS']]= $tab['NAME'];
18 if ($baseobject === NULL){
19 $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
20 $this->by_object[$tab['CLASS']]= $baseobject;
21 } else {
22 $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
23 }
25 $this->by_object[$tab['CLASS']]->parent= &$this;
26 $this->by_object[$tab['CLASS']]->set_acl_category($category);
28 /* Initialize current */
29 if ($this->current == ""){
30 $this->current= $tab['CLASS'];
31 }
32 }
34 /* Add references/acls/snapshots */
35 $this->addSpecialTabs();
36 }
39 /*! \brief Reinitializes the tab classes with fresh ldap values.
40 This maybe usefull if for example the apply button was pressed.
41 */
42 function re_init()
43 {
44 $baseobject= NULL;
45 foreach($this->by_object as $name => $object){
46 $class = get_class($object);
47 if(in_array($class,array("reference","acl"))) continue;
48 if ($baseobject === NULL){
49 $baseobject= new $class($this->config, $this->dn,NULL,$this);
50 $baseobject->enable_CSN_check();
51 $this->by_object[$name]= $baseobject;
52 } else {
53 $this->by_object[$name]= new $class($this->config, $this->dn, $baseobject,$this);
54 }
55 $this->by_object[$name]->parent= &$this;
56 $this->by_object[$name]->set_acl_category($this->acl_category);
57 }
58 }
61 function save_object($save_current= FALSE)
62 {
63 tabs::save_object($save_current);
65 /* Assign current cn */
66 $baseobject= $this->by_object['workgeneric'];
67 $baseobject->netConfigDNS->cn= $baseobject->cn;
68 foreach ($this->by_object as $key => $obj){
69 $this->by_object[$key]->cn= $baseobject->cn;
70 }
71 }
74 function save($ignore_account= FALSE)
75 {
76 /* Check for new 'dn', in order to propagate the
77 'dn' to all plugins */
78 $baseobject= $this->by_object['workgeneric'];
79 $this->dn= "cn=".$baseobject->cn.",".get_ou('workstationou').$baseobject->base;
81 if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
83 /* Udpate acls */
84 $baseobject->update_acls($baseobject->orig_dn,$this->dn);
85 $baseobject->move($baseobject->orig_dn,$this->dn);
86 }
88 $baseobject->dn= $this->dn;
90 foreach ($this->by_object as $key => $obj){
91 $this->by_object[$key]->dn= $this->dn;
92 $this->by_object[$key]->cn= $baseobject->cn;
93 }
95 tabs::save(TRUE);
97 if(isset($this->by_object['printgeneric'])){
98 if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
99 $this->by_object['printgeneric']->remove_from_parent();
100 }
101 }
102 }
104 }
106 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
107 ?>