Note:

This site is no longer used and is in read-only mode. Instead please go to our new Moodle Developer Resource site.

Course reports: Difference between revisions

From MoodleDocs
Course Report Plugins
 
This page will not be migrated to new devdocs
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
A course report plugin is just another folder inside course/report/
{{Template:WillNotMigrate}}


If there is a mod.html file inside there, it will be included with the others when you visit course/report.php?id={courseid} in your browser.
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.  


That HTML fragment can do anything you like. A common thing is to include a link to course/report/myreport/index.php. That's all it is, simple, and gives you almost unlimited flexibility.
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);
}
 
 
[[Category:Plugins]]

Latest revision as of 08:05, 10 February 2025


Warning: This page is no longer in use. The information contained on the page should NOT be seen as relevant or reliable.


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);
}