3 * Bacula(R) - The Network Backup Solution
4 * Baculum - Bacula web interface
6 * Copyright (C) 2013-2016 Kern Sibbald
8 * The main author of Baculum is Marcin Haba.
9 * The original author of Bacula is Kern Sibbald, with contributions
10 * from many 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 * This notice must be preserved when any source code is
18 * conveyed and/or propagated.
20 * Bacula(R) is a registered trademark of Kern Sibbald.
23 Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');
24 Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
25 Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
26 Prado::using('System.Web.UI.ActiveControls.TActivePanel');
27 Prado::using('System.Web.UI.ActiveControls.TCallback');
28 Prado::using('Application.Portlets.ISlideWindow');
29 Prado::using('Application.Portlets.Portlets');
31 class JobRunList extends Portlets implements ISlideWindow {
38 private $jobTypes = array(
50 public function setID($id) {
54 public function getID($hideAutoID = true) {
58 public function setButtonID($id) {
59 $this->buttonID = $id;
62 public function getButtonID() {
63 return $this->buttonID;
66 public function setWindowTitle($param) {
67 $this->windowTitle = $param;
70 public function getWindowTitle() {
71 return $this->windowTitle;
74 public function onLoad($param) {
75 parent::onLoad($param);
79 public function prepareData($forceReload = false) {
80 $allowedButtons = array('JobRunBtn');
81 if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
82 if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
83 $params = $this->getUrlParams(array('jobs', 'tasks'), $this->getPage()->JobRunWindow->ID);
84 $jobTasks = $this->Application->getModule('api')->get($params)->output;
85 $jobs = $this->prepareJobs($jobTasks);
86 $isDetailView = $_SESSION['view' . $this->getPage()->JobRunWindow->ID] == 'details';
88 if($isDetailView === true) {
89 $this->RepeaterShow->Visible = false;
90 $this->DataGridShow->Visible = true;
91 $this->DataGrid->DataSource = $jobs;
92 $this->DataGrid->dataBind();
94 $this->RepeaterShow->Visible = true;
95 $this->DataGridShow->Visible = false;
96 $this->Repeater->DataSource = $jobs;
97 $this->Repeater->dataBind();
103 private function prepareJobs($jobTasks) {
105 foreach($jobTasks as $director => $tasks) {
106 for($i = 0; $i < count($tasks); $i++) {
107 $jobs[] = array('name' => $tasks[$i], 'director' => $director);
113 public function sortDataGrid($sender, $param) {
114 $params = $this->getUrlParams(array('jobs', 'tasks'), $this->getPage()->JobRunWindow->ID);
115 $data = $this->Application->getModule('api')->get($params)->output;
116 $data = $this->prepareJobs($data);
117 $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
118 $this->DataGrid->dataBind();
121 public function configure($sender, $param) {
122 if($this->Page->IsCallBack) {
123 $this->getPage()->JobRunConfiguration->configure($param->CallbackParameter);