* @link * @package Majestic * @subpackage PageController * @since * @version SVN: $Id$ * @filesource $URL$ */ class PageController { /** * Действия на инициализацию. * */ protected function init() {} /** * Вывод в браузер всего сайта. * */ public function display() { try { $this->init(); 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(); } } } ?>