From 940f7b9171276ef5776a576aed12e730e674dd4a Mon Sep 17 00:00:00 2001 From: M Kassaei Date: Thu, 23 Aug 2012 17:58:56 +0100 Subject: [PATCH 1/2] MDL-35038 quiz reports: document the API changes in 2.3. --- mod/quiz/report/upgrade.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/mod/quiz/report/upgrade.txt b/mod/quiz/report/upgrade.txt index c12e7ff470b..0a3cdd7a58c 100644 --- a/mod/quiz/report/upgrade.txt +++ b/mod/quiz/report/upgrade.txt @@ -20,3 +20,24 @@ frequency should be defined in version.php, not in the quiz_reports table. === 2.3 === * Support for the old way of doing cron in a separate cron.php file has been removed. +You need a lib.php file inside the pluginneme (quiz report name) and a cron function +with the name quiz_pluginname_cron(), where pluginnme is the report name (e.g.: +quiz_statistics_cron()). + +* Some globally defined constants with the prefix "QUIZ_REPORT_ATTEMPTS_" are put inside +the abstract class "quiz_attempts_report" in Moodle 2.3.and they associate as follows: + +withis the classes drived from "quiz_attempts_report": + +parent::ALL_WITH replaces QUIZ_REPORT_ATTEMPTS_ALL +parent::ENROLLED_ALL replaces QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS +parent::ENROLLED_WITH replaces QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH +parent::ENROLLED_WITHOUT replaces QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO + +anywhere else: +quiz_attempts_report::ALL_WITH replaces QUIZ_REPORT_ATTEMPTS_ALL +quiz_attempts_report::ENROLLED_ALL replaces QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS +quiz_attempts_report::ENROLLED_WITH replaces QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH +quiz_attempts_report::ENROLLED_WITHOUT replaces QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO + +* The clas "quiz_attempt_report" ahd been renbamed as "quiz_attempts_report" From f8d354282c9510de20332c875b05de37a01d8eee Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 23 Aug 2012 18:26:43 +0100 Subject: [PATCH 2/2] MDL-35038 quiz reports: clarify the API changes docs. Also re-organise the file to put the most recent changes at the top. --- mod/quiz/report/upgrade.txt | 54 ++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/mod/quiz/report/upgrade.txt b/mod/quiz/report/upgrade.txt index 0a3cdd7a58c..d1821cac148 100644 --- a/mod/quiz/report/upgrade.txt +++ b/mod/quiz/report/upgrade.txt @@ -3,9 +3,34 @@ This files describes API changes for quiz report plugins. Overview of this plugin type at http://docs.moodle.org/dev/Quiz_reports -=== earlier versions === +=== 2.3 === -* ... API changes were not documented properly. Sorry. (There weren't many!) +* Support for the old way of doing cron in a separate cron.php file has been removed. +Instead, you need a lib.php file inside the plugin with a cron function +called quiz_myreportname_cron(). The statistics report is an example of how +it should be done. + +* There was a big refactor of the quiz reports, in issues MDL-32300, MDL-32322 and MDL-3030. +It is difficult to explain the changes. Probably the best way to understand what +happened is to look at + git log mod/quiz/report/overview + git log mod/quiz/report/responses +and so on. Here are some notes on a few of the changes: + +The class quiz_attempt_report was renamed to quiz_attempts_report (with an extra s). + +Some globally defined constants with the prefix QUIZ_REPORT_ATTEMPTS_ moved into +the quiz_attempts_report class. Specifically + +quiz_attempts_report::ALL_WITH replaces QUIZ_REPORT_ATTEMPTS_ALL +quiz_attempts_report::ENROLLED_ALL replaces QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS +quiz_attempts_report::ENROLLED_WITH replaces QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH +quiz_attempts_report::ENROLLED_WITHOUT replaces QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO + +Your if you have a table class, it needs to be renamed like +quiz_report_myreportname_table -> quiz_myreportname_table. That is, all the +class names in your plugin should start with the frankenstyle plugin name +quiz_myreportname. === 2.2 === @@ -17,27 +42,6 @@ This replaces the old way of having a separate cron.php file. Also, the cron frequency should be defined in version.php, not in the quiz_reports table. -=== 2.3 === +=== earlier versions === -* Support for the old way of doing cron in a separate cron.php file has been removed. -You need a lib.php file inside the pluginneme (quiz report name) and a cron function -with the name quiz_pluginname_cron(), where pluginnme is the report name (e.g.: -quiz_statistics_cron()). - -* Some globally defined constants with the prefix "QUIZ_REPORT_ATTEMPTS_" are put inside -the abstract class "quiz_attempts_report" in Moodle 2.3.and they associate as follows: - -withis the classes drived from "quiz_attempts_report": - -parent::ALL_WITH replaces QUIZ_REPORT_ATTEMPTS_ALL -parent::ENROLLED_ALL replaces QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS -parent::ENROLLED_WITH replaces QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH -parent::ENROLLED_WITHOUT replaces QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO - -anywhere else: -quiz_attempts_report::ALL_WITH replaces QUIZ_REPORT_ATTEMPTS_ALL -quiz_attempts_report::ENROLLED_ALL replaces QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS -quiz_attempts_report::ENROLLED_WITH replaces QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH -quiz_attempts_report::ENROLLED_WITHOUT replaces QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO - -* The clas "quiz_attempt_report" ahd been renbamed as "quiz_attempts_report" +* ... API changes were not documented properly. Sorry. (There weren't many!)