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('System.Web.UI.ActiveControls.TActiveDataGrid');
\r
22 Prado::using('Application.Portlets.Portlets');
\r
24 class ClientList extends Portlets {
26 public $ShowID, $windowTitle;
\r
28 public function onLoad($param) {
29 parent::onLoad($param);
\r
30 $this->prepareData();
\r
33 public function setWindowTitle($param) {
\r
34 $this->windowTitle = $param;
\r
37 public function prepareData($forceReload = false) {
\r
38 $allowedButtons = array('ClientBtn', 'ReloadClients');
39 if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
\r
40 if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
\r
41 $params = $this->getUrlParams('clients', $this->getPage()->ClientWindow->ID);
\r
42 $clients = $this->Application->getModule('api')->get($params);
\r
43 $isDetailView = $this->Session['view' . $this->getPage()->ClientWindow->ID] == 'details';
\r
44 $clientsList = $this->Application->getModule('misc')->objectToArray($clients->output);
\r
45 $this->RepeaterShow->Visible = !$isDetailView;
\r
46 $this->Repeater->DataSource = $isDetailView === false ? $clientsList : array();
\r
47 $this->Repeater->dataBind();
\r
48 $this->DataGridShow->Visible = $isDetailView;
\r
49 $this->DataGrid->DataSource = $isDetailView === true ? $clientsList : array();
\r
50 $this->DataGrid->dataBind();
\r
55 public function sortDataGrid($sender, $param) {
\r
56 $params = $this->getUrlParams('clients', $this->getPage()->ClientWindow->ID);
\r
57 $data = $this->Application->getModule('api')->get($params)->output;
\r
58 $data = $this->Application->getModule('misc')->objectToArray($data);
\r
59 $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
\r
60 $this->DataGrid->dataBind();
\r
64 public function setShowID($ShowID) {
\r
65 $this->ShowID = $this->getMaster()->ShowID = $ShowID;
\r
68 public function getShowID() {
\r
69 return $this->ShowID;
\r
72 public function configure($sender, $param) {
\r
73 if($this->Page->IsCallBack) {
\r
74 $this->getPage()->ClientConfiguration->configure($param->CallbackParameter);
\r