2008-12-02 09:03:33 +00:00
|
|
|
<?php
|
2008-12-05 13:32:38 +00:00
|
|
|
/**
|
|
|
|
*
|
2008-12-16 12:47:17 +00:00
|
|
|
*
|
|
|
|
* @copyright
|
|
|
|
* @link
|
2008-12-05 13:32:38 +00:00
|
|
|
* @package Majestic
|
|
|
|
* @subpackage PageController
|
2008-12-16 12:47:17 +00:00
|
|
|
* @since
|
2008-12-05 13:32:38 +00:00
|
|
|
* @version SVN: $Id$
|
|
|
|
* @filesource $URL$
|
2008-12-03 09:28:49 +00:00
|
|
|
*/
|
2008-12-02 09:03:33 +00:00
|
|
|
final class PageController
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Вывод в браузер всего сайта.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function display()
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
$this->route = Load::router()->proccess(MJ_PATH);
|
2008-12-16 12:47:17 +00:00
|
|
|
$action = new $this->route->action;
|
2008-12-02 09:03:33 +00:00
|
|
|
$decorator = new $this->route->decorator;
|
2008-12-16 12:47:17 +00:00
|
|
|
return $decorator->display($action);
|
2008-12-02 09:03:33 +00:00
|
|
|
} catch (MJException $e) {
|
|
|
|
return $e->terminate();
|
2008-12-18 16:12:06 +00:00
|
|
|
} catch (DynamicPageException $e) {
|
2008-12-02 09:03:33 +00:00
|
|
|
$decorator_name = DEFAULT_DECORATOR;
|
|
|
|
$decorator = new $decorator_name;
|
2008-12-18 16:12:06 +00:00
|
|
|
$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;
|
2008-12-02 09:03:33 +00:00
|
|
|
return $decorator->display(new $action_name($e->getMessage()));
|
2008-12-18 16:12:06 +00:00
|
|
|
} catch (Exception $e) {
|
|
|
|
return $e->getMessage();
|
2008-12-02 09:03:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|