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.TActiveRepeater');
\r
21 Prado::using('Application.Portlets.Portlets');
\r
23 class StorageList extends Portlets {
25 public $ShowID, $windowTitle;
\r
27 public function onLoad($param) {
28 parent::onLoad($param);
\r
29 $this->prepareData();
\r
32 public function setWindowTitle($param) {
33 $this->windowTitle = $param;
36 public function prepareData($forceReload = false) {
37 $allowedButtons = array('StorageBtn');
\r
38 if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
\r
39 if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
\r
40 $params = $this->getUrlParams('storages', $this->getPage()->StorageWindow->ID);
\r
41 $storages = $this->Application->getModule('api')->get($params);
\r
42 $isDetailView = $_SESSION['view' . $this->getPage()->StorageWindow->ID] == 'details';
\r
43 $this->RepeaterShow->Visible = !$isDetailView;
\r
44 $this->Repeater->DataSource = $isDetailView === false ? $storages->output : array();
\r
45 $this->Repeater->dataBind();
\r
46 $this->DataGridShow->Visible = $isDetailView;
\r
47 $this->DataGrid->DataSource = $isDetailView === true ? $this->Application->getModule('misc')->objectToArray($storages->output) : array();
\r
48 $this->DataGrid->dataBind();
\r
53 public function sortDataGrid($sender, $param) {
\r
54 $params = $this->getUrlParams('storages', $this->getPage()->StorageWindow->ID);
\r
55 $data = $this->Application->getModule('api')->get($params)->output;
\r
56 $data = $this->Application->getModule('misc')->objectToArray($data);
\r
57 $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
\r
58 $this->DataGrid->dataBind();
\r
61 public function setShowID($ShowID) {
\r
62 $this->ShowID = $this->getMaster()->ShowID = $ShowID;
\r
65 public function getShowID() {
\r
66 return $this->ShowID;
\r
69 public function configure($sender, $param) {
\r
70 if($this->Page->IsCallBack) {
\r
71 $this->getPage()->StorageConfiguration->configure($param->CallbackParameter);
\r