73 lines
1.9 KiB
PHP
73 lines
1.9 KiB
PHP
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
/**
|
|
* This class provides information on TSM attached Libraries.
|
|
*
|
|
* @package PTA
|
|
* @subpackage Libraries
|
|
* @category Controllers
|
|
* @author Deon George
|
|
* @copyright (c) 2010 phpTSMadmin Development Team
|
|
* @license http://phptsmadmin.sf.net/license.html
|
|
*/
|
|
class Controller_Library extends Controller_TemplateDefault {
|
|
/**
|
|
* Default Index for Controller
|
|
*/
|
|
public function action_index() {
|
|
$lo = ORM::factory('LIBRARY');
|
|
$output = '';
|
|
|
|
$output .= sprintf(_('This server has <b>%s</b> libraries.'),$lo->count_all());
|
|
$output .= '<br/>';
|
|
$output .= '<br/>';
|
|
|
|
$select = array();
|
|
$select[NULL] = '';
|
|
|
|
foreach ($lo->find_all() as $library)
|
|
$select[$library->LIBRARY_NAME] = $library->LIBRARY_NAME;
|
|
|
|
$output .= Form::open('/library/detail',array('id'=>'library_detail'));
|
|
$output .= sprintf('%s: %s',_('Choose a storage pool to view'),Form::select('library_name',$select,NULL,array('id'=>'library_name')));
|
|
$output .= Form::submit('form_submit',_('Go'));
|
|
$output .= Form::close();
|
|
|
|
Block::add(array(
|
|
'title'=>_('TSM Libraries'),
|
|
'body'=>$output,
|
|
));
|
|
}
|
|
|
|
public function action_detail() {
|
|
$library = $this->request->param('id');
|
|
|
|
if (is_null($library) AND (empty($_POST['library_name']) OR ! $library = $_POST['library_name'])) {
|
|
SystemMessage::add(array(
|
|
'title'=>_('LIBRARY_NAME is required'),
|
|
'type'=>'error',
|
|
'body'=>_('The library pool name is required.'),
|
|
));
|
|
|
|
HTTP::redirect('library');
|
|
}
|
|
|
|
$lo = ORM::factory('LIBRARY',$library);
|
|
if (! $lo->loaded()) {
|
|
SystemMessage::add(array(
|
|
'title'=>_('Unknown LIBRARY_NAME'),
|
|
'type'=>'error',
|
|
'body'=>sprintf(_('The library pool [%s] does not exist?.'),$library),
|
|
));
|
|
|
|
HTTP::redirect('library');
|
|
}
|
|
|
|
Block::add(array(
|
|
'title'=>sprintf(_('Library Information for %s'),$lo->LIBRARY_NAME),
|
|
'body'=>View::factory('library/detail')->set('o',$lo)
|
|
));
|
|
}
|
|
}
|
|
?>
|