Files
majestic/classes/PageController.class.php
pzinovkin cc370fa98e database errors handling
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@51 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
2009-01-22 15:07:34 +00:00

46 lines
1.2 KiB
PHP

<?php
/**
*
*
* @copyright
* @link
* @package Majestic
* @subpackage PageController
* @since
* @version SVN: $Id$
* @filesource $URL$
*/
final class PageController
{
/**
* Вывод в браузер всего сайта.
*
*/
public function display()
{
try {
try{
$this->route = Load::router()->proccess(MJ_PATH);
$action = new $this->route->action;
$decorator = new $this->route->decorator;
return $decorator->display($action);
} catch (MJException $e) {
return $e->terminate();
}
} catch (DynamicPageException $e) {
$decorator_name = DEFAULT_DECORATOR;
$decorator = new $decorator_name;
$action_name = $e->getMessage();
return $decorator->display(new $action_name);
} catch (StaticPageException $e) {
$decorator_name = DEFAULT_DECORATOR;
$decorator = new $decorator_name;
$action_name = DEFAULT_ACTION;
return $decorator->display(new $action_name($e->getMessage()));
} catch (Exception $e) {
return $e->getMessage();
}
}
}
?>