Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

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:

  1. copy all files to new /report/yourplugin/ location
  2. if settings.php exists add $settings=null;
  3. if settings.php does not exist create it and link the report, index.php is not linked automatically any more
  4. update require('../../config.php'); - remove one ../
  5. update all others includes and requires
  6. update all links to report pages by removing /admin/ or /$CFG->admin/
  7. add language pack with at least 'pluginname' string
  8. update CSS selectors

How to migrate existing course reports (optional):

  1. copy all files to new /report/yourplugin/ location
  2. update require('../../config.php'); - remove one ../
  3. update all others includes and requires
  4. update all links to report pages by removing /course/ part
  5. update all language strings (use 'report_yourplugin' instead of 'coursereport_yourplugin')
  6. update all capability names
  7. grep the plugin codebase and look for any remaining 'coursereport' occurrences
  8. add new navigation hooks in lib.php - ex: report_stats_extend_navigation_course(), report_stats_extend_navigation_user()
  9. add new page types in lib.php
  10. create db/install.php migration script - delete old settings and capabilities (see converted plugins for examples)
  11. 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.