public function __construct(sfAction $actionInstance)
 {
     $this->request = $actionInstance->getRequest();
     $this->module = $actionInstance->getModuleName();
     $this->action = $actionInstance->getActionName();
     $this->actionVars = $actionInstance->getVarHolder()->getAll();
 }
 /**
  * @see ckAbstractResultAdapter::doGetResult()
  */
 protected function doGetResult(sfAction $action)
 {
     $result = null;
     $vars = $action->getVarHolder()->getAll();
     if (isset($vars[$this->getResultProperty()])) {
         $result = $vars[$this->getResultProperty()];
     } else {
         if (count($vars) == 1) {
             reset($vars);
             $result = current($vars);
         }
     }
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * Handles the view.
  *
  * @param sfFilterChain $filterChain    The current filter chain
  * @param sfAction      $actionInstance An sfAction instance
  * @param string        $viewName       The view name
  */
 protected function handleView($filterChain, $actionInstance, $viewName)
 {
     switch ($viewName) {
         case sfView::HEADER_ONLY:
             $this->context->getResponse()->setHeaderOnly(true);
             return;
         case sfView::NONE:
             return;
     }
     $this->executeView($actionInstance->getModuleName(), $actionInstance->getActionName(), $viewName, $actionInstance->getVarHolder()->getAll());
 }
 /**
  * Implements the default behavior to get the result of a soap action.
  *
  * @param sfAction $actionInstance A sfAction instance
  *
  * @return mixed The result of the sfAction instance
  */
 public function defaultResultCallback($actionInstance)
 {
     $vars = $actionInstance->getVarHolder()->getAll();
     // if we have one or more vars and shouldn't render
     if (count($vars) > 0 && !$this->doRender()) {
         // get the default result array key
         $default_key = sfConfig::get(sprintf('mod_%s_%s_result', $actionInstance->getModuleName(), $actionInstance->getActionName()), 'result');
         // if there is only one var stored we return it
         if (count($vars) == 1) {
             reset($vars);
             return current($vars);
         } else {
             if (array_key_exists($default_key, $vars)) {
                 return $vars[$default_key];
             }
         }
     } else {
         if ($this->doRender()) {
             // return the rendered view
             return $this->getActionStack()->getLastEntry()->getPresentation();
         }
     }
     return;
 }