Code

First commit of FAI list modifications ... a lot to do here ......
[gosa.git] / gosa-plugins / fai / admin / fai / class_faiManagement.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: class_roleManagement.inc 14742 2009-11-04 13:18:33Z hickert $$
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 faiManagement extends management
24 {
25   var $plHeadline     = "Roles";
26   var $plDescription  = "Role management";
27   var $plIcon  = "plugins/rolemanagement/images/plugin.png";
29   // Tab definition 
30   protected $tabClass = "roletabs";
31   protected $tabType = "ROLETABS";
32   protected $aclCategory = "roles";
33   protected $aclPlugin   = "role";
34   protected $objectName   = "role";
36   var $fai_release = ""; // The currently selected release while in release management mode!
38   function __construct($config,$ui)
39   {
40     $this->config = $config;
41     $this->ui = $ui;
42    
43     $this->storagePoints = array(get_ou("roleRDN"));
44  
45     // Build filter
46 #    if (session::global_is_set(get_class($this)."_filter")){
47  #     $filter= session::global_get(get_class($this)."_filter");
48   #  } else {
49       $filter = new filter(get_template_path("fai-filter.xml", true));
50       $filter->setObjectStorage($this->storagePoints);
51    # }
52     $this->setFilter($filter);
54     // Build headpage
55     $headpage = new listing(get_template_path("fai-list.xml", true));
56     $headpage->setFilter($filter);
58     // Add copy&paste and snapshot handler.
59     if ($this->config->boolValueIsTrue("main", "copyPaste")){
60       $this->cpHandler = new CopyPasteHandler($this->config);
61     }
62     if($this->config->get_cfg_value("enableSnapshots") == "true"){
63       $this->snapHandler = new SnapshotHandler($this->config);
64     }
65     parent::__construct($config, $ui, "roles", $headpage);
66   }
68   function renderList()
69   {
70     $filter = $this->getFilter();
71     $headpage = $this->getHeadpage();
72     $filter->setComboBoxOptions("RELEASE",$this->getReleaseList());
74     if(isset($_POST['RELEASE'])){
75       $this->fai_release = get_post('RELEASE');
76     }
77     $headpage->setBase($this->fai_release);
78     $headpage->update();
79     $display = $headpage->render();
80     return($this->getHeader().$display);
81   }
83   function getReleaseList($base = "", $prefix ="")
84   {
85     $list = array();
86     if(empty($base)){
87       $base = get_ou('faiBaseRDN').$this->config->current['BASE'];
88       $list[$base] = "/";
89     }
91     $ldap = $this->config->get_ldap_link();
92     $ldap->ls("(objectClass=FAIbranch)",$base,array("ou","FAIstate"));
93     while($release = $ldap->fetch()){
94       $list[$release['dn']] = $prefix.$release['ou'][0];
95       $list = array_merge($list,$this->getReleaseList($release['dn'],$prefix."&nbsp; "));
96     }
97     return($list);
98   }
101
102 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
103 ?>