The Module class - all modules are to extend this class
All modules are to extend this class so that they can have access to all the objects of the application.
See Module::set_references() to see how these objects can be accessed without needing to extending this class.
If a module does not extend this class, it does not have easy access to these objects. Hence, it is recommended to extend this class though it is not enforced.
Module output is also automatically rendered by the controller. This simplifies output management. See Module::$output and Module::render().
Any exception actions need to be registered in the Module's constructor. See Module::$exceptions.
Located in /phpfw.php (line 3954)
| Class | Description |
|---|---|
| Config | Load and save configuration files |
| Login | The Login Module |
| MailServer | The MailServer Module |
| PelWrap | Wrapper for the PEL library |
Prevent the Module::render() function from running.
This method is useful if you'd like to control all the output directly from your module action instead of having Phpfw do it.
Disable usage of the template library to render the output of the module.
On calling this function, the Module::render() function generates the output using the View class instead of the templating library when it is specified in the configuration file. This allows to make exceptions. See an example of how this is used in the Login module.
This method can be called in a module's action to make an exception for that action or in the module's constructor to make the exception across all the module's actions.
Disable the View object usage in Module::render().
This method is useful if you are using AJAX functionality and do not require the Module to generate a complete HTML output.
Enable the Module::render() function.
This method restores the Phpfw default of rendering the output in the Module::render() function.
Enable usage of the template library to render the output of the module.
On calling this function, the Module::render() function generates the output using the templating library instead of the View class if a templating library is defined in the configuration. The default setting is to use the templating library if defined.
However, this method can be called by an action where the module disables the templating libraries across the board in its constructor using Module::disable_template_library(). As a result, the action can make an exception and still use the library if available.
This method should be called in a module's action to make an exception for that action assuming that the module constructor calls Module::disable_template_library().
Enable the View object usage in Module::render().
This method restores the Phpfw default of rendering the final output in Module::render() using the View object.
Execute another loaded module's action
Get the error strings registered by the Module
The controller automatically calls this function to register the error strings.
Get the exceptions registered by the Module
The controller automatically calls this function to register the exceptions.
Get the queries registered by the Module
The controller automatically calls this function to register the queries.
Get templating library paths
This function sets up the templating library's paths. It is called by Module::*_render() functions.
Reset the Module::$output
This function is called by the controller at load time. It is used to default initialize all members of the module.
Render the module output using PHPTAL
This function uses the associative array Module::$output populated by the called action and renders the template using PHPTAL.
The template file loaded depends on the current action being executed by the controller. Hence, if the User::show_details() action is being executed, the template file rendered by PHPTAL is User#show_details.html.
The output of the template is then returned.
This function is invoked by Module::render() when PHPTAL is used as the templating library. It can also be called directly to get the output from a template file in a module action.
Register a module error string
This function needs to be called in the Module's constructor. E.g.
See Error::display_error() for how the error strings can be used.
Register a module exception
This function needs to be called in the Module's constructor. E.g.
See Controller::$exceptions for how the exceptions are used.
Register a module SQL query
This function needs to be called in the Module's constructor. E.g.
See Sql::select_query() for how the queries can be used.
Render the module HTML output
The functionality of this method depends on whether a templating framework is in use or not:
The controller automatically calls this function. Do not call this function directly.
Set the references to the application objects
This function makes the objects in the application accessible to all deriving module classes.
Set a custom template file if using a templating library
The template file is auto-detected as Module#action. Using this function, it can be changed to a custom name. File extension is dependent on the templating library and does not need to be specified.
Render the module output using Smarty
This function uses the associative array Module::$output populated by the called action and renders the template using Smarty.
The template file loaded depends on the current action being executed by the controller. Hence, if the User::show_details() action is being executed, the template file rendered by Smarty is User#show_details.tpl.
The output of the template is then returned.
This function is invoked by Module::render() when Smarty is used as the templating library. It can also be called directly to get the output from a template file in a module action.
Documentation generated on Sat, 23 Jun 2007 21:28:26 -0500 by phpDocumentor 1.3.2