Class ActionHandler

Description

The ActionHandler interface defines the required methods for an ActionHandler class.

The ActionHandler takes care of: authentication, and then executing PHP scripts in a user-defined place with user-defined options.

An action can be a: flat PHP file, an entire PHP class, or a specific method within a class. Actions are organized into modules, which can be: a folder or a class. A specific action is referenced by "module.action" certain module/action options are not compatible (such as modules=folders and actions=method-within-class).

An action is passed the following items:
<li>The Harmoni object.

Located in /harmoni/core/actionHandler/ActionHandler.class.php (line 78)

SObject
   |
   --EventTrigger
      |
      --ActionHandler
Variable Summary
Method Summary
void ActionHandler (mixed $harmoni, object $httpVars, optional 1, optional 2)
void addActionSource (ref $actionSourceObject)
ref execute (string $module, string $action)
mixed executePair (string $pair)
void forward (string $module, [optional $action = null])
string lastExecutedAction ()
void setActionsType (integer $type, [optional $fileExtension = null])
void setActionThread (string $action, string $actionOnFail, [optional $actionOnSuccess = null])
void setModulesLocation (string $location, integer $type, [optional $fileExtension = null])
mixed _execute (string $module, string $action)
mixed _executePair (string $pair)
Variables
array $_actionsExecuted (line 108)
  • var: An array of actions we've already executed. Used in order to avoid infinite-loops created by stupid people creating stupid action threads.
  • access: private
array $_actionSources (line 101)
string $_executing = false (line 120)
  • access: private
string $_forwardToAction = false (line 114)
  • access: private
object $_harmoni (line 83)
  • var: A reference to the Harmoni object.
  • access: private
array $_modulesSettings (line 95)
  • var: A variable for backward compatibility. Don't worry about it.
  • access: private
array $_threads (line 89)
  • var: A hashed-array of subsequent actions for any given action.
  • access: private

Inherited Variables

Inherited from EventTrigger

EventTrigger::$_eventListeners
Methods
Constructor ActionHandler (line 130)

The constructor.

  • access: public
void ActionHandler (mixed $harmoni, object $httpVars, optional 1, optional 2)
  • object $httpVars: A FieldSet object of HTTP variables.
  • optional 1: object $context A Context object.
  • optional 2: object $loginState A LoginState object.
addActionSource (line 375)

Adds a location for actions to the list of locations.

  • access: public
void addActionSource (ref $actionSourceObject)
  • ref $actionSourceObject: object $actionsTypeObject An ActionSource object, specifying how to handle the given directory.
execute (line 174)

The execute function takes a module and action. The method executes the given action, taking the result and either executing another action (based on the user specified options) or returning the result from the action.

  • return: mixed Returns whatever is recieved from the last action to execute. Can be: a Layout object, TRUE/FALSE, etc.
  • access: public
ref execute (string $module, string $action)
  • string $module: The module name.
  • string $action: The action name.
executePair (line 273)

Executes a module.action pair.

  • access: public
mixed executePair (string $pair)
  • string $pair
forward (line 147)

If called within an executing action, will execute $module.$action after calling action has stopped.

  • access: public
void forward (string $module, [optional $action = null])
  • string $module: The module, or a "module.action" pair, in which case the second parameter can be omitted.
  • optional $action: string $action The action to execute.
getExecutedActions (line 421)

Returns an array of actions that have been executed this session.

  • access: public
array getExecutedActions ()
lastExecutedAction (line 283)

Returns the last executed action.

string lastExecutedAction ()
setActionsType (line 329)

Sets the default way for how we locate actions. Action Types for particular modules can be set with setActionsTypeForModulesLocation() method.

void setActionsType (integer $type, [optional $fileExtension = null])
  • integer $type: Should be any of ACTIONS_FLATFILES, ACTIONS_CLASSES, ACTIONS_CLASS_METHODS.
  • optional $fileExtension: string $fileExtension If $type=ACTIONS_FLATFILES or ACTIONS_CLASSES, the extension to apply to the action name to find the file (ie, ".inc.php" would give "action1name.inc.php").
setActionThread (line 392)

Adds to the action-processing thread. If $action is executed and it returns a failure or success code, $actionOnFail will be executed afterwards if $action fails, otherwise, $actionOnSuccess will be executed (or nothing will be if this option isn't included).

  • access: public
void setActionThread (string $action, string $actionOnFail, [optional $actionOnSuccess = null])
  • string $action: A "module.action" string specifying which action to set the thread for.
  • string $actionOnFail: A "module.action" string specifying what should be executed if $action fails.
  • optional $actionOnSuccess: string $actionOnSuccess A "module.action" string specifying what should be executed if $action succeeds.
setModulesLocation (line 299)

Sets the location of the modules to use.

void setModulesLocation (string $location, integer $type, [optional $fileExtension = null])
  • string $location: The path to the modules.
  • integer $type: Should be either MODULES_FOLDERS or MODULES_CLASSES
  • optional $fileExtension: string $fileExtension If $type=MODULES_CLASSES, the string to append onto the module name to find the class file (ie, ".class.php").
_compatActionSource (line 350)

For backward compatibility with deprecated functions -- will add an action source based on settings given with old functions.

  • access: private
void _compatActionSource ()
_execute (line 190)

Executes the given action

  • access: private
mixed _execute (string $module, string $action)
  • string $module
  • string $action
_executePair (line 261)

Executes a module.action pair.

  • access: private
mixed _executePair (string $pair)
  • string $pair

Inherited Methods

Inherited From EventTrigger

EventTrigger::addEventListener()
EventTrigger::triggerEvent()

Inherited From SObject

SObject::asA()
SObject::asString()
SObject::copy()
SObject::copySameFrom()
SObject::copyTwoLevel()
SObject::deepCopy()
SObject::isEqual()
SObject::isEqualTo()
SObject::isNotEqualTo()
SObject::isNotReferenceTo()
SObject::isReferenceTo()
SObject::newFrom()
SObject::postCopy()
SObject::printableString()
SObject::shallowCopy()
SObject::_deepCopyArray()

Documentation generated on Wed, 19 Sep 2007 10:21:18 -0400 by phpDocumentor 1.3.0RC3