public function __construct(sfAction $actionInstance) { $this->request = $actionInstance->getRequest(); $this->module = $actionInstance->getModuleName(); $this->action = $actionInstance->getActionName(); $this->actionVars = $actionInstance->getVarHolder()->getAll(); }
public static function notifyPostExecuteActionEvent($subject, sfEventDispatcher $dispatcher, sfAction $actionInstance, $result) { $moduleName = $actionInstance->getModuleName(); $actionName = $actionInstance->getActionName(); $params = array('moduleName' => $moduleName, 'actionName' => $actionName, 'actionInstance' => $actionInstance, 'result' => $result); $dispatcher->notify(new sfEvent($subject, 'op_action.post_execute_' . $moduleName . '_' . $actionName, $params)); $dispatcher->notify(new sfEvent($subject, 'op_action.post_execute', $params)); }
/** * Returns true if the action must always be called in SSL. * * @param sfAction A sfAction instance * * @return Boolean true if the action must always be called in SSL, false otherwise */ protected function sslRequired(sfAction $action) { $security = $action->getSecurityConfiguration(); $actionName = $action->getActionName(); if (isset($security[$actionName]['require_ssl'])) { return $security[$actionName]['require_ssl']; } if (isset($security['all']['require_ssl'])) { return $security['all']['require_ssl']; } return false; }
/** * 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; }