1 <?php
3 class grouptabs extends tabs
4 {
6 function grouptabs($config, $data, $dn)
7 {
8 tabs::tabs($config, $data, $dn);
9 $baseobject= $this->by_object['group'];
10 foreach ($this->by_object as $name => $obj){
11 if(isset($obj->parent)){
12 $this->by_object[$name]->parent = $this;
13 }
14 }
15 }
17 function save_object($save_current= FALSE)
18 {
19 tabs::save_object($save_current);
21 /* Update reference, transfer variables */
22 $baseobject= $this->by_object['group'];
23 foreach ($this->by_object as $name => $obj){
24 /* Don't touch base object */
25 if ($name != 'group'){
26 $obj->parent= &$this;
27 $obj->cn= $baseobject->cn;
28 $this->by_object[$name]= $obj;
29 }
30 }
31 }
33 function delete()
34 {
35 /* Put baseobjects 'cn' to mailobjects 'uid' */
36 $baseobject= $this->by_object['group'];
37 if (isset($this->by_object['mailgroup'])){
38 $this->by_object['mailgroup']->uid= $baseobject->cn;
39 }
40 tabs::delete();
41 }
43 function save()
44 {
45 $baseobject= $this->by_object['group'];
47 /* Check for new 'dn', in order to propagate the
48 'dn' to all plugins */
49 $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
51 /* Put baseobjects 'cn' to mailobjects 'uid' */
52 if (isset($this->by_object['mailgroup'])){
53 $this->by_object['mailgroup']->uid= $baseobject->cn;
54 }
57 /* Update reference, transfer variables */
58 foreach ($this->by_object as $name => $obj){
59 /* Transfer attributes for mailgroup account */
60 if ($name == 'mailgroup'){
61 $this->by_object['mailgroup']->members= $baseobject->memberUid;;
62 }
63 }
65 /* Move group? */
66 if ($this->dn != $new_dn){
68 /* Write entry on new 'dn' */
69 if ($this->dn != "new"){
70 $baseobject->move($this->dn, $new_dn);
71 $this->by_object['group']= $baseobject;
72 }
74 /* Happen to use the new one */
75 $this->dn= $new_dn;
76 }
78 $ret= tabs::save();
80 /* Fix tagging if needed */
81 $baseobject->dn= $new_dn;
82 $baseobject->handle_object_tagging();
84 return $ret;
85 }
87 function saveCopyDialog()
88 {
89 tabs::saveCopyDialog();
91 /* Update reference, transfer variables */
92 $baseobject= $this->by_object['group'];
93 foreach ($this->by_object as $name => $obj){
94 /* Don't touch base object */
95 if ($name != 'group'){
96 $obj->parent= &$this;
97 $obj->cn= $baseobject->cn;
98 $this->by_object[$name]= $obj;
99 }
100 }
101 }
103 }
105 ?>