bebd828679bed97845ced3e62b88eb28050de52a
1 <?php
3 class faiPackageConfiguration extends plugin
4 {
5 /* CLI vars */
6 var $cli_summary = "Manage server basic objects";
7 var $cli_description = "Some longer text\nfor help";
8 var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
10 /* attribute list for save action */
11 var $ignore_account = TRUE;
12 var $attributes = array();
13 var $objectclasses = array();
15 var $path;
17 var $Debconf_handle = NULL;
18 var $pkg_config ;
19 var $obj;
21 function faiPackageConfiguration ($config, $dn= NULL,$obj,$path,$pkg_config)
22 {
23 plugin::plugin ($config, $dn);
24 $this->obj = $obj;
25 $this->Debconf_handle = new debconf($this->obj, "de");
26 $this->Debconf_handle->set_template_directory($this->path);
27 $this->pkg_config = $pkg_config;
29 foreach($this->pkg_config as $var){
30 $this->Debconf_handle->SetDefault($var['Name'],$var['Value']);
31 }
32 }
34 function execute()
35 {
36 /* Call parent execute */
37 plugin::execute();
39 /* Fill templating stuff */
40 $smarty = get_smarty();
41 $display = "$this->obj";
43 $this->Debconf_handle -> PostCheck();
45 $smarty->assign("Config",$this->Debconf_handle->get_dialog());
47 $display.= $smarty->fetch(get_template_path('faiPackageConfiguration.tpl', TRUE));
48 return($display);
49 }
51 /* Save data to object */
52 function save_object()
53 {
54 }
56 /* Check supplied data */
57 function check()
58 {
59 $message= array();
60 return ($message);
61 }
63 function save()
64 {
65 $this->Debconf_handle->set_template_directory($this->path);
67 $this->Debconf_handle -> PostCheck();
68 $pkgs = $this->Debconf_handle->template;
70 $tmp = array();
71 foreach($pkgs as $pkg){
72 $tmp[$this->obj][$pkg['Name']]['Value']= $pkg['Default'];
73 $tmp[$this->obj][$pkg['Name']]['Name'] = $pkg['Name'];
74 $tmp[$this->obj][$pkg['Name']]['Type'] = $pkg['Type'];
75 }
76 return($tmp);
77 }
78 }
79 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
80 ?>