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:
Located in /inc/actions/actionaction.php (line 54)
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 |
Authorisation object
Turn on debugging messages from the Action* classes
Permit normal HTML output
Allows previous output (from the HTML template) to be flushed or suppress it so a PDF can be output.
Parsed input data (combined PATH data and POST data)
Unparsed path data from the CGI call
The action should be read-only; no data should be changed
Default status messages that are returned to the user.
Initialising the class
Variable assignment only in this constructor, the child class would normally:
Edit the selected item
Actually perform the action that this Action* class is to perform
this is an abstract class and this function must be overridden
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.
Parse the input data sources
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.
Reports to the user whether an action was successful
(optional) messages to be reported, indexed by $status
$status codes as per file statuscodes.php
Select which item to edit for this action
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.
Documentation generated on Tue, 06 Mar 2007 10:00:27 +0000 by phpDocumentor 1.3.0