3 * Bacula® - The Network Backup Solution
\r
4 * Baculum - Bacula web interface
\r
6 * Copyright (C) 2013-2014 Marcin Haba
\r
8 * The main author of Baculum is Marcin Haba.
\r
9 * The main author of Bacula is Kern Sibbald, with contributions from many
\r
10 * others, a complete list can be found in the file AUTHORS.
\r
12 * You may use this file and others of this release according to the
\r
13 * license defined in the LICENSE file, which includes the Affero General
\r
14 * Public License, v3.0 ("AGPLv3") and some additional permissions and
\r
15 * terms pursuant to its AGPLv3 Section 7.
\r
17 * Bacula® is a registered trademark of Kern Sibbald.
\r
20 Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');
\r
21 Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
\r
22 Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
\r
23 Prado::using('System.Web.UI.ActiveControls.TActivePanel');
\r
24 Prado::using('System.Web.UI.ActiveControls.TCallback');
\r
25 Prado::using('Application.Portlets.Portlets');
\r
27 class JobRunList extends Portlets {
29 public $ShowID, $windowTitle, $oldDirector;
\r
31 private $jobTypes = array('B' => 'Backup', 'M' => 'Migrated', 'V' => 'Verify', 'R' => 'Restore', 'I' => 'Internal', 'D' => 'Admin', 'A' => 'Archive', 'C' => 'Copy', 'g' => 'Migration');
\r
35 public function onLoad($param) {
36 parent::onLoad($param);
\r
37 $this->prepareData();
\r
40 public function setWindowTitle($param) {
\r
41 $this->windowTitle = $param;
\r
44 public function prepareData($forceReload = false) {
\r
45 $allowedButtons = array('JobRunBtn');
\r
46 if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
\r
47 if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
\r
48 $params = $this->getUrlParams(array('jobs', 'tasks'), $this->getPage()->JobRunWindow->ID);
\r
49 $jobTasks = $this->Application->getModule('api')->get($params)->output;
\r
50 $jobs = $this->prepareJobs($jobTasks);
\r
51 $isDetailView = $this->Session['view' . $this->getPage()->JobRunWindow->ID] == 'details';
\r
52 $this->RepeaterShow->Visible = !$isDetailView;
\r
53 $this->Repeater->DataSource = $isDetailView === false ? $jobs : array();
\r
54 $this->Repeater->dataBind();
\r
55 $this->DataGridShow->Visible = $isDetailView;
\r
56 $this->DataGrid->DataSource = $isDetailView === true ? $jobs : array();
\r
57 $this->DataGrid->dataBind();
\r
62 private function prepareJobs($jobTasks) {
64 foreach($jobTasks as $director => $tasks) {
\r
65 for($i = 0; $i < count($tasks); $i++) {
\r
66 $jobs[] = array('name' => $tasks[$i], 'director' => $director);
\r
72 public function sortDataGrid($sender, $param) {
\r
73 $params = $this->getUrlParams(array('jobs', 'tasks'), $this->getPage()->JobRunWindow->ID);
\r
74 $data = $this->Application->getModule('api')->get($params)->output;
\r
75 $data = $this->prepareJobs($data);
\r
76 $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
\r
77 $this->DataGrid->dataBind();
\r
80 public function setShowID($ShowID) {
\r
81 $this->ShowID = $this->getMaster()->ShowID = $ShowID;
\r
84 public function getShowID() {
\r
85 return $this->ShowID;
\r
88 public function configure($sender, $param) {
\r
89 if($this->Page->IsCallBack) {
\r
90 $this->getPage()->JobRunConfiguration->configure($param->CallbackParameter);
\r