コード例 #1
0
 /**
  * Получить объект контроллера для последущего запуска.
  * 
  * @param \REXFramework\Request $request Объект пользовательского запроса
  * @return \REXFramework\controller\Controller
  */
 public function getCmd(\REXFramework\registry\RequestRegistry $request)
 {
     $module = $request->getProperty('module');
     $controller = $request->getProperty('controller');
     $controllerName = $this->getControllerName($module, $controller);
     return new $controllerName();
 }
コード例 #2
0
 /**
  * Обработка пользовательского запроса.
  */
 private function handleRequest()
 {
     $request = \REXFramework\registry\RequestRegistry::instance();
     $cmdResolver = new CommandResolver();
     $cmd = $cmdResolver->getCmd($request);
     $cmd->execute();
 }
コード例 #3
0
 /**
  * Установка текущего представления для вывода.
  */
 protected function setTemplate()
 {
     $ds = DIRECTORY_SEPARATOR;
     $this->view->templateName = dirname($_SERVER['DOCUMENT_ROOT']) . $ds . 'App' . $ds . 'views' . $ds . $this->request->getProperty('module') . $ds . $this->request->getProperty('controller') . $ds . $this->request->getProperty('action') . '.php';
     if (!$this->request->isXmlHttpRequest()) {
         $this->view->layoutPath = dirname($_SERVER['DOCUMENT_ROOT']) . $ds . 'App' . $ds . 'views' . $ds . $this->request->getProperty('module') . $ds . 'layout.php';
     }
 }
コード例 #4
0
 /**
  * Обработка исключений.
  * Может быть переопределен в дочерних классах.
  */
 public function process()
 {
     header('HTTP/1.0 404 Not Found');
     $request = \REXFramework\registry\RequestRegistry::instance();
     $request->setProperty('app_error', $this);
     $request->setProperty('controller', 'error');
     $request->setProperty('action', 'index');
     $module = $request->getProperty('module');
     $controllerName = '\\App\\modules\\' . strtolower($module) . '\\controllers\\' . 'ErrorController';
     try {
         $controller = new $controllerName();
         $controller->execute();
     } catch (\Exception $e) {
         echo "Возникло исключение при обработке исключения.\n" . "Во избежание зацикливания выполнение прервано.\n" . "Сообщение: " . $e->getMessage();
     }
 }
コード例 #5
0
ファイル: View.php プロジェクト: BoesesGenie/rex-framework
 /**
  * Инициализация необходимых параметров
  */
 public function __construct()
 {
     $this->config = ApplicationRegistry::instance();
     $this->request = RequestRegistry::instance();
     $this->session = SessionRegistry::instance();
 }