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.

46 lines
1.2 KiB

  1. <?php
  2. /**
  3. *
  4. *
  5. * @copyright netmonsters.ru
  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. try{
  23. $this->route = Load::router()->proccess(MJ_PATH);
  24. $action = new $this->route->action;
  25. $decorator = new $this->route->decorator;
  26. return $decorator->display($action);
  27. } catch (MJException $e) {
  28. return $e->terminate();
  29. }
  30. } catch (DynamicPageException $e) {
  31. $decorator_name = DEFAULT_DECORATOR;
  32. $decorator = new $decorator_name;
  33. $action_name = $e->getMessage();
  34. return $decorator->display(new $action_name);
  35. } catch (StaticPageException $e) {
  36. $decorator_name = DEFAULT_DECORATOR;
  37. $decorator = new $decorator_name;
  38. $action_name = DEFAULT_ACTION;
  39. return $decorator->display(new $action_name($e->getMessage()));
  40. } catch (Exception $e) {
  41. return $e->getMessage();
  42. }
  43. }
  44. }
  45. ?>