Ejemplo n.º 1
0
 /**
  * Служебная функция вызова ф-ии и класса движка.
  *
  * @param object $class Название класса
  * @param object $die   [optional] Вызвать и остановить скрипт
  *
  * @return 
  */
 public function exec_page($class, $die = false)
 {
     //var_export($class);
     $class2 = 'page_' . $class['class'];
     self::$d = new $class2();
     self::$d->page = $class['class'];
     if (self::og('tpl')) {
         self::og('tpl')->set('pageClass', self::$d->page);
     }
     if (!$class['method']) {
         $afteruri_wothout_action = $class['after_uri'];
         $action = array_shift($afteruri_wothout_action);
     } else {
         $action = $class['method'];
     }
     if (!$action) {
         $afteruri_wothout_action = $class['after_uri'];
         $action = 'index';
     }
     $method = strtolower($action) . 'Action';
     if (method_exists(self::$d, $method)) {
         self::$d->uri = $afteruri_wothout_action;
         self::$d->action = $method;
         //die(self::$d->action);
         if (self::og('tpl')) {
             self::og('tpl')->set('action', self::$d->action);
         }
         self::$d->{$method}();
     } elseif (method_exists(self::$d, 'indexAction') && $method == '') {
         self::$d->uri = $class['after_uri'];
         self::$d->action = 'indexAction';
         if (self::og('tpl')) {
             self::og('tpl')->set('action', self::$d->action);
         }
         self::$d->indexAction();
     } else {
         self::error();
     }
     if ($die) {
         die;
     }
 }
Ejemplo n.º 2
0
 /**
  * Служебная функция вызова ф-ии и класса движка
  * @param object $class Название класса
  * @param object $die [optional] Вызвать и остановить скрипт
  * @return 
  */
 public function exec_page($class, $die = false)
 {
     //var_export($class);
     $class2 = "page_" . $class['class'];
     self::$d = new $class2();
     self::$d->page = $class['class'];
     if (front::og("tpl")) {
         front::og("tpl")->set("pageClass", self::$d->page);
     }
     if (!$class['method']) {
         $afteruri_wothout_action = $class['after_uri'];
         $action = array_shift($afteruri_wothout_action);
     } else {
         $action = $class['method'];
     }
     if (!$action) {
         $afteruri_wothout_action = $class['after_uri'];
         $action = "index";
     }
     $method = strtolower($action) . "Action";
     if (method_exists(self::$d, $method)) {
         self::$d->uri = $afteruri_wothout_action;
         self::$d->action = $method;
         //die(self::$d->action);
         if (front::og("tpl")) {
             front::og("tpl")->set("action", self::$d->action);
         }
         self::$d->{$method}();
     } elseif (method_exists(self::$d, "indexAction") && $method == "") {
         self::$d->uri = $class['after_uri'];
         self::$d->action = "indexAction";
         if (front::og("tpl")) {
             front::og("tpl")->set("action", self::$d->action);
         }
         self::$d->indexAction();
     } else {
         self::error();
     }
     if ($die) {
         die;
     }
 }