You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB

  1. <?php
  2. /**
  3. *
  4. *
  5. * @copyright
  6. * @link
  7. * @package Majestic
  8. * @subpackage PageController
  9. * @since
  10. * @version SVN: $Id$
  11. * @filesource $URL$
  12. */
  13. final class PageController
  14. {
  15. /**
  16. * Вывод в браузер всего сайта.
  17. *
  18. */
  19. public function display()
  20. {
  21. try {
  22. $this->route = Load::router()->proccess(MJ_PATH);
  23. $action = new $this->route->action;
  24. $decorator = new $this->route->decorator;
  25. return $decorator->display($action);
  26. } catch (MJException $e) {
  27. return $e->terminate();
  28. } catch (DynamicPageException $e) {
  29. $decorator_name = DEFAULT_DECORATOR;
  30. $decorator = new $decorator_name;
  31. $action_name = $e->getMessage();
  32. return $decorator->display(new $action_name);
  33. } catch (StaticPageException $e) {
  34. $decorator_name = DEFAULT_DECORATOR;
  35. $decorator = new $decorator_name;
  36. $action_name = DEFAULT_ACTION;
  37. return $decorator->display(new $action_name($e->getMessage()));
  38. } catch (Exception $e) {
  39. return $e->getMessage();
  40. }
  41. }
  42. }
  43. ?>