1 <?php
3 class ogrouptabs extends tabs
4 {
5 var $base= "";
7 function ogrouptabs($config, $data, $dn)
8 {
9 tabs::tabs($config, $data, $dn);
10 $this->base= $this->by_object['ogroup']->base;
12 /* Insert extra tabs for several object types - if present */
13 $objects= preg_replace('/[\[\]]/', '', $this->by_object['ogroup']->gosaGroupObjects);
14 for ($n= 0; $n<strlen($objects); $n++){
15 switch ($objects[$n]){
16 case "T":
17 /* Add a terminal tab */
18 require_once("class_termgroup.inc");
19 $this->by_name['termgroup']= _("Terminals");
20 $this->by_object['termgroup']= new termgroup($this->config, $this->dn);
21 $this->by_object['termgroup']->parent= &$this;
23 break;
25 case "U":
26 /* Append a PhoneQueue, if objectClass = goFonAccount */
27 $use = false;
28 foreach($this->by_object['ogroup']->memberList as $dn => $val){
29 if(isset($val['objectClass'])){
30 if(in_array("goFonAccount",$val['objectClass'])){
31 $use = true;
32 }
33 }
34 }
36 /* We found goFonAccount in users objectClasses*/
37 if($use){
38 require_once("class_phonequeue.inc");
39 $this->by_name['phonequeue']= _("Phone queue");
40 $this->by_object['phonequeue']= new phonequeue($this->config, $this->dn);
41 $this->by_object['phonequeue']->parent= &$this;
43 }
45 /* Add a user tab used for mail distribution lists */
46 if(isset($this->config->current['MAILMETHOD'])){
47 if (preg_match('/kolab/i', $this->config->current['MAILMETHOD'])){
48 require_once("class_mailogroup.inc");
49 $this->by_name['mailogroup']= _("Mail");
50 $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
51 $this->by_object['mailogroup']->parent= &$this;
52 }
53 }
55 break;
56 }
57 }
58 }
61 function check()
62 {
63 return (tabs::check(TRUE));
64 }
67 function save_object($save_current= FALSE)
68 {
69 tabs::save_object($save_current);
71 /* Update reference, transfer variables */
72 $baseobject= $this->by_object['ogroup'];
73 foreach ($this->by_object as $name => $obj){
75 /* Don't touch base object */
76 if ($name != 'ogroup'){
77 $obj->parent= &$this;
78 $obj->uid= $baseobject->uid;
79 $obj->sn= $baseobject->uid;
80 $obj->givenName= $baseobject->uid;
81 $this->by_object[$name]= $obj;
82 }
84 /* Update parent in base object */
85 $this->by_object['ogroup']->parent= &$this;
86 }
87 }
90 function save()
91 {
92 $baseobject= $this->by_object['ogroup'];
94 /* Check for new 'dn', in order to propagate the
95 'dn' to all plugins */
96 $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
98 /* Move group? */
99 if ($this->dn != $new_dn){
101 /* Write entry on new 'dn' */
102 if ($this->dn != "new"){
103 $baseobject->move($this->dn, $new_dn);
104 $this->by_object['ogroup']= $baseobject;
105 }
107 /* Happen to use the new one */
108 $this->dn= $new_dn;
109 }
111 if ($this->dn == "new"){
112 $this->dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
113 }
115 tabs::save();
116 }
118 }
120 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
121 ?>