This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/application/classes/Controller/Stgpool.php

73 lines
2.0 KiB
PHP
Raw Normal View History

2011-06-23 07:03:41 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides information on TSM Storage Pools.
*
* @package PTA
* @subpackage Storage Pools
* @category Controllers
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Controller_Stgpool extends Controller_TemplateDefault {
2011-06-23 07:03:41 +00:00
/**
* Default Index for Controller
*/
public function action_index() {
$so = ORM::factory('STGPOOL');
2011-06-23 07:03:41 +00:00
$output = '';
$output .= sprintf(_('This server has <b>%s</b> stgpool pools.'),$so->count_all());
$output .= '<br/>';
$output .= '<br/>';
$select = array();
$select[NULL] = '';
foreach ($so->find_all() as $stgpool)
$select[$stgpool->STGPOOL_NAME] = $stgpool->STGPOOL_NAME;
$output .= Form::open('/stgpool/detail',array('id'=>'stgpool_detail'));
$output .= sprintf('%s: %s',_('Choose a storage pool to view'),Form::select('stgpool_name',$select,NULL,array('id'=>'stgpool_name')));
$output .= Form::submit('form_submit',_('Go'));
$output .= Form::close();
Block::add(array(
'title'=>_('TSM Storage Pools'),
'body'=>$output,
));
}
2012-11-27 05:46:43 +00:00
public function action_detail() {
$stgpool = $this->request->param('id');
2011-06-23 07:03:41 +00:00
if (is_null($stgpool) AND (empty($_POST['stgpool_name']) OR ! $stgpool = $_POST['stgpool_name'])) {
SystemMessage::add(array(
'title'=>_('STGPOOL_NAME is required'),
'type'=>'error',
'body'=>_('The stgpool pool name is required.'),
));
2012-11-26 05:57:18 +00:00
HTTP::redirect('stgpool');
2011-06-23 07:03:41 +00:00
}
$so = ORM::factory('STGPOOL',$stgpool);
2011-06-23 07:03:41 +00:00
if (! $so->loaded()) {
SystemMessage::add(array(
'title'=>_('Unknown STGPOOL_NAME'),
'type'=>'error',
'body'=>sprintf(_('The stgpool pool [%s] does not exist?.'),$stgpool),
));
2012-11-26 05:57:18 +00:00
HTTP::redirect('stgpool');
2011-06-23 07:03:41 +00:00
}
Block::add(array(
'title'=>sprintf(_('Storage Pool Information for %s'),$so->STGPOOL_NAME),
'body'=>View::factory('stgpool/detail')->set('so',$so)
));
}
}
?>