parent = $parent; $this->ui = get_userinfo(); $this->SetSummary(_("List of queued deamon jobs.")); $this->SetHeadpageMode(); $this->EnableCloseButton(FALSE); $this->EnableSaveButton(FALSE); $this->SetInformation(_("This menu allows you to remove and change the properties of GOsa deamon tasks.")); foreach($this->parent->get_actions() as $name => $desc){ $this->$name = TRUE; $this->AddCheckBox($name,sprintf(_("Display entries with action %s."),$desc), sprintf(_("Display entries with action %s."),$desc),TRUE); } $plug = $_GET['plug']; /* Toggle all selected / deselected */ $chk = ""; /* set Page header */ $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'")); $this->AddHeader(array("string"=>""._("#")."", "attach"=>"style='width:20px;'")); $this->AddHeader(array("string"=>""._("Target")." / ". ""._("Task")."")); $this->AddHeader(array("string"=>""._("Schedule")."", "attach"=>"style='width:100px;'")); $this->AddHeader(array("string"=>""._("Status")."", "attach"=>"style='width:80px;'")); $this->AddHeader(array("string"=>_("Action"), "attach"=>"style='border-right:0px;width:120px;'")); } function GenHeader() { /* Display add button if allowed */ $header = "
"; # if($this->parent->acl_is_createable()){ # $header .= " "; # } /* Display remove button if allowed */ if($this->parent->acl_is_removeable()){ $header .= " "; } /* Add priority options */ if(preg_match("/w/",$this->parent->getacl(""))){ $header .= " "; $header .= " "; } $header .= "
"; /* Create divlist */ $this->SetListHeader($header); } function execute() { $this->ClearElementsList(); $this->GenHeader(); } function setEntries($tasks) { /* Create edit link */ $plug = $_GET['plug']; # $edit_link = "
%str%
"; $edit_link = "%str%"; /* Create action filter array, to sort out those actions we do not want to see */ $allowed_action = array(); foreach($this->parent->get_actions() as $name => $desc){ if($this->$name){ $allowed_action[] = $name; } } $colors[0] = "#DDDDDD"; $colors[1] = "#EEEEEE"; $c_keys = array(); $last_c = 0; if($this->parent->sort_dir=="down"){ $last_c = !$last_c; } foreach($tasks as $key => $task){ $color = ""; /* Skip unchecked actions */ # if(!in_array($task['Action'],$allowed_action)){ # continue; # } /* Create actions */ $id = $task['ID']; $queue_pos = $id; $prio_actions = " "; $prio_actions.= " "; $action = ""; if($this->parent->acl_is_removeable()){ $action.= ""; } $display = preg_replace(array("/%id%/","/%str%/"),array($id,$task['MACADDRESS']),$edit_link); $display2= $task['HEADERTAG']; /* Create each field */ $field0 = array("string" => "" , "attach" => "style='width:20px;".$color."'"); $field0a= array("string" => $queue_pos ,"attach" => "style='width:20px;".$color."'"); $field1 = array("string" => $display, "attach" => "style='".$color."'"); $field1a= array("string" => $display2, "attach" => "style='".$color.";width:80px;'"); $field2 = array("string" => $this->stamp_to_date($task['TIMESTAMP']),"attach" => "style='".$color.";width:100px;'"); $field3 = array("string" => $task['STATUS'],"attach" => "style='".$color.";width:80px;'"); $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;border-right:0px;'"); $this->AddElement(array($field0,$field0a,$field1,$field1a,$field2,$field3,$field4)); } } function stamp_to_date($stamp) { return(date("d.m.Y H:i:s",strtotime($stamp))); } function Save() { MultiSelectWindow :: Save(); } function save_object() { /* Save automatic created POSTs like regex, checkboxes */ MultiSelectWindow :: save_object(); } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>