WACT_CONTROLLERS
[ class tree: WACT_CONTROLLERS ] [ index: WACT_CONTROLLERS ] [ all elements ]

Class: Controller

Source Location: /framework/controller/controller.inc.php

Class Overview


Variables

Methods


Child classes:

Inherited Variables

Inherited Methods


Class Details

access:  public

Class Variables


$children = array()

Array of child controllers
access:  private
Type:   mixed

$defaultName =

access:  protected
Type:   mixed

$defaultView = NULL

Default View
access:  protected
Type:   mixed

$id =

The name of this controller
access:  protected
Type:   mixed

$onActivateListeners = array()

access:  private
Type:   mixed

$onDeActivateListeners = array()

access:  private
Type:   mixed

$parent =

Parent controller
access:  protected
Type:   mixed

$viewMappings = array()

A list of view tokens and their corresponding view handles
var:  associative
access:  protected
Type:   array

Class Methods


constructor Controller

Constructor

Controller Controller( )

method addChild

Add a child controller

void addChild( mixed $name, mixed &$controller)

API Tags:

access:  public

method addView

Add a single mapping

void addView( string $token, mixed $view)

Parameters:

string   $token   token (value returned from an Action)
mixed   $view   Handle for View

method attachToParent

Part of the protocol whereby a controller is added to the tree of controllers

void attachToParent( mixed &$parent, mixed $name)

API Tags:

access:  public

method dispatchChild



void dispatchChild( mixed &$request, mixed &$responseModel)

Overridden in child classes as:

PathInfoDispatchController::dispatchChild()


method dispatchEvents



void dispatchEvents( mixed &$request, mixed &$responseModel)

Overridden in child classes as:

PageController::dispatchEvents()
FormController::dispatchEvents()
ButtonController::dispatchEvents()


method forward

Dispatch execution to the controller identified by the virtualPath

void forward( string $virtualPath, mixed &$request, mixed &$responseModel)

Parameters:

string   $virtualPath   virtual path

method getChild

Return an instance of the named child controller.

If the specified name does not exist, the default controller is returned



void &getChild( mixed $name)

API Tags:

access:  public

method getRealPath

Given a virtual path through the controller heirarchy, return an URL to address that controller.

string getRealPath( string $virtualPath)

API Tags:

return:  real path
access:  public

Parameters:

string   $virtualPath   virtual path (to right of front controller script in URL)

method handleRequest

Receive the HTTP Request event and process it.

This involves delegating the handling of the request to the child controllers. The raw request may be passed down to the child controllers, or this method may trigger more fine grained events which handle the request. The child controllers cooporate in handling the event by building a ResponseModel. The ResponseModel is then rendered by a view to produce an HTTP response for the incoming HTTP request.



void handleRequest( mixed &$request, mixed &$responseModel)

API Tags:

access:  public

method hasChild

Does this controller have an immediate child of the specified name?

void hasChild( mixed $name)

API Tags:

access:  public

method registerOnActivateListener

register a listener to receive activation events

void registerOnActivateListener( mixed &$listener)

API Tags:

access:  public

method registerOnDeActivateListener

register a listener to receive activation events

void registerOnDeActivateListener( mixed &$listener)

API Tags:

access:  public

method setDefaultChild

Specify the default child controller by name

void setDefaultChild( mixed $name)

API Tags:

access:  public

method setDefaultView

Register a View object handle with the Controller

void setDefaultView( mixed $view)

API Tags:

access:  public
see:  http://wact.sourceforge.net/index.php/View

Parameters:

mixed   $view   a Handle to the View

method start

Begin the process of handling the current PHP request This method may only be called on the root controller of a tree of controllers.

(Page controller or Front controller)



void start( )

API Tags:

access:  public

method triggerEvent

Broadcast an event to listeners

void triggerEvent( mixed &$listener, mixed $args)

API Tags:

access:  protected

method _appendDispatchInfo

Utility method used in getRealPath

void _appendDispatchInfo( mixed &$pathFragment, mixed &$parameters, mixed $name)

API Tags:

abstract:  
access:  private

Overridden in child classes as:

PageController::_appendDispatchInfo()
FormController::_appendDispatchInfo()
ParameterDispatchController::_appendDispatchInfo()
PathInfoDispatchController::_appendDispatchInfo()


method _buildRealPath

Recursive utility method used in getRealPath

void _buildRealPath( mixed &$realPath, mixed &$parameters, mixed $virtualPath)

API Tags:

access:  private

method _getDispatchName

Given a request object, determine the name of the child component to dispatch the request to.

void _getDispatchName( mixed &$request)

API Tags:

abstract:  
access:  private

Overridden in child classes as:

PageController::_getDispatchName()
FormController::_getDispatchName()
ParameterDispatchController::_getDispatchName()
PathInfoDispatchController::_getDispatchName()

WACT: Copyright 2003 Procata, Inc. Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
Documentation generated on Sun, 28 Nov 2004 19:44:56 -0800 by phpDocumentor 1.2.3