category Zend
package Zend_Controller
subpackage Zend_Controller_Action_Helper
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Controller_Action_Helper_Abstract

 Methods

Overloading

__call(string $method, array $args) : mixed

Overloading for old 'goto', 'setGoto', and 'gotoAndExit' methods

Parameters

$method

string

$args

array

Exceptions

\Zend_Controller_Action_Exception for invalid methods

Returns

mixed

direct(): Perform helper when called as $this->_helper->redirector($action, $controller, $module, $params)

direct(string $action, string $controller = null, string $module = null, array $params = array()) : void

Parameters

$action

string

$controller

string

$module

string

$params

array

Retrieve current action controller

getActionController() : \Zend_Controller_Action
Inherited

Returns

\Zend_Controller_Action

Retrieve flag for whether or not {@link redirectAndExit()} shall close the session before exiting.

getCloseSessionOnExit() : boolean

Returns

boolean

Retrieve HTTP status code to emit on {@link _redirect()} call

getCode() : integer

Returns

integer

Retrieve flag for whether or not {@link _redirect()} will exit when finished.

getExit() : boolean

Returns

boolean

Retrieve front controller instance

getFrontController() : \Zend_Controller_Front
Inherited

Returns

\Zend_Controller_Front

getName()

getName() : string
Inherited

Returns

string

Retrieve flag for whether or not {@link _redirect()} will prepend the base URL on relative URLs

getPrependBase() : boolean

Returns

boolean

Retrieve currently set URL for redirect

getRedirectUrl() : string

Returns

string

getRequest() -

getRequest() : \Zend_Controller_Request_Abstract
Inherited

Returns

\Zend_Controller_Request_Abstract$request

getResponse() -

getResponse() : \Zend_Controller_Response_Abstract
Inherited

Returns

\Zend_Controller_Response_Abstract$response

Return use absolute URI flag

getUseAbsoluteUri() : boolean

Returns

boolean

Redirect to a route-based URL

gotoRoute(array $urlOptions = array(), string $name = null, boolean $reset = false, boolean $encode = true) : void

Uses route's assemble method to build the URL; route is specified by $name; default route is used if none provided.

Parameters

$urlOptions

array

Array of key/value pairs used to assemble URL

$name

string

$reset

boolean

$encode

boolean

Redirect to a route-based URL, and immediately exit

gotoRouteAndExit(array $urlOptions = array(), string $name = null, boolean $reset = false) : void

Uses route's assemble method to build the URL; route is specified by $name; default route is used if none provided.

Parameters

$urlOptions

array

Array of key/value pairs used to assemble URL

$name

string

$reset

boolean

Perform a redirect to an action/controller/module with params

gotoSimple(string $action, string $controller = null, string $module = null, array $params = array()) : void

Parameters

$action

string

$controller

string

$module

string

$params

array

Perform a redirect to an action/controller/module with params, forcing an immdiate exit

gotoSimpleAndExit(mixed $action, mixed $controller = null, mixed $module = null, array $params = array()) : void

Parameters

$action

mixed

$controller

mixed

$module

mixed

$params

array

Perform a redirect to a url

gotoUrl(string $url, array $options = array()) : void

Parameters

$url

string

$options

array

Set a URL string for a redirect, perform redirect, and immediately exit

gotoUrlAndExit(string $url, array $options = array()) : void

Parameters

$url

string

$options

array

Hook into action controller initialization

init() : void
Inherited

Hook into action controller postDispatch() workflow

postDispatch() : void
Inherited

Hook into action controller preDispatch() workflow

preDispatch() : void
Inherited

exit(): Perform exit for redirector

redirectAndExit() : void

setActionController()

setActionController(\Zend_Controller_Action $actionController = null) : \Zend_Controller_ActionHelper_Abstract
Inherited

Parameters

$actionController

\Zend_Controller_Action

Returns

\Zend_Controller_ActionHelper_AbstractProvides a fluent interface

Set flag for whether or not {@link redirectAndExit()} shall close the session before exiting.

setCloseSessionOnExit(boolean $flag) : \Zend_Controller_Action_Helper_Redirector

Parameters

$flag

boolean

Returns

\Zend_Controller_Action_Helper_RedirectorProvides a fluent interface

Set HTTP status code for {@link _redirect()} behaviour

setCode(integer $code) : \Zend_Controller_Action_Helper_Redirector

Parameters

$code

integer

Returns

\Zend_Controller_Action_Helper_RedirectorProvides a fluent interface

Set exit flag for {@link _redirect()} behaviour

setExit(boolean $flag) : \Zend_Controller_Action_Helper_Redirector

Parameters

$flag

boolean

Returns

\Zend_Controller_Action_Helper_RedirectorProvides a fluent interface

Build a URL based on a route

setGotoRoute(array $urlOptions = array(), string $name = null, boolean $reset = false, boolean $encode = true) : void

Parameters

$urlOptions

array

$name

string

Route name

$reset

boolean

$encode

boolean

Set a redirect URL of the form /module/controller/action/params

setGotoSimple(string $action, string $controller = null, string $module = null, array $params = array()) : void

Parameters

$action

string

$controller

string

$module

string

$params

array

Set a redirect URL string

setGotoUrl(string $url, array $options = array()) : void

By default, emits a 302 HTTP status header, prepends base URL as defined in request object if url is relative, and halts script execution by calling exit().

$options is an optional associative array that can be used to control redirect behaviour. The available option keys are:

  • exit: boolean flag indicating whether or not to halt script execution when done
  • prependBase: boolean flag indicating whether or not to prepend the base URL when a relative URL is provided
  • code: integer HTTP status code to use with redirect. Should be between 300 and 307.

_redirect() sets the Location header in the response object. If you set the exit flag to false, you can override this header later in code execution.

If the exit flag is true (true by default), _redirect() will write and close the current session, if any.

Parameters

$url

string

$options

array

Set 'prepend base' flag for {@link _redirect()} behaviour

setPrependBase(boolean $flag) : \Zend_Controller_Action_Helper_Redirector

Parameters

$flag

boolean

Returns

\Zend_Controller_Action_Helper_RedirectorProvides a fluent interface

Set use absolute URI flag

setUseAbsoluteUri(boolean $flag = true) : \Zend_Controller_Action_Helper_Redirector

Parameters

$flag

boolean

Returns

\Zend_Controller_Action_Helper_RedirectorProvides a fluent interface

Validate HTTP status redirect code

_checkCode(integer $code) : true

Parameters

$code

integer

Exceptions

\Zend_Controller_Action_Exception on invalid HTTP status code

Returns

true

Determine if the baseUrl should be prepended, and prepend if necessary

_prependBase(string $url) : string

Parameters

$url

string

Returns

string

Set redirect in response object

_redirect($url) : void

Parameters

$url

 Properties

 

$_actionController

$_actionController : \Zend_Controller_Action

Default

null
 

Whether or not to close the session before exiting

$_closeSessionOnExit : boolean

Default

true
 

HTTP status code for redirects

$_code : integer

Default

302
 

Whether or not calls to _redirect() should exit script execution

$_exit : boolean

Default

true
 

$_frontController

$_frontController : mixed

Default

null
 

Whether or not _redirect() should attempt to prepend the base URL to the passed URL (if it's a relative URL)

$_prependBase : boolean

Default

true
 

Url to which to redirect

$_redirectUrl : string

Default

null
 

Whether or not to use an absolute URI when redirecting

$_useAbsoluteUri : boolean

Default

false