2011-05-31 14:51:15 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides information on TSM Nodes.
|
|
|
|
*
|
|
|
|
* @package PTA
|
|
|
|
* @subpackage Domains
|
|
|
|
* @category Controllers
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2010 phpTSMadmin Development Team
|
|
|
|
* @license http://phptsmadmin.sf.net/license.html
|
|
|
|
*/
|
2012-11-27 01:26:56 +00:00
|
|
|
class Controller_Domain extends Controller_TemplateDefault {
|
2011-05-31 14:51:15 +00:00
|
|
|
/**
|
|
|
|
* Default Index for Controller
|
|
|
|
*/
|
|
|
|
public function action_index() {
|
2012-11-27 01:26:56 +00:00
|
|
|
$do = ORM::factory('DOMAIN');
|
2011-05-31 14:51:15 +00:00
|
|
|
$output = '';
|
|
|
|
|
|
|
|
$output .= sprintf(_('This server has <b>%s</b> domains.'),$do->count_all());
|
|
|
|
$output .= '<br/>';
|
|
|
|
$output .= '<br/>';
|
|
|
|
|
|
|
|
$select = array();
|
|
|
|
$select[NULL] = '';
|
|
|
|
|
|
|
|
foreach ($do->find_all() as $domain)
|
|
|
|
$select[$domain->DOMAIN_NAME] = $domain->DOMAIN_NAME;
|
|
|
|
|
|
|
|
$output .= Form::open('/domain/detail',array('id'=>'domain_detail'));
|
|
|
|
$output .= sprintf('%s: %s',_('Choose a domain to view'),Form::select('domain_name',$select,NULL,array('id'=>'domain_name')));
|
|
|
|
$output .= Form::submit('form_submit',_('Go'));
|
|
|
|
$output .= Form::close();
|
|
|
|
|
|
|
|
Block::add(array(
|
|
|
|
'title'=>_('TSM Domains'),
|
|
|
|
'body'=>$output,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function action_detail($domain_name=NULL) {
|
|
|
|
if (is_null($domain_name) AND (empty($_POST['domain_name']) OR ! $domain_name = $_POST['domain_name'])) {
|
|
|
|
SystemMessage::add(array(
|
|
|
|
'title'=>_('DOMAIN_NAME is required'),
|
|
|
|
'type'=>'error',
|
|
|
|
'body'=>_('The domain name is required.'),
|
|
|
|
));
|
|
|
|
|
2012-11-26 05:57:18 +00:00
|
|
|
HTTP::redirect('domain');
|
2011-05-31 14:51:15 +00:00
|
|
|
}
|
|
|
|
|
2012-11-27 01:26:56 +00:00
|
|
|
$do = ORM::factory('DOMAIN',$domain_name);
|
2011-05-31 14:51:15 +00:00
|
|
|
if (! $do->loaded()) {
|
|
|
|
SystemMessage::add(array(
|
|
|
|
'title'=>_('Unknown DOMAIN_NAME'),
|
|
|
|
'type'=>'error',
|
|
|
|
'body'=>sprintf(_('The domain [%s] does not exist?.'),$domain_name),
|
|
|
|
));
|
|
|
|
|
2012-11-26 05:57:18 +00:00
|
|
|
HTTP::redirect('domain');
|
2011-05-31 14:51:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Block::add(array(
|
|
|
|
'title'=>sprintf(_('Node Information for Domain %s'),$do->DOMAIN_NAME),
|
|
|
|
'body'=>View::factory('domain/detail')->set('do',$do)
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|