Code

Updated new Config Management
[gosa.git] / gosa-core / plugins / admin / newConfigManagement / class_ConfigManagementListing.inc
1 <?php
3 class ConfigManagementListing extends management
4 {
6     private $base = "";
8     private $distributionSelector = NULL;
9     private $releaseSelector = NULL;
12     function __construct($config, $ui)
13     {
14         // Set storage points - We do not have any - We just create a fake list which lists all items
15         $this->storagePoints = array("");
16         $this->rebuildListing();
18         $this->distributionSelector = new ItemSelector(array(),'/root','/root');
19         $this->releaseSelector = new ItemSelector(array('cn=root'=>'root'),"cn=root","cn=root");
20     }
22     function save_object()
23     {
24         $this->distributionSelector->update();    
25         $this->releaseSelector->update();    
26     }
28     function getSelectedDistribution()
29     {
30         return($this->distributionSelector->getBase());
31     }
33     function setDistribution($dist)
34     {
35         return($this->distributionSelector->setBase($dist));
36     }
38     function setRelease($rel)
39     {
40         return($this->releaseSelector->setBase($rel));
41     }
43     function getSelectedRelease()
44     {
45         return($this->releaseSelector->getBase());
46     }
49     function setDistributions($distributions) 
50     {
51         $this->distributionSelector->setBases($distributions);
52         $this->distributionSelector->update(TRUE);
53     }
55     function setReleases($releases) 
56     {
57         $this->releaseSelector->setBases($releases);
58         $this->releaseSelector->update(TRUE);
59     }
61     function renderList()
62     {
63         session::set('DEVICE_ITEMS', array());
65         $filter = $this->getFilter();
66         $headpage = $this->getHeadpage();
67         $headpage->update();
68         $smarty = get_smarty();
69         
70         $smarty->assign("DISTRIBUTION", $this->distributionSelector->render());
71         $smarty->assign("RELEASE", $this->releaseSelector->render());
72         $display = $headpage->render();
73         return($this->getHeader().$display);
75     }
77    
78     function rebuildListing()
79     {
80         // Build filter
81         if (session::global_is_set(get_class($this)."_filter")){
82             $filter= session::global_get(get_class($this)."_filter");
83         } else {
84             $filter = new filter(get_template_path("DeviceConfig-filter.xml", true));
85             $filter->setObjectStorage($this->storagePoints);
86         }
87         $this->setFilter($filter);
89         // Load service xml file and fill in placeholders
90         $contents = file_get_contents(get_template_path("DeviceConfig-list.xml", true));
91         $contents = preg_replace("/%ITEMS%/", "", $contents);
92         $headpage = new listing($contents,TRUE);
93         $headpage->setBase($this->base);
94         $headpage->setFilter($filter);
96         parent::__construct($this->config, $this->ui, "services", $headpage);
97     }
98
100 ?>