Render ‐ ActionFrame - xoopscube/legacy GitHub Wiki
html\modules\legacyRender\class\ActionFrame.class.php
ActionFrame class
The ActionFrame.class.php
file, is a core component of XCube's MVC architecture that handles the execution flow
of actions in the LegacyRender module. Here its key components:
LegacyRender_ActionFrame Class
This class serves as a controller framework that:
-
Manages Action Execution Flow: It creates and executes action objects based on the action name.
-
Defines View Constants: The constants at the top (like
LEGACYRENDER_FRAME_VIEW_SUCCESS
,LEGACYRENDER_FRAME_VIEW_ERROR
, etc.) define different view states that determine which view method will be called. -
Action Creation: The
_createAction()
method dynamically loads action classes based on naming conventions. -
Execution Process: The
execute()
method handles the entire action execution flow:- Creates the action object
- Checks permissions
- Executes the appropriate method based on request method (GET or POST)
- Calls the appropriate view method based on the returned view status
LegacyRender_Action Class
This is the base class for all actions in the LegacyRender module:
-
Template Methods: It defines empty methods that subclasses can override to implement specific functionality.
-
View Methods: Methods like
executeViewSuccess()
,executeViewError()
, etc. are called based on the view status returned by the action'sexecute()
orgetDefaultView()
methods. -
Permission Handling: The
hasPermission()
method allows actions to implement access control.
This architecture follows a classic MVC pattern where:
- The ActionFrame is a front controller
- Action classes contain business logic
- View methods prepare data for templates
- Templates (not shown in this file) handle the actual rendering
When implementing AJAX functionality in this framework, you need to work within this structure,
using the appropriate view methods and respecting the separation of concerns between actions, views, and templates.