Code

Centralized copy & paste ACL checks.
[gosa.git] / gosa-core / plugins / admin / acl / tabs_acl.inc
1 <?php
2 /*
3  * This code is part of GOsa (http://www.gosa-project.org)
4  * Copyright (C) 2003-2008 GONICUS GmbH
5  *
6  * ID: $$Id$$
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
23 class acltab extends tabs
24 {
26   function acltab($config, $data, $dn)
27   {
28     $data = array(array("CLASS" => "acl" , "NAME" => _("ACL")));
30     /* Save dn */
31     $this->dn= $dn;
32     $this->config= $config;
34     $baseobject= NULL;
36     foreach ($data as $tab){
37       $this->by_name[$tab['CLASS']]= $tab['NAME'];
39       
40       if ($baseobject === NULL){
41         if($tab['CLASS'] == "acl"){
42           $baseobject= new $tab['CLASS']($this->config, $this, $this->dn);
43         }else{
44           $baseobject= new $tab['CLASS']($this->config,$this->dn);
45         }
46         $this->by_object[$tab['CLASS']]= $baseobject;
47       } else {
48         if($tab['CLASS'] == "acl"){
49           $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config,$this,$this->dn, $baseobject);
50         }else{
51           $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject);
52         }
53       }
55       $this->by_object[$tab['CLASS']]->parent= &$this;
56       $this->by_object[$tab['CLASS']]->set_acl_category("acl");
58       /* Initialize current */
59       if ($this->current == ""){
60         $this->current= $tab['CLASS'];
61       }
62     }
63   }
65   function save($ignore_account= FALSE)
66   {
67     $ret= tabs::save();
68     return $ret;
69   }
71   function save_object($ignore_account= FALSE)
72   {
73     tabs::save_object();
74   }
75   
76   function execute()
77   {
78     $display= tabs::execute();
79     if(!$this->by_object['acl']->dialog){
80       $display.= "<p style=\"text-align:right\">\n";
81       $display.= "  <input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
82       $display.= "  &nbsp;\n";
83       $display.= "  <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
84       $display.= "</p>";
85     }
86     return($display);
87   }
88 }
89 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
90 ?>