1 <?php
3 class worktabs extends tabs
4 {
6 public $was_activated = FALSE;
8 function worktabs($config, $data, $dn,$category)
9 {
11 /* Save dn */
12 $this->dn= $dn;
13 $this->config= $config;
15 $baseobject= NULL;
17 foreach ($data as $tab){
19 if(!class_available($tab['CLASS'])) continue;
20 $this->by_name[$tab['CLASS']]= $tab['NAME'];
22 if ($baseobject === NULL){
23 $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
24 $this->by_object[$tab['CLASS']]= $baseobject;
25 } else {
26 $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
27 }
29 $this->by_object[$tab['CLASS']]->parent= &$this;
30 $this->by_object[$tab['CLASS']]->set_acl_category($category);
32 /* Initialize current */
33 if ($this->current == ""){
34 $this->current= $tab['CLASS'];
35 }
36 }
38 /* Add references/acls/snapshots */
39 $this->addSpecialTabs();
40 }
43 /*! \brief Reinitializes the tab classes with fresh ldap values.
44 This maybe usefull if for example the apply button was pressed.
45 */
46 function re_init()
47 {
48 $baseobject= NULL;
49 foreach($this->by_object as $name => $object){
50 $class = get_class($object);
51 if(in_array($class,array("reference","acl"))) continue;
52 if ($baseobject === NULL){
53 $baseobject= new $class($this->config, $this->dn,NULL,$this);
54 $baseobject->enable_CSN_check();
55 $this->by_object[$name]= $baseobject;
56 } else {
57 $this->by_object[$name]= new $class($this->config, $this->dn, $baseobject,$this);
58 }
59 $this->by_object[$name]->parent= &$this;
60 $this->by_object[$name]->set_acl_category($this->acl_category);
61 }
62 }
65 function save_object($save_current= FALSE)
66 {
67 tabs::save_object($save_current);
69 /* Assign current cn */
70 $baseobject= $this->by_object['workgeneric'];
71 $baseobject->netConfigDNS->cn= $baseobject->cn;
72 foreach ($this->by_object as $key => $obj){
73 $this->by_object[$key]->cn= $baseobject->cn;
74 }
75 }
78 function save($ignore_account= FALSE)
79 {
80 /* Check for new 'dn', in order to propagate the
81 'dn' to all plugins */
82 $baseobject= $this->by_object['workgeneric'];
83 $this->dn= "cn=".$baseobject->cn.",".get_ou('workstationRDN').$baseobject->base;
85 if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
87 /* Udpate acls */
88 $baseobject->update_acls($baseobject->orig_dn,$this->dn);
89 $baseobject->move($baseobject->orig_dn,$this->dn);
90 }
92 $baseobject->dn= $this->dn;
94 foreach ($this->by_object as $key => $obj){
95 $this->by_object[$key]->dn= $this->dn;
96 $this->by_object[$key]->cn= $baseobject->cn;
97 }
99 tabs::save(TRUE);
101 if(isset($this->by_object['printgeneric'])){
102 if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
103 $this->by_object['printgeneric']->remove_from_parent();
104 }
105 }
106 }
108 }
110 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
111 ?>