General report plugins
From MoodleDocs
General report plugins | |
---|---|
Project state | Implemented |
Tracker issue | MDL-29030 |
Discussion | n/a |
Assignee | Petr Škoda (škoďák) |
Moodle 2.2
Previous problems
Before 2.2 we had course reports, admin reports and hardcoded user reports:
- only two contexts fully supported (system and course)
- hardcoded user reports
- nonstandard admin reports
- missing admin management of reports (enable, disable, uninstall, etc.)
- non-report plugins included in admin reports (customlang, splamcleaner)
Benefits
- standardised /report/ plugin type is good starting place for development of new reports that we need really badly
- reports can be context oriented - we need custom reports at all levels, especially user context
- cleanup in /admin/
Upgrades
How to migrate existing admin reports:
- copy all files to new /report/yourplugin/ location
- if settings.php exists add $settings=null;
- if settings.php does not exist create it and link the report, index.php is not linked automatically any more
- update require('../../config.php'); - remove one ../
- update all others includes and requires
- update all links to report pages by removing /admin/ or /$CFG->admin/
- add language pack with at least 'pluginname' string
- update CSS selectors
How to migrate existing course reports (optional):
- copy all files to new /report/yourplugin/ location
- update require('../../config.php'); - remove one ../
- update all others includes and requires
- update all links to report pages by removing /course/ part
- update all language strings (use 'report_yourplugin' instead of 'coursereport_yourplugin')
- update all capability names
- grep the plugin codebase and look for any remaining 'coursereport' occurrences
- add new navigation hooks in lib.php - ex: report_stats_extend_navigation_course(), report_stats_extend_navigation_user()
- add new page types in lib.php
- create db/install.php migration script - delete old settings and capabilities (see converted plugins for examples)
- update CSS selectors
FAQs
- Are gradebook reports affected?
- No. Gradebook reports are more specialised and may allow modification of data.
- Is it necessary to migrate existing admin reports?
- Yes. Old admin reports directory is completely ignored.
- Is it difficult to migrate admin reports?
- No, it takes less than an hour to migrate and test old admin reports.
- Is it necessary to migrate all course reports for 2.2
- No. The course reports were deprecated in 2.2, but the support for them will be removed later in 2.3.
- What is the difference between report and admin tool?
- Report is a view of live or historical data, it may also contain export feature, standard reports do not modify data usually. Admin tools intended mostly for administrators, they usually work only in system context.