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/node.php

88 lines
2.4 KiB
PHP
Raw Normal View History

2011-04-07 05:03:05 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides information on TSM Nodes.
*
* @package PTA
* @subpackage Nodes
* @category Controllers
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Controller_NODE extends Controller_TemplateDefault {
/**
* Default Index for Controller
*/
public function action_index() {
$no = ORM::factory('node');
$output = '';
2011-05-29 09:33:32 +00:00
$output .= sprintf(_('This server has <b>%s</b> defined nodes.'),$no->cached(0)->count_all());
2011-04-07 05:03:05 +00:00
$output .= '<br/>';
$output .= '<br/>';
$select = array();
$select[NULL] = '';
foreach ($no->find_all() as $node)
$select[$node->NODE_NAME] = $node->NODE_NAME;
$output .= Form::open('/node/detail',array('id'=>'node_detail'));
$output .= sprintf('%s: %s',_('Choose a new to view'),Form::select('node_name',$select,NULL,array('id'=>'node_name')));
$output .= Form::submit('form_submit',_('Go'));
$output .= Form::close();
Script::add(array(
'type'=>'stdin',
'data'=>'
$(document).ready(function () {$("#node_name").change(function () {
$("#node_detail").trigger("submit");
});});'
));
Block::add(array(
'title'=>_('TSM Nodes'),
'body'=>$output,
));
}
public function action_detail($node_name=NULL) {
if (is_null($node_name) AND (empty($_POST['node_name']) OR ! $node_name = $_POST['node_name']))
throw new Kohana_Exception('Missing NODE_NAME');
$no = ORM::factory('node',$node_name);
Block::add(array(
'title'=>sprintf('%s %s',_('Detailed Node Information for'),$no->NODE_NAME),
2011-05-30 09:27:08 +00:00
'body'=>View::factory('nodes/detail')->set('node',$no),
2011-04-07 05:03:05 +00:00
));
Block::add(array(
'title'=>_('Protected File System Information'),
2011-05-30 09:27:08 +00:00
'body'=>View::factory('nodes/detail_filesystem')->set('node',$no),
2011-04-07 05:03:05 +00:00
));
Block::add(array(
'title'=>_('Sequential Volume Usage Information'),
2011-05-30 09:27:08 +00:00
'body'=>View::factory('nodes/detail_volumes')->set('node',$no),
));
Block::add(array(
'title'=>_('Schedule Information'),
2011-05-30 09:27:08 +00:00
'body'=>View::factory('nodes/detail_schedule')->set('node',$no),
));
2011-04-07 05:03:05 +00:00
}
2011-05-30 09:27:08 +00:00
public function action_summary() {
$do = ORM::factory('domain');
foreach ($do->find_all() as $domain)
Block::add(array(
'title'=>_('Node Information by Domain'),
'body'=>View::factory('nodes/summary')->set('do',$domain)
));
}
2011-04-07 05:03:05 +00:00
}
?>