Class ActionAction

Description

Base class inherited by all actions from the action-triage

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.

Since http is a stateless protocol, what seems like just one activity (e.g. "edit a booking") actually includes multiple http requests ("show the user the current values" and "sync changes to disk"). Additionally, the one application suite will have many different things to do (e.g. edit/create users, edit/create foobar objects). There are two approaches to this multiple functions problem: have many .php files that are called directly by the user for each function (i.e. links to user.php and foobar.php) but then you can end up with a lot of repeated code in each file to control the page layout, load themes, control login etc. Alternatively, you can use just the one index.php and include an extra control variable in each link that decides what the script should do this time.

In either case, it is convenient to have a standard "action" object that can be created by some ActionFactory which then obeys a standard "action" interface to then be used by the internals of the application.

Typical usage:

  1.  $action new ActionFactory($params);
  2.  $action->go();

  • abstract:

Located in /inc/actions/actionaction.php (line 54)


	
			
Direct descendents
Class Description
BufferedAction Primitive class that allows output to be suppressed
ActionDeletedBookings View a list of deleted bookings for an instrument over a given time period
ActionConsumables Edit/create/delete consumables
ActionConsume Edit/create/delete consumables records
ActionCosts Edit and create costs for using instruments
ActionInstrumentClass Edit/create/delete instrument classes
ActionEmailList Generate a list of email addresses for users of particular instruments
ActionGroups Interface for editing details of groups
ActionUnknown Error handling class for unknown actions
ActionInstruments Edit/create/delete instruments
ActionPrintLoginForm Print a polite login form
ActionLogout Thank the user for using the system.
ActionMasquerade Allow the admin user to masquerade as another user to make some bookings. A bit like "su".
ActionPassword Permit a local user to change their password
ActionProjects Edit/create/delete projects
ActionSpecialCosts Edit/create/delete special instrument usage costs
ActionUserClass Edit/create/delete userclass details
ActionUsers Edit/create/delete users, their project associations and permissions
ActionViewBase Base class for booking and viewing bookings
ActionBookContact Let the user either log in or fill in a contact form to make a booking.
ActionSettings Change the system settings
ActionOffline Print a polite message to inform the user that the system is offline
Variable Summary
integer $DEBUG
boolean $ob_flush_ok
array $PD
array $PDATA
boolean $readOnly
array $stdmessages
Method Summary
void ActionAction (BumblebeeAuth $auth, array $pdata)
void delete ()
void edit ()
void go ()
void log (string $message, [integer $priority = 10])
void mungeInputData ()
void readOnlyError ([string $message = null])
void reportAction (integer $status, [array $messages = ''])
void select ([boolean $deleted = false])
void _dataCleanse (mixed $fields)
Variables
BumblebeeAuth $auth (line 59)

Authorisation object

integer $DEBUG (line 93)

Turn on debugging messages from the Action* classes

boolean $ob_flush_ok = 1 (line 77)

Permit normal HTML output

Allows previous output (from the HTML template) to be flushed or suppress it so a PDF can be output.

array $PD (line 69)

Parsed input data (combined PATH data and POST data)

array $PDATA (line 64)

Unparsed path data from the CGI call

boolean $readOnly = true (line 82)

The action should be read-only; no data should be changed

array $stdmessages (line 87)

Default status messages that are returned to the user.

Methods
Constructor ActionAction (line 106)

Initialising the class

Variable assignment only in this constructor, the child class would normally:

  • use parent's constructor
  • parse input data

  • return: nothing
void ActionAction (BumblebeeAuth $auth, array $pdata)
  • BumblebeeAuth $auth: Authorisation object
  • array $pdata: extra state data from the call path
edit (line 204)

Edit the selected item

  • return: nothing
void edit ()

Redefined in descendants as:
log (line 225)

Generic logging function for use by all Action classes

The higher the value of $priority, the less likely the message is to be output. The normal range for priority is [1-10] with messages with ($priority <= $this->DEBUG) being displayed.

void log (string $message, [integer $priority = 10])
  • string $message: the message to be logged to the browser
  • integer $priority: (optional) the priority level of the message
readOnlyError (line 243)

Display a message to the user explaining that the requested action cannot be performed as the object is "readonly".

This is designed to be used with the magic token verification system that requires that the form that is submitted by the user contains some additional secret data that was provided by the installation. This is designed to prevent attacks through getting users to visit specially crafted URLs or to submit malicious forms.

void readOnlyError ([string $message = null])
  • string $message: message to show to the user explaining that the action cannot be processed
reportAction (line 160)

Reports to the user whether an action was successful

void reportAction (integer $status, [array $messages = ''])
  • integer $status: success or otherwise of action
  • array $messages:

    (optional) messages to be reported, indexed by $status

    $status codes as per file statuscodes.php

select (line 196)

Select which item to edit for this action

  • return: nothing
void select ([boolean $deleted = false])
  • boolean $deleted: (optional) show deleted items

Redefined in descendants as:
_dataCleanse (line 261)

Cleanse the input data of all fields except for the specifed whitelisted fields

Removes all user-submitted data fields from the $ActionAction::PD array except for the fields that are explicitly whitelisted in the function call.

void _dataCleanse (mixed $fields)
  • mixed $fields: single field name or list of fields to whitelist

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