3 * Bacula® - 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 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.TActiveRepeater');
21 Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');
22 Prado::using('Application.Portlets.ISlideWindow');
23 Prado::using('Application.Portlets.Portlets');
25 class ClientList extends Portlets implements ISlideWindow {
31 public function setID($id) {
35 public function getID($hideAutoID = true) {
39 public function setButtonID($id) {
40 $this->buttonID = $id;
43 public function getButtonID() {
44 return $this->buttonID;
47 public function setWindowTitle($param) {
48 $this->windowTitle = $param;
51 public function getWindowTitle() {
52 return $this->windowTitle;
55 public function onLoad($param) {
56 parent::onLoad($param);
60 public function prepareData($forceReload = false) {
61 $allowedButtons = array('ClientBtn', 'ReloadClients');
62 if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
63 if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
64 $params = $this->getUrlParams('clients', $this->getPage()->ClientWindow->ID);
65 $clients = $this->Application->getModule('api')->get($params);
66 $isDetailView = $_SESSION['view' . $this->getPage()->ClientWindow->ID] == 'details';
67 if($isDetailView === true) {
68 $this->RepeaterShow->Visible = false;
69 $this->DataGridShow->Visible = true;
70 $this->DataGrid->DataSource = $this->Application->getModule('misc')->objectToArray($clients->output);
71 $this->DataGrid->dataBind();
73 $this->RepeaterShow->Visible = true;
74 $this->DataGridShow->Visible = false;
75 $this->Repeater->DataSource = $clients->output;
76 $this->Repeater->dataBind();
82 public function sortDataGrid($sender, $param) {
83 $params = $this->getUrlParams('clients', $this->getPage()->ClientWindow->ID);
84 $data = $this->Application->getModule('api')->get($params)->output;
85 $data = $this->Application->getModule('misc')->objectToArray($data);
86 $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
87 $this->DataGrid->dataBind();
90 public function configure($sender, $param) {
91 if($this->Page->IsCallBack) {
92 $this->getPage()->ClientConfiguration->configure($param->CallbackParameter);