Provide a new API function [modulename]_view() that returns the display code for the specific module. This display code is HTML in-line code that is included within the body of a page display. It assumes that the HTTP
headers, and the HTML page information (headers, body tags) will be created by the calling chain that calls it.
The benefits of this is that new functionality, such as custom course formats, can include a module display within its own pages. Currently, the only "standard" way of displaying a module is through its 'view.php' stand-alone file, whic displays and entire page.
Function Spec:
/**
* Module display function
*
* Function to provide the HTML output for displaying this module. The output is assumed to used
* within a page being constructed elesewhere.
*
* @param cmid integer, the current course module id
* @param [module] object, usually null, but if we have it we pass it to save db access
* @param cm object, usually null, but if we have it we pass it to save db access
* @param course object, usually null, but if we have it we pass it to save db access
*/
function [module]_view($cmid=0, $[module]=NULL, $cm=NULL, $course=NULL)Changes:
Every module that wishes to take advantage of this will provide a 'view' function that provided all of the logic the current 'view.php' does, minus the header and footer output. The 'view.php' will then be modified to use this function. Modules that don't have this function will continue to work in the standard way.
Plan:
Modify all standard Moodle modules to use this method.
Post new function spec in developers forum for third party module maintainers.
Release new code into HEAD.
If agreed, we will undertake this immediately.