Code

e14f2be9636a547b870b6f17d89fe884be29b230
[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 (preg_match('/kolab/i', $this->config->current['MAILMETHOD'])){
45             require_once("class_mailogroup.inc");
46             $this->by_name['mailogroup']= _("Mail");
47             $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
48             $this->by_object['mailogroup']->parent= &$this;
49           }
51           break;
52       }
53     }
54   }
57   function check()
58   {
59     return (tabs::check(TRUE));
60   }
63   function save_object($save_current= FALSE)
64   {
65     tabs::save_object($save_current);
67     /* Update reference, transfer variables */
68     $baseobject= $this->by_object['ogroup'];
69     foreach ($this->by_object as $name => $obj){
71       /* Don't touch base object */
72       if ($name != 'ogroup'){
73         $obj->parent= &$this;
74         $obj->uid= $baseobject->uid;
75         $obj->sn= $baseobject->uid;
76         $obj->givenName= $baseobject->uid;
77         $this->by_object[$name]= $obj;
78       }
80       /* Update parent in base object */
81       $this->by_object['ogroup']->parent= &$this;
82     }
83   }
86   function save()
87   {
88     $baseobject= $this->by_object['ogroup'];
90     /* Check for new 'dn', in order to propagate the
91        'dn' to all plugins */
92     $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
94     /* Move group? */
95     if ($this->dn != $new_dn){
97       /* Write entry on new 'dn' */
98       if ($this->dn != "new"){
99         $baseobject->move($this->dn, $new_dn);
100         $this->by_object['ogroup']= $baseobject;
101       }
103       /* Happen to use the new one */
104       $this->dn= $new_dn;
105     }
107     if ($this->dn == "new"){
108       $this->dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
109     }
111     tabs::save();
112   }
116 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
117 ?>