Пример #1
0
 /**
  * Executes actions after the views are rendered
  *
  * @return mixed
  */
 public function doAfter()
 {
     if ($this->_footerController) {
         $viewPath = ROOT . DS . 'app' . DS . 'views' . DS . strtolower($this->_controller->getControllerName()) . DS . strtolower($this->_controller->getAction()) . DS . 'footer.php';
         if (file_exists($viewPath)) {
             $this->_controller->addView(FView::create(strtolower($this->_controller->getControllerName()) . DS . strtolower($this->_controller->getAction()) . DS . 'footer.php', $this->getController()->getApp()));
         } elseif ($this->_footerGlobal) {
             $viewPath = ROOT . DS . 'app' . DS . 'views' . DS . 'footer.php';
             if (file_exists($viewPath)) {
                 $this->_controller->addView(FView::create('footer.php', $this->getController()->getApp()));
             }
         }
     }
 }
Пример #2
0
 /**
  * @param \Exception $exception
  */
 public function manageExceptions(\Exception $exception)
 {
     $code = (int) $exception->getCode();
     header(' ', true, $code);
     if (file_exists(ROOT . DS . 'app' . DS . 'views' . DS . 'smarty' . DS . 'templates' . DS . $code . '_View.tpl')) {
         $viewPath = $code . '_View.tpl';
     } elseif (file_exists(ROOT . DS . 'app' . DS . 'views' . DS . $code . '_View.php')) {
         $viewPath = $code . '_View.php';
     } elseif (file_exists(ROOT . DS . 'app' . DS . 'views' . DS . 'smarty' . DS . 'templates' . DS . 'defaultError_View.tpl')) {
         $viewPath = 'defaultError_View.tpl';
     } elseif (file_exists(ROOT . DS . 'app' . DS . 'views' . DS . 'defaultError_View.php')) {
         $viewPath = 'defaultError_View.php';
     } elseif (file_exists(ROOT_LIB . DS . 'src' . DS . 'modules' . DS . 'exception_handler' . DS . 'views' . DS . 'default' . $code . '_View.php')) {
         $viewPath = ROOT_LIB . DS . 'src' . DS . 'modules' . DS . 'exception_handler' . DS . 'views' . DS . 'default' . $code . '_View.php';
     } else {
         $viewPath = ROOT_LIB . DS . 'src' . DS . 'modules' . DS . 'exception_handler' . DS . 'views' . DS . 'defaultError_View.php';
     }
     $view = FView::create($viewPath, $this->getApp());
     $view->set('message', $exception->getMessage());
     $view->set('code', $exception->getCode());
     $view->set('trace', $exception->getTrace());
     if (is_a($exception, '\\pff\\Exception\\PffException')) {
         /** @var PffException $exception */
         $exceptionParams = $exception->getViewParams();
         if ($exceptionParams !== null && is_array($exceptionParams)) {
             $view->set('exceptionParams', $exceptionParams);
             foreach ($exceptionParams as $k => $v) {
                 $view->set($k, $v);
             }
         }
     }
     if (isset($this->_controller)) {
         $this->_controller->resetViews();
     }
     $view->render();
 }