Class ActionFactory

Description

Factory class for creating Action objects

An Action is a single operation requested by the user. What action is to be performed is determined by the action-triage mechanism in the class ActionFactory.

Everything done by an application suite (e.g. edit/create a user) can be reduced to broad categories of actions (e.g. edituser) which can be encapsulated within an object framework in which every object has the same interface.

The invoking code is thus boiled down to something quite simple:

  1.  $action new ActionFactory($params);
  2.  $action->go();
where ActionFactory does the work of deciding what is to be done on this invocation and instantiates the appropriate action object.

The action object then actually performs the tasks desired by the user.

Here, we use the data from the browser (a PATH_INFO variable from the URL in the form index.php/user) to triage the transaction.

Located in /inc/actions/actionfactory.php (line 85)


	
			
Variable Summary
Method Summary
ActionFactory ActionFactory (BumblebeeAuth $auth, [string $forceVerb = null])
void checkMagic ()
void go ()
boolean ob_flush_ok ()
void verb ()
void _actionRestart (string $newaction)
string _checkActions (string $forceVerb)
array _eatGPCInfo ()
array _eatPathInfo ()
void _makeAction ()
Variables
array $actionListing (line 101)
  • var: ActionListing object
string $nextaction (line 99)
  • var: The 'verb' that should follow this current action were a standard workflow being followed
array $PDATA (line 97)
  • var: user-supplied data from the PATH_INFO and GET sections of the URL
string $title (line 91)
  • var: Each action has a description associated with it that we will put into the HTML title tag
ActionAction $_action (line 93)
  • var: The action object (some descendent of the ActionAction class)
ActionData $_actionData (line 103)
  • var: The action data object for this action
BumblebeeAuth $_auth (line 95)
  • var: The user's login credentials object
string $_original_verb (line 89)
  • var: the actual user-supplied verb... we may pretend to do something else due to permissions
string $_verb (line 87)
  • var: the user-supplied "verb" (name of the action) e.g. "edituser"
Methods
Constructor ActionFactory (line 116)

Constructor for the class

  • Parse the submitted data
  • work out what action we are supposed to be performing
  • set up the title tag for the browser
  • create the ActionAction descendent object that will perform the task

ActionFactory ActionFactory (BumblebeeAuth $auth, [string $forceVerb = null])
  • BumblebeeAuth $auth: user login credentials object
  • string $forceVerb: force a particular action
checkMagic (line 251)
void checkMagic ()
go (line 132)

Fire the action: make things actually happen now

void go ()
ob_flush_ok (line 262)

Is it ok to allow the HTML template to dump to the browser from the output buffer?

(see BufferedAction descendents)

  • return: ok to dump to browser
boolean ob_flush_ok ()
returnBufferedStream (line 271)

Cause buffered actions to output their data to the browser

(see BufferedAction descendents)

void returnBufferedStream ()
verb (line 136)
void verb ()
_actionRestart (line 200)

Trigger a restart of the action or a new action

Sometimes, an action may need to be restarted or the action changed (e.g. logout => login)

void _actionRestart (string $newaction)
  • string $newaction: new verb for the new action
_checkActions (line 151)

Determine what action should be performed.

This is done by:

  • checking that the user is logged in... if not, they *must* login
  • looking for hints in the user-supplied data for what the correct action is
  • checking that the user is an admin user if admin functions were requested

  • return: the name of the action (verb) to be undertaken
string _checkActions (string $forceVerb)
  • string $forceVerb: force a particular action
_eatGPCInfo (line 238)

Parse the user-supplied data from either the GET or POST data

  • return: (key => $data)
array _eatGPCInfo ()
_eatPathInfo (line 211)

Parse the user-supplied data in PATH_INFO part of URL

  • return: (key => $data)
array _eatPathInfo ()
_makeAction (line 280)

create the action object (a descendent of ActionAction) for the user-defined verb

void _makeAction ()

Documentation generated on Tue, 06 Mar 2007 10:00:28 +0000 by phpDocumentor 1.3.0