1 <?php
3 class goto_task extends plugin
4 {
5 /* Definitions */
6 var $plHeadline = "System mass deployment";
7 var $plDescription = "This does something";
9 var $parent = NULL;
10 var $data = array();
12 var $attributes = array("MACADDRESS","ID","STATUS","HEADERTAG");
14 function goto_task(&$config, &$parent, $data = array())
15 {
16 /* Set parent object */
17 $this->parent = &$parent;
18 $this->data = $data;
20 /* Intialize plugin */
21 $this->config = &$config;
22 }
25 function execute()
26 {
27 $smarty = get_smarty();
28 $smarty->assign("Actions",$this->parent->get_actions());
29 foreach($this->attributes as $attr){
30 if(isset($this->data[$attr])){
31 $smarty->assign($attr,$this->data[$attr]);
32 }else{
33 $smarty->assign($attr,"");
34 }
35 }
36 return ($smarty->fetch (get_template_path('goto_task.tpl', TRUE)));
37 }
40 function save_object()
41 {
42 if(isset($_POST['HeaderTag'])){
43 $possible_tags = $this->parent->get_actions();
44 $tag = $_POST['HeaderTag'];
45 if(isset($possible_tags[$tag])){
46 $this->data['HEADERTAG'] = $tag;
47 }
48 }
49 foreach(array("status","macaddress") as $attr){
50 if(isset($_POST[$attr])){
51 $this->data[strtoupper($attr)] = $_POST[$attr];
52 }
53 }
54 }
56 function save()
57 {
58 $tmp = array();
59 foreach(array("STATUS","MACADDRESS","HEADERTAG") as $attr){
60 if(isset($this->data[$attr])){
61 $tmp[$attr] = $this->data[$attr];
62 }
63 }
64 return($tmp);
65 }
66 }
67 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
68 ?>