![]() |
Xataface
2.0alpha2
Xataface Application Framework
|
Interface for action handlers in Xataface application. An action handler serves as an HTTP access point for an application. Actions may be located in the following locations: More...
Public Member Functions | |
| handle ($params) | |
| The entry point for this action. | |
| getPermissions ($params) | |
| An optional method to override the permissions granted to the current user when this action is requested. This option is not often used and it is questionable whether it is of any value since permissions can be amply defined in the table or application delegate classes. | |
Interface for action handlers in Xataface application. An action handler serves as an HTTP access point for an application. Actions may be located in the following locations:
The action file should contain a class with a name that roughly matches the path to the file.
E.g. An action in the tables/tablename%/actions/actionname%.php file should be named tables_tablename_actions_actionname% . Similarly an action in the actions/actionname%.php file should be named actions_actionname% etc...
This interface serves to document the available methods that may be defined in an action handler and how they are expected to work.
Consider a sample action located in the DATAFACE_SITE_PATH%/actions/myaction.php file:
An action handler is the PHP portion of an action that is defined in the actions.ini file. The actions.ini file allows you to decide where the action appears in the application's user interface as well as such things as permissions. You can also define permissions programmatically inside your action.
Definition at line 48 of file ActionHandler.php.
| getPermissions | ( | $params | ) |
An optional method to override the permissions granted to the current user when this action is requested. This option is not often used and it is questionable whether it is of any value since permissions can be amply defined in the table or application delegate classes.
array $params The parameters.
| handle | ( | $params | ) |
The entry point for this action.
| array | $params | Parameters passed to the action to determine how the action should be executed. The only key that is currently set to be passed is relationship but this can equivalently be obtained from the $query['-relationship'] Query parameter. |
If during the course of execution the current user is deemed to lack sufficient permission to perform this action, then handle() may return a PEAR_Error with the code DATAFACE_E_PERMISSION_DENIED. Equivalently it may return the result of the Dataface_Error::permissionDenied() method:
It is also possible to signal to Xataface that the action opted not to handle the request at all, so that Xataface will pass the opportunity to handle the request onto the next elligible action handler. This allows you to define handlers specific to a table that may override default actions or choose to just allow the default action to handle it.
1.8.1.2