/**
  * Processes view variables before the parent implementation serializes
  * to JSON.
  *
  * @return void
  */
 public function postJsonContext()
 {
     if (!$this->_extRequest || !$this->getAutoJsonSerialization()) {
         return parent::postJsonContext();
     }
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
     $view = $viewRenderer->view;
     if (!$view instanceof Zend_View_Interface) {
         return parent::postJsonContext();
     }
     $request = $this->getRequest();
     $params = $request->getParams();
     $extParameter = $this->_extRequest->getConfigValue('extParameter');
     if (isset($params[$extParameter])) {
         $params = $params[$extParameter];
         $vars = $view->getVars();
         $view->clearVars();
         if (is_array($params)) {
             if (isset($params['action'])) {
                 $view->action = $params['action'];
             }
             if (isset($params['method'])) {
                 $view->method = $params['method'];
             }
             if (isset($params['tid'])) {
                 $view->tid = $params['tid'];
             }
             if ($this->getResponse()->isException()) {
                 $view->type = 'exception';
                 $view->message = $vars;
             } else {
                 if (isset($params['type'])) {
                     $view->type = $params['type'];
                 }
                 $view->result = $vars;
             }
         } else {
             // can only be an exception then
             if ($this->getResponse()->isException()) {
                 $view->type = 'exception';
                 $view->message = $vars;
             } else {
                 $view->result = $vars;
             }
         }
     }
     parent::postJsonContext();
 }
 /**
  * Called when the fonts dispatchLoop shuts down.
  *
  * @return void
  */
 public function dispatchLoopShutdown()
 {
     $this->_extDirect->notifyDispatchLoopShutdown();
 }
Example #3
0
 /**
  * Called before the request is in the dispatch loop.
  *
  * @param  Zend_Controller_Request_Abstract $request
  *
  * @return void
  */
 public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
 {
     $this->_extDirect->notifyDispatchLoopStartup($request);
 }