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){
17 if(!class_available($tab['CLASS'])) continue;
18 $this->by_name[$tab['CLASS']]= $tab['NAME'];
20 if ($baseobject === NULL){
21 $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
22 $this->by_object[$tab['CLASS']]= $baseobject;
23 } else {
24 $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
25 }
27 $this->by_object[$tab['CLASS']]->parent= &$this;
28 $this->by_object[$tab['CLASS']]->set_acl_category($category);
30 /* Initialize current */
31 if ($this->current == ""){
32 $this->current= $tab['CLASS'];
33 }
34 }
36 /* Add references/acls/snapshots */
37 $this->addSpecialTabs();
38 }
41 /*! \brief Reinitializes the tab classes with fresh ldap values.
42 This maybe usefull if for example the apply button was pressed.
43 */
44 function re_init()
45 {
46 $baseobject= NULL;
47 foreach($this->by_object as $name => $object){
48 $class = get_class($object);
49 if(in_array($class,array("reference","acl"))) continue;
50 if ($baseobject === NULL){
51 $baseobject= new $class($this->config, $this->dn,NULL,$this);
52 $baseobject->enable_CSN_check();
53 $this->by_object[$name]= $baseobject;
54 } else {
55 $this->by_object[$name]= new $class($this->config, $this->dn, $baseobject,$this);
56 }
57 $this->by_object[$name]->parent= &$this;
58 $this->by_object[$name]->set_acl_category($this->acl_category);
59 }
60 }
63 function save_object($save_current= FALSE)
64 {
65 tabs::save_object($save_current);
67 /* Assign current cn */
68 $baseobject= $this->by_object['workgeneric'];
69 $baseobject->netConfigDNS->cn= $baseobject->cn;
70 foreach ($this->by_object as $key => $obj){
71 $this->by_object[$key]->cn= $baseobject->cn;
72 }
73 }
76 function save($ignore_account= FALSE)
77 {
78 /* Check for new 'dn', in order to propagate the
79 'dn' to all plugins */
80 $baseobject= $this->by_object['workgeneric'];
81 $this->dn= "cn=".$baseobject->cn.",".get_ou('workstationRDN').$baseobject->base;
83 if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
85 /* Udpate acls */
86 $baseobject->update_acls($baseobject->orig_dn,$this->dn);
87 $baseobject->move($baseobject->orig_dn,$this->dn);
88 }
90 $baseobject->dn= $this->dn;
92 foreach ($this->by_object as $key => $obj){
93 $this->by_object[$key]->dn= $this->dn;
94 $this->by_object[$key]->cn= $baseobject->cn;
95 }
97 tabs::save(TRUE);
99 if(isset($this->by_object['printgeneric'])){
100 if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
101 $this->by_object['printgeneric']->remove_from_parent();
102 }
103 }
104 }
106 }
108 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
109 ?>