3 * Bacula(R) - The Network Backup Solution
4 * Baculum - Bacula web interface
6 * Copyright (C) 2013-2015 Marcin Haba
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.TActiveRepeater');
24 Prado::using('Application.Portlets.ISlideWindow');
25 Prado::using('Application.Portlets.Portlets');
27 class StorageList extends Portlets implements ISlideWindow {
33 public function setID($id) {
37 public function getID($hideAutoID = true) {
41 public function setButtonID($id) {
42 $this->buttonID = $id;
45 public function getButtonID() {
46 return $this->buttonID;
49 public function setWindowTitle($param) {
50 $this->windowTitle = $param;
53 public function getWindowTitle() {
54 return $this->windowTitle;
57 public function onLoad($param) {
58 parent::onLoad($param);
62 public function prepareData($forceReload = false) {
63 $allowedButtons = array('StorageBtn');
64 if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
65 if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
66 $params = $this->getUrlParams('storages', $this->getPage()->StorageWindow->ID);
67 $storages = $this->Application->getModule('api')->get($params);
68 $isDetailView = $_SESSION['view' . $this->getPage()->StorageWindow->ID] == 'details';
69 if($isDetailView === true) {
70 $this->RepeaterShow->Visible = false;
71 $this->DataGridShow->Visible = true;
72 $this->DataGrid->DataSource = $this->Application->getModule('misc')->objectToArray($storages->output);
73 $this->DataGrid->dataBind();
75 $this->RepeaterShow->Visible = true;
76 $this->DataGridShow->Visible = false;
77 $this->Repeater->DataSource = $storages->output;
78 $this->Repeater->dataBind();
84 public function sortDataGrid($sender, $param) {
85 $params = $this->getUrlParams('storages', $this->getPage()->StorageWindow->ID);
86 $data = $this->Application->getModule('api')->get($params)->output;
87 $data = $this->Application->getModule('misc')->objectToArray($data);
88 $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
89 $this->DataGrid->dataBind();
92 public function configure($sender, $param) {
93 if($this->Page->IsCallBack) {
94 $this->getPage()->StorageConfiguration->configure($param->CallbackParameter);