Packages » Package freeform » Class Action

Class Action

Declaration:
<? class Action ?>

Description:
Action is the base class for all MVC controller classes of every web application. Actions get execuped (processed) with every user gesture like clicking on a link or submitting a form. Action are responsible for processing parameters supplied with each user request and to update model and to prepare appropriate view (result page, an implementation of the Document) suitable for the requesting client or its user agent. The Request and Response objects are created by the ActionController and supplied to every Action through the call to the constructor of the Action. You can execute other actions from your action using ActionController::process().

Authors:
  • Dennis Popel

Methods:
  • __construct()
    Create an Action. The front controller will supply the default Request and Responce and mark the action as requested. You can create Actions with default constructor or supply your own Request and Responce to call the process() method from other action and grap its output. Note that request might be needed by AccessController of this action.
  • getAccessController()
    Return an AccessController for this action.
  • getPackage()
    A shortcut to Package::getPackage($this)
  • getRequest()
    Return the request associated with this action
  • getResponce()
    Get the response. This method is deprecated. Use Response::getResponse
  • getResponse()
    Return the responce associated with this action
  • isReferrer()
    Returns true if this action can be a referrer. Normally actions that return HTML documents are referrers, while those returning images or other types of files (javascripts etc) are not. Freeform uses internal mechanism for referrers (not relying on browser's Referer: header). Such actions that don't return HTML pages may disrupt this functionality so that they must somehow report they cannot act as referrers.
  • isRequested()
    Returns true if the action has been requested by user
  • onAccessDenied()
    Will be called if the action's AccessController denies access to this action
  • onInit()
    Perform action initialization. This is called after the constructor, but before the access check and the process() or onAccessDenied() method.
  • process()
    Override this method to define the behaviour of this action