This repository has been archived by the owner on Mar 19, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Client Controller and Model refactored. - Storage Controller and Model refactored. - Pool Controller and Model refactored. - Fileset Controller and Model refactored. - Director Controller and Model refactored. - Media Controller and Model refactored. - Dashboard Controller and Model refactored. - Job Controller and Model refactored. - Restore Controller and Model refactored. Signed-off-by: Frank Bergkemper <frank.bergkemper@dass-it.de>
- Loading branch information
1 parent
9dc12d5
commit a3be545
Showing
36 changed files
with
1,162 additions
and
826 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
|
||
/** | ||
* | ||
* bareos-webui - Bareos Web-Frontend | ||
* | ||
* @link https://github.com/bareos/bareos-webui for the canonical source repository | ||
* @copyright Copyright (c) 2013-2015 Bareos GmbH & Co. KG (http://www.bareos.org/) | ||
* @license GNU Affero General Public License (http://www.gnu.org/licenses/) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
namespace Client\Model; | ||
|
||
use Zend\ServiceManager\ServiceLocatorAwareInterface; | ||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
class ClientModel implements ServiceLocatorAwareInterface | ||
{ | ||
protected $serviceLocator; | ||
protected $director; | ||
|
||
public function __construct() | ||
{ | ||
} | ||
|
||
public function setServiceLocator(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
$this->serviceLocator = $serviceLocator; | ||
} | ||
|
||
public function getServiceLocator() | ||
{ | ||
return $this->serviceLocator; | ||
} | ||
|
||
public function getClients() | ||
{ | ||
$cmd = 'llist clients'; | ||
$this->director = $this->getServiceLocator()->get('director'); | ||
$result = $this->director->send_command($cmd, 2, null); | ||
$clients = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY); | ||
return $clients['result']['clients']; | ||
} | ||
|
||
public function getClient($client=null) | ||
{ | ||
if(isset($client)) { | ||
$cmd = 'llist client="'.$client.'"'; | ||
$this->director = $this->getServiceLocator()->get('director'); | ||
$result = $this->director->send_command($cmd, 2, null); | ||
$client = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY); | ||
return $client['result']['clients'][0]; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
|
||
public function getClientBackups($client=null, $limit=null, $order=null) | ||
{ | ||
if(isset($client, $limit, $order)) { | ||
$cmd = 'llist backups client="'.$client.'" limit='.$limit.' order='.$order.''; | ||
$this->director = $this->getServiceLocator()->get('director'); | ||
$result = $this->director->send_command($cmd, 2, null); | ||
if(preg_match("/Select/", $result)) { | ||
return null; | ||
} | ||
else { | ||
$backups = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY); | ||
return $backups['result']['backups']; | ||
} | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.