コード例 #1
0
 /**
  * postDispatch - auto render a view
  *
  * Override Zend_Controller_Action_Helper_ViewRenderer::postDispatch()
  * @return void
  */
 public function postDispatch()
 {
     /**
      * Get module name, controller name, action name
      */
     $request = $this->getRequest();
     $module = $request->getModuleName();
     if (null === $module) {
         $module = $this->getFrontController()->getDispatcher()->getDefaultModule();
     }
     $controller = $request->getControllerName();
     if (null === $controller) {
         $controller = $this->getFrontController()->getDispatcher()->getDefaultControllerName();
     }
     $action = $request->getActionName();
     if (null == $action) {
         $action = $this->getFrontController()->getDispatcher()->getDefaultAction();
     }
     /**
      * Set cacheId for Smarty's caching
      */
     $langCode = Vi_Registry::get('langCode');
     $this->view->cacheId = Vi_Registry::getAppName() . '|' . $langCode . '|module|' . $module . '_' . $controller . '_' . $action . ($this->view->cacheId ? '_' . $this->view->cacheId : '');
     /**
      * Call parent's postDispatch() function
      */
     $result = parent::postDispatch();
     /**
      * Revive Vi_Language::$currentType and Vi_Language::$currentName
      */
     Vi_Language::$currentType = Vi_Registry::get('controllerCurrentType');
     Vi_Language::$currentName = Vi_Registry::get('controllerCurrentName');
     return $result;
 }
コード例 #2
0
 function postDispatch()
 {
     if ($_SERVER['HTTP_X_REQUESTED_WITH'] || $this->getRequest()->ajax) {
         $this->getResponse()->appendBody(Zend_Json::encode(var_export($this->view), true));
     } else {
         parent::postDispatch();
     }
 }
コード例 #3
0
 public function testPostDispatchDoesNotRenderViewWhenNoViewRendererSet()
 {
     $this->request->setModuleName('bar')->setControllerName('index')->setActionName('index');
     $this->front->setParam('noViewRenderer', true);
     $controller = new Bar_IndexController($this->request, $this->response, array());
     $this->helper->postDispatch();
     $body = $this->response->getBody();
     $this->assertTrue(empty($body));
 }
コード例 #4
0
 public function postDispatch()
 {
     if (!$this->_noRender && null !== $this->_actionController && $this->getRequest()->isDispatched() && !$this->getResponse()->isRedirect()) {
         if ($this->isJson()) {
             $this->getResponse()->setHeader('Content-Type', 'application/json');
         } else {
             $this->getResponse()->setHeader('Content-Type', 'text/html; charset=utf-8');
         }
     }
     parent::postDispatch();
 }
コード例 #5
0
ファイル: ViewRenderer.php プロジェクト: ngocanh/pimcore
 public function postDispatch()
 {
     if ($this->_shouldRender()) {
         if (method_exists($this->getActionController(), "getRenderScript")) {
             if ($script = $this->getActionController()->getRenderScript()) {
                 $this->renderScript($script);
             }
         }
     }
     parent::postDispatch();
 }
コード例 #6
0
ファイル: ViewRenderer.php プロジェクト: Gerhard13/pimcore
 /**
  *
  */
 public function postDispatch()
 {
     if ($this->_shouldRender()) {
         if (method_exists($this->getActionController(), "getRenderScript")) {
             if ($script = $this->getActionController()->getRenderScript()) {
                 $this->renderScript($script);
             }
         }
     }
     parent::postDispatch();
     // append custom styles to response body
     if ($this->getActionController() instanceof FrontendController) {
         $doc = $this->getActionController()->getDocument();
         if (Tool::isHtmlResponse($this->getResponse()) && $doc && method_exists($doc, "getCss") && $doc->getCss() && !$this->getRequest()->getParam("pimcore_editmode")) {
             $code = '<style type="text/css" id="pimcore_styles_' . $doc->getId() . '">';
             $code .= "\n\n" . $doc->getCss() . "\n\n";
             $code .= '</style>';
             $name = $this->getResponseSegment();
             $this->getResponse()->appendBody($code, $name);
         }
     }
 }