Code

Fixed layout
[gosa.git] / plugins / admin / ogroups / tabs_ogroups.inc
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(in_array("goFonAccount",$val['objectClass'])){
30               $use = true; 
31             }
32           }
33     
34           /* We found goFonAccount in users objectClasses*/
35           if($use){
36             require_once("class_phonequeue.inc");
37             $this->by_name['phonequeue']= _("Phone queue");
38             $this->by_object['phonequeue']= new phonequeue($this->config, $this->dn);
39             $this->by_object['phonequeue']->parent= &$this;
41           } 
42  
43           /* Add a user tab used for mail distribution lists */
44           if(isset($this->config->current['MAILMETHOD'])){
45             if (preg_match('/kolab/i', $this->config->current['MAILMETHOD'])){
46               require_once("class_mailogroup.inc");
47               $this->by_name['mailogroup']= _("Mail");
48               $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
49               $this->by_object['mailogroup']->parent= &$this;
50             }
51           }
53           break;
54       }
55     }
56   }
59   function check()
60   {
61     return (tabs::check(TRUE));
62   }
65   function save_object($save_current= FALSE)
66   {
67     tabs::save_object($save_current);
69     /* Update reference, transfer variables */
70     $baseobject= $this->by_object['ogroup'];
71     foreach ($this->by_object as $name => $obj){
73       /* Don't touch base object */
74       if ($name != 'ogroup'){
75         $obj->parent= &$this;
76         $obj->uid= $baseobject->uid;
77         $obj->sn= $baseobject->uid;
78         $obj->givenName= $baseobject->uid;
79         $this->by_object[$name]= $obj;
80       }
82       /* Update parent in base object */
83       $this->by_object['ogroup']->parent= &$this;
84     }
85   }
88   function save()
89   {
90     $baseobject= $this->by_object['ogroup'];
92     /* Check for new 'dn', in order to propagate the
93        'dn' to all plugins */
94     $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
96     /* Move group? */
97     if ($this->dn != $new_dn){
99       /* Write entry on new 'dn' */
100       if ($this->dn != "new"){
101         $baseobject->move($this->dn, $new_dn);
102         $this->by_object['ogroup']= $baseobject;
103       }
105       /* Happen to use the new one */
106       $this->dn= $new_dn;
107     }
109     if ($this->dn == "new"){
110       $this->dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
111     }
113     tabs::save();
114   }
118 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
119 ?>