3 * Bacula® - The Network Backup Solution
4 * Baculum - Bacula web interface
6 * Copyright (C) 2013-2014 Marcin Haba
8 * The main author of Baculum is Marcin Haba.
9 * The main author of Bacula is Kern Sibbald, with contributions from many
10 * others, a complete list can be found in the file AUTHORS.
12 * You may use this file and others of this release according to the
13 * license defined in the LICENSE file, which includes the Affero General
14 * Public License, v3.0 ("AGPLv3") and some additional permissions and
15 * terms pursuant to its AGPLv3 Section 7.
17 * Bacula® is a registered trademark of Kern Sibbald.
20 Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');
21 Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
22 Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
23 Prado::using('System.Web.UI.ActiveControls.TActivePanel');
24 Prado::using('System.Web.UI.ActiveControls.TCallback');
25 Prado::using('Application.Portlets.ISlideWindow');
26 Prado::using('Application.Portlets.Portlets');
28 class JobList extends Portlets implements ISlideWindow {
37 public function setID($id) {
41 public function getID($hideAutoID = true) {
45 public function setButtonID($id) {
46 $this->buttonID = $id;
49 public function getButtonID() {
50 return $this->buttonID;
53 public function setWindowTitle($param) {
54 $this->windowTitle = $param;
57 public function getWindowTitle() {
58 return $this->windowTitle;
61 public function onLoad($param) {
62 parent::onLoad($param);
64 $misc = $this->Application->getModule('misc');
65 $this->jobLevels = $misc->getJobLevels();
66 $this->jobStates = $misc->getJobState();
67 $this->jobTypes = $misc->getJobType();
70 public function prepareData($forceReload = false) {
71 $allowedButtons = array('JobBtn', 'ReloadJobs', 'Run');
72 if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
73 if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
74 $params = $this->getUrlParams('jobs', $this->getPage()->JobWindow->ID);
75 $jobs = $this->Application->getModule('api')->get($params);
76 $isDetailView = $_SESSION['view' . $this->getPage()->JobWindow->ID] == 'details';
77 if($isDetailView === true) {
78 $this->RepeaterShow->Visible = false;
79 $this->DataGridShow->Visible = true;
80 $this->DataGrid->DataSource = $this->Application->getModule('misc')->objectToArray($jobs->output);
81 $this->DataGrid->dataBind();
83 $this->RepeaterShow->Visible = true;
84 $this->DataGridShow->Visible = false;
85 $this->Repeater->DataSource = $jobs->output;
86 $this->Repeater->dataBind();
92 public function sortDataGrid($sender, $param) {
93 $params = $this->getUrlParams('jobs', $this->getPage()->JobWindow->ID);
94 $data = $this->Application->getModule('api')->get($params)->output;
95 $data = $this->Application->getModule('misc')->objectToArray($data);
96 $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
97 $this->DataGrid->dataBind();
100 public function configure($sender, $param) {
101 if($this->Page->IsCallBack) {
102 $this->getPage()->JobConfiguration->configure($param->CallbackParameter);
106 public function executeAction($action) {
107 $params = explode(';', $this->CheckedValues->Value);
111 for($i = 0; $i < count($params); $i++) {
112 $cmd = array('delete');
113 $cmd[] = 'jobid="' . $params[$i] . '"';
116 $commands[] = implode(' ', $cmd);
118 $this->getPage()->Console->CommandLine->Text = implode(' ', $commands);
119 $this->getPage()->Console->sendCommand(null, null);
123 $this->CheckedValues->Value = "";