Code

a4d0279dbd444368a4ab094b919d4a982f394eea
[gosa.git] / plugins / admin / groups / tabs_group.inc
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 save()
34         {
35                 $baseobject= $this->by_object['group'];
37                 /* Check for new 'dn', in order to propagate the
38                    'dn' to all plugins */
39                 $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
41                 /* Put baseobjects 'cn' to mailobjects 'uid' */
42                 if (isset($this->by_object['mailgroup'])){
43                         $this->by_object['mailgroup']->uid= $baseobject->cn;
44                 }
47                 /* Update reference, transfer variables */
48                 foreach ($this->by_object as $name => $obj){
49                         /* Transfer attributes for mailgroup account */
50                         if ($name == 'mailgroup'){
51                                 $this->by_object['mailgroup']->members= $baseobject->memberUid;;
52                         }
53                 }
55                 /* Move group? */
56                 if ($this->dn != $new_dn){
58                         /* Write entry on new 'dn' */
59                         if ($this->dn != "new"){
60                                 $baseobject->move($this->dn, $new_dn);
61                                 $this->by_object['group']= $baseobject;
62                         }
64                         /* Happen to use the new one */
65                         $this->dn= $new_dn;
66                 }
68                 $ret= tabs::save();
70                 /* Fix tagging if needed */
71                 $baseobject->dn= $new_dn;
72                 $baseobject->handle_object_tagging();
74                 return $ret;
75         }
77         function saveCopyDialog()
78         {
79                 tabs::saveCopyDialog();
80                 
81         /* Update reference, transfer variables */
82         $baseobject= $this->by_object['group'];
83         foreach ($this->by_object as $name => $obj){
84             /* Don't touch base object */
85             if ($name != 'group'){
86                 $obj->parent= &$this;
87                 $obj->cn= $baseobject->cn;
88                 $this->by_object[$name]= $obj;
89             }
90         }
91         }
92         
93 }
95 ?>