Course reports: Difference between revisions
m moved Course Report Plugins to Course reports |
added correct documentation for menu entries |
||
| Line 1: | Line 1: | ||
A course report plugin is just another folder inside course/report/. It follows standard plugin practice and may have lang, db etc. sub-folders if these are required. A version.php file must be included. | A course report plugin is just another folder inside course/report/. It follows standard plugin practice and may have lang, db etc. sub-folders if these are required. A version.php file must be included. | ||
In order to add a menu entry for your plugin, you must define a function named ''FOOBAR_report_extend_navigation'' in your ''lib.php'' file, where FOOBAR is your plugin name. | |||
For example, for a module named ''synopsis'' (coursereport_synopsis in standardized form), the code will be : | |||
function synopsis_report_extend_navigation($reportnav, $course, $context) { | |||
$url = new moodle_url('/course/report/synopsis/index.php', array('id' => $course->id)); | |||
$reportnav->add(get_string('Synopsis', 'coursereport_synopsis'), $url); | |||
} | |||
A mod.php file must be included. This is responsible for creating the HTML fragment that will appear on the course report page as one of the report options. This can be anything. Typically, it will simply generate a link to another page in the report folder (usually index.php) that produces the report. It may, like the logs report generate a form to be completed. | A mod.php file must be included. This is responsible for creating the HTML fragment that will appear on the course report page as one of the report options. This can be anything. Typically, it will simply generate a link to another page in the report folder (usually index.php) that produces the report. It may, like the logs report generate a form to be completed. | ||
[[Category:Plugins]] | [[Category:Plugins]] | ||
Revision as of 18:48, 20 July 2012
A course report plugin is just another folder inside course/report/. It follows standard plugin practice and may have lang, db etc. sub-folders if these are required. A version.php file must be included.
In order to add a menu entry for your plugin, you must define a function named FOOBAR_report_extend_navigation in your lib.php file, where FOOBAR is your plugin name. For example, for a module named synopsis (coursereport_synopsis in standardized form), the code will be :
function synopsis_report_extend_navigation($reportnav, $course, $context) {
$url = new moodle_url('/course/report/synopsis/index.php', array('id' => $course->id));
$reportnav->add(get_string('Synopsis', 'coursereport_synopsis'), $url);
}
A mod.php file must be included. This is responsible for creating the HTML fragment that will appear on the course report page as one of the report options. This can be anything. Typically, it will simply generate a link to another page in the report folder (usually index.php) that produces the report. It may, like the logs report generate a form to be completed.