1 <?php
3 class faiGroupHandle{
6 private $FAI_group;
7 private $mode = "edit";
8 private $open = TRUE;
9 private $canceled = FALSE;
11 public function __construct($FAI_group, $Action)
12 {
13 if(in_array($Action,array("edit","remove"))){
14 $this->mode = $Action;
15 }
17 /* Preset required values */
18 foreach($FAI_group as $type => $data){
19 $FAI_group[$type]['selected'] = FALSE;
20 }
21 $this->FAI_group = $FAI_group;
22 }
24 function execute()
25 {
26 $smarty = get_smarty();
27 $smarty->assign("FAI_group",$this->FAI_group);
28 $smarty->assign("types",$this->get_types());
29 $smarty->assign("mode",$this->mode);
30 return($smarty->fetch(get_template_path("faiGroupHandle.tpl",TRUE,dirname(__FILE__))));
31 }
33 function save_object()
34 {
35 if(isset($_POST['faiGroupHandle'])){
36 foreach($this->FAI_group as $key => $group){
37 if(isset($_POST[$this->mode."_".$key])){
38 $this->FAI_group[$key]['selected'] = TRUE;
39 }else{
40 $this->FAI_group[$key]['selected'] = FALSE;
41 }
42 }
43 if(isset($_POST['faiGroupHandle_apply']) || isset($_POST['faiGroupHandle_cancel'])){
44 $this->open = FALSE;
45 }
46 if(isset($_POST['faiGroupHandle_cancel'])){
47 $this->canceled = TRUE;
48 }
50 }
51 }
53 function is_open()
54 {
55 return($this->open);
56 }
58 function is_canceled()
59 {
60 return($this->canceled);
61 }
63 function get_mode()
64 {
65 return($this->mode);
66 }
68 function get_selected()
69 {
70 $ret= array();
71 foreach($this->FAI_group as $key => $obj){
72 if($obj['selected']){
73 $ret[$key] = $obj;
74 }
75 }
76 return($ret);
77 }
79 function get_types()
80 {
81 $objects = array(
82 "FAIpartitionTable" => array("IMG"=> "plugins/fai/images/fai_partitionTable.png",
83 "NAME"=>_("Partition table"),"KZL"=> "PT", "VAR"=>"ShowPartitions"),
84 "FAIpackageList" => array("IMG"=> "plugins/fai/images/fai_packages.png",
85 "NAME"=>_("Package list") , "KZL"=> "PL", "VAR"=>"ShowPackages"),
86 "FAIscript" => array("IMG"=> "plugins/fai/images/fai_script.png",
87 "NAME"=>_("Scripts") , "KZL"=> "S", "VAR"=>"ShowScripts"),
88 "FAIvariable" => array("IMG"=> "plugins/fai/images/fai_variable.png",
89 "NAME"=>_("Variables") , "KZL"=> "V", "VAR"=>"ShowVariables"),
90 "FAIhook" => array("IMG"=> "plugins/fai/images/fai_hook.png",
91 "NAME"=>_("Hooks"), "KZL"=> "H", "VAR"=>"ShowHooks"),
92 "FAIprofile" => array("IMG"=> "plugins/fai/images/fai_profile.png",
93 "NAME"=>_("Profile") , "KZL"=> "P", "VAR"=>"ShowProfiles"),
94 "FAItemplate" => array("IMG"=> "plugins/fai/images/fai_template.png",
95 "NAME"=>_("Templates") , "KZL"=> "T", "VAR"=>"ShowTemplates"),
96 "opsi_netboot" => array("IMG"=> "plugins/opsi/images/netboot_package.png",
97 "NAME"=>_("OPSI netboot product") , "KZL"=> "ON", "VAR"=>"ShowOpsiNetboot"),
98 "opsi_local" => array("IMG"=> "plugins/opsi/images/local_package.png",
99 "NAME"=>_("OPSI local product") , "KZL"=> "OL", "VAR"=>"ShowOpsiLocal"));
100 return($objects);
101 }
102 }
109 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
110 ?>