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
2012-11-26 16:57:18 +11:00

71 lines
1.9 KiB
PHP

<?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 {
/**
* Default Index for Controller
*/
public function action_index() {
$so = ORM::factory('stgpool');
$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,
));
}
public function action_detail($stgpool=NULL) {
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.'),
));
HTTP::redirect('stgpool');
}
$so = ORM::factory('stgpool',$stgpool);
if (! $so->loaded()) {
SystemMessage::add(array(
'title'=>_('Unknown STGPOOL_NAME'),
'type'=>'error',
'body'=>sprintf(_('The stgpool pool [%s] does not exist?.'),$stgpool),
));
HTTP::redirect('stgpool');
}
Block::add(array(
'title'=>sprintf(_('Storage Pool Information for %s'),$so->STGPOOL_NAME),
'body'=>View::factory('stgpool/detail')->set('so',$so)
));
}
}
?>