weekly release 4.5dev
[moodle.git] / mod / quiz / upgrade.txt
blob69a39dc53aa5e510d058d2e83fe5e74161e74899
1 === 4.5 Onwards ===
3 This file has been replaced by UPGRADING.md. See MDL-81125 for further information.
5 ===
6 This file describes API changes in the quiz code.
8 === 4.4 ===
9 * A quiz_structure_modified callback has been added for quiz_ plugins, called from
10   grade_calculator::recompute_quiz_sumgrades(). Plugins can implement this by creating a `quiz_structure_modified`
11   class in their namespace with a static `callback` method, see quiz_statistics as an example.
12 * External functions returning question information, currently get_attempt_summary(), get_attempt_data() and get_attemp_review()
13   now return a new field called "stateclass". A machine-readable class name for the state that this question attempt is in,
14   as returned by question_usage_by_activity::get_question_state_class().
15 * External function mod_quiz_external::get_attempt_summary() now returns a new field "totalunanswered", with the total number of
16   unanswered questions.
17 * quiz_settings::no_review_message now takes a new argument $attemptsubmittime for the time when the quiz attempt was
18   submitted. It is strongly recommended that you always pass that.
19 * In the renderer, related to rendering the review page, review_summary_table and filter_review_summary_table have been
20   replaced by review_attempt_summary and filter_review_attempt_summary. This is to support changing the $summarydata argument
21   the review_page() method to an instance of a new templateable class attempt_summary_information for displaying this.
22   The $summarydata argument of review_question_page has also been changed to an attempt_summary_information.
23 * In the renderer, the view_table has been deprecated. Please use the list_of_attempts renderable instead.
24 * There is a new function qbank_helper::get_version_information_for_questions_in_attempt to efficiently
25   check whether each question in an attempt is using the latest versions. This is used by re-grading,
26   replacing some old code there, and to update teacher previews automatically.
27 * The following previously deprecated methods have been removed and can no longer be used:
28   - `get_slot_tags_for_slot_id`
29   - `quiz_retrieve_tags_for_slot_ids`
30 * Quiz override logic has been refactored and put in a new override_manager class.
31 * Quiz override cache should now be accessed using the new override_cache class.
32 * The quiz_delete_overrides and quiz_delete_all_overrides functions are now deprecated. Please instead use:
33   - override_manager::delete_override_by_id
34   - override_manager::delete_overrides
35   - override_manager::delete_all_overrides
36 * There is a new renderable grade_out_of to help with display a nicely formatted "42.00 out of 100.00" with a few variants.
37 * The quiz now supports computing multiple total grades for each attempt. To support this there is a new database table
38   quiz_grade_items and a new column quizgradeitemid in quiz_slots. There are new methods in structure grade_calculator
39   and quiz_attempt to support this, and the new grades are shown on review.php, view.php and in some of the quiz reports.
40   Also, the external functions get_attempt_review and get_user_attempts return the information about the extra grades if applicable.
42 === 4.3 ===
44 * The method get_questions() has a new parameter 'requirequestionfullyloaded' which can be used to instruct whether the
45   questions should be fully loaded or not.
46 * the quiz_settings and quiz_attempt classes now always store the ->cm property as a cm_info class.
47   In the distant past it was always a stdClass, then at one point there was an undocumented change making
48   it sometimes a stdClass and sometimes a cm_info. Now it is consistently a cm_info. Type hints have been
49   updated to reflect this.
50 * The parameter filtercondition in the web service mod_quiz_add_random_questions is now optional. This parameter is
51   only used when adding random questions from an existing category. It is not required when adding random questions from
52   a new category since it is not used in this case.
54 === 4.2 ===
56 * For the three quiz web services: mod_quiz_get_attempt_data, mod_quiz_get_attempt_summary and
57   mod_quiz_get_attempt_review, the ->number property of each question is now deprecated
58   (It had the wrong time and was documented wrongly.) In the future, please use the new property
59   ->questionnumber. Note, this question 'number' can include any string (e.g. 'Qs 1 & 2') so it is
60   important to applying htmlspecialchars, or equivalent, to the value if you are outputting to HTML.
62 * The methods in the quiz_settings class which return a URL now all return a moodle_url. Previously
63   some returns a moodle_url and others aa string.
65 * 'firstslotid' value is not used in section_shuffle_updated event anymore.
67 * The quiz has a lot of old classes in lib.php files. These have now been moved into the classes folder,
68   and so are now in namespaces. Because of Moodle's class renaming support, your code should continue
69   working, but output deprecated warnings, so you probably want to update. This should mostly be
70   doable by adding use statements, and a search/replace.
71   - mod_quiz_display_options => mod_quiz\question\display_options
72   - qubaids_for_quiz => mod_quiz\question\qubaids_for_quiz
73   - qubaids_for_quiz_user => mod_quiz\question\qubaids_for_quiz_user - which is deprecated, because
74           it is almost the same as mod_quiz\question\qubaids_for_users_attempts.
75   - mod_quiz_admin_setting_browsersecurity => mod_quiz\admin\browser_security_setting
76   - mod_quiz_admin_setting_grademethod => mod_quiz\admin\grade_method_setting
77   - mod_quiz_admin_setting_overduehandling => mod_quiz\admin\overdue_handling_setting
78   - mod_quiz_admin_review_setting => mod_quiz\admin\review_setting
79   - mod_quiz_admin_setting_user_image => mod_quiz\admin\user_image_setting
80   - mod_quiz_admin_setting_browsersecurity => mod_quiz\admin\browser_security_setting
81   - mod_quiz_admin_setting_grademethod => mod_quiz\admin\grade_method_setting
82   - mod_quiz_admin_setting_overduehandling => mod_quiz\admin\overdue_handling_setting
83   - mod_quiz_admin_review_setting => mod_quiz\admin\review_setting
84   - mod_quiz_admin_setting_user_image => mod_quiz\admin\user_image_setting
85   - mod_quiz\adminpresets\adminpresets_mod_quiz_admin_setting_browsersecurity =>
86             mod_quiz\adminpresets\adminpresets_browser_security_setting
87   - mod_quiz\adminpresets/adminpresets_mod_quiz_admin_setting_grademethod =>
88             mod_quiz\adminpresets\adminpresets_grade_method_setting
89   - mod_quiz\adminpresets\adminpresets_mod_quiz_admin_setting_overduehandling =>
90             mod_quiz\adminpresets\adminpresets_overdue_handling_setting
91   - mod_quiz\adminpresets\adminpresets_mod_quiz_admin_review_setting =>
92             mod_quiz\adminpresets\adminpresets_review_setting
93   - mod_quiz\adminpresets\adminpresets_mod_quiz_admin_setting_user_image =>
94             mod_quiz\adminpresets\adminpresets_user_image_setting
95   - quiz_default_report => mod_quiz\local\reports\report_base
96   - quiz_attempts_report => mod_quiz\local\reports\attempts_report
97   - mod_quiz_attempts_report_form => mod_quiz\local\reports\attempts_report_options_form
98   - mod_quiz_attempts_report_options => mod_quiz\local\reports\attempts_report_options
99   - quiz_attempts_report_table => mod_quiz\local\reports\attempts_report_table
100   - quiz_access_manager => mod_quiz\access_manager
101   - mod_quiz_preflight_check_form => mod_quiz\form\preflight_check_form
102   - quiz_override_form => mod_quiz\form\edit_override_form
103   - quiz_access_rule_base => mod_quiz\local\access_rule_base
104   - quiz_add_random_form => mod_quiz\form\add_random_form
105   - mod_quiz_links_to_other_attempts => mod_quiz\output\links_to_other_attempts
106   - mod_quiz_view_object => mod_quiz\output\view_page
107   - mod_quiz_renderer => mod_quiz\output\renderer
108   - quiz_nav_question_button => mod_quiz\output\navigation_question_button
109   - quiz_nav_section_heading => mod_quiz\output\navigation_section_heading
110   - quiz_nav_panel_base => mod_quiz\output\navigation_panel_base
111   - quiz_attempt_nav_panel => mod_quiz\output\navigation_panel_attempt
112   - quiz_review_nav_panel => mod_quiz\output\navigation_panel_review
113   - quiz_attempt => mod_quiz\quiz_attempt
114   - quiz => mod_quiz\quiz_settings
115   - quizaccess_seb\quiz_settings => quizaccess_seb\seb_quiz_settings
116   - quizaccess_seb\access_manager => quizaccess_seb\seb_access_manager
118 * The following classes have been deprecated:
119   - mod_quiz_overdue_attempt_updater - merged into mod_quiz\task\update_overdue_attempts
120   - moodle_quiz_exception - just use normal moodle_exception
122 * As part of the clean-up, the following files are no longer required, and if you try to
123   include them, you will get a debugging notices telling you not to:
124   - mod/quiz/report/attemptsreport.php
125   - mod/quiz/report/attemptsreport_form.php
126   - mod/quiz/report/attemptsreport_options.php
127   - mod/quiz/report/attemptsreport_table.php
128   - mod/quiz/report/default.php
129   - mod/quiz/accessmanager.php
130   - mod/quiz/accessmanager_form.php
131   - mod/quiz/cronlib.php
132   - mod/quiz/override_form.php
133   - mod/quiz/accessrule/accessrulebase.php
134   - mod/quiz/renderer.php - actually, no debugging ouput for this one because of how renderer factories work.
135   - mod/quiz/attemptlib.php
137 * Various functions related to calculating grades have moved into a new class mod_quiz\grade_calculator.
138   You get that using $quizobj->get_grade_calculator(), then the following old functions have become these new methods.
139   - quiz_update_sumgrades -> recompute_quiz_sumgrades
140   - quiz_update_all_attempt_sumgrades -> recompute_all_attempt_sumgrades
141   - quiz_update_all_final_grades -> recompute_all_final_grades
142   - quiz_set_grade -> update_quiz_maximum_grade
143   - quiz_save_best_grade -> recompute_final_grade
144   - quiz_calculate_best_grade -> [no public direct replacement]
145   - quiz_calculate_best_attempt - [no replacement. It was not used.]
147 * Final deprecation (complete removal) of the following functions which were deprecated long ago:
148   - quiz_groups_member_added_handler - deprecated since 2.6
149   - quiz_groups_member_removed_handler - deprecated since 2.6
150   - quiz_groups_group_deleted_handler - deprecated since 2.6
151   - quiz_groups_members_removed_handler - deprecated since 2.6
152   - The method quiz_settings::confirm_start_attempt_message - deprecated in Moodle 3.1
153   - The field view_page::$startattemptwarning - deprecated in Moodle 3.1
154   - attempts_report::load_relevant_students - deprecated since 3.2
155   - quiz_statistics_graph_get_new_colour - deprecated since 3.2
156   - The file mod/quiz/report/overview/overviewgraph.php - deprecated since 3.2
157   - The file mod/quiz/report/statistics/statistics_graph.php - deprecated since 3.2
158   - quiz_print_overview - deprecated since 3.3
160 * For properties that were previously only declared dynamically, a few classes now include property declarations to support PHP 8.2.
161   The affected classes are:
162    - restore_quiz_activity_structure_step
163    - attempts_report_table
164    - attempts_report
165    - quiz_overview_report (Removing $hasgroupstudents, because the parent attempts_report class has the same variable.)
167 === 4.1 ===
169 * quiz_has_question_use is now deprecated. Use mod_quiz\structure::has_use_capability istead.
172 === 4.0.3, 4.1 ===
174 * If a quiz is sequential the external functions mod_quiz_external::get_attempt_data, mod_quiz_external::get_attempt_summary will not return any data
175 related to out of sequence question except while reviewing the quiz (MDL-75210).
177 === 4.0.2, 4.1 ===
179 * No external code should be calling quiz_overview_report::regrade_attempt because it is an
180   internal method of the quiz_overview plugin. But if you are incorrectly using it, be aware
181   that the API changed slightly. It now returns an array listing any questions which could
182   not be regraded.
183 * New method called get_number_of_unanswered_questions() has been added to mod/quiz/attemptlib.php
184   to get the total number of unanswered questions in the current attempt.
186 === 4.0 ===
188 * The following API methods have a new parameter, $studentisonline, to define whether the student is currently interacting:
189   - process_finish() in mod/quiz/attemptlib.php
190   - quiz_send_confirmation() in mod/quiz/locallib.php
191   - quiz_send_notification_messages() in mod/quiz/locallib.php
192 * The completionpass criteria has been moved to core as 'completionpassgrade'. Refer to completion/upgrade.txt for
193   further information.
194 * New argument quizhasquestions has been added to public methods: view_information in mod/quiz/renderer.php.
195 * The function no_questions_message() in class mod_quiz_renderer is deprecated. There is no replacement.
196 * Related to the Moodle 4.0 question bank changes, the quiz_slots database table.
197   The fields removed are now manage by new core_question tables:
198   - question_references -> Records where a specific question is used.
199   - question_set_references -> Records where groups of questions are used (e.g. random questions).
200 * The quiz_slots_tags database table has been removed entirely, as has the get_slot_tags_for_slot_id() method
201   from mod/quiz/classes/structure.php and the the locallib.php functions quiz_retrieve_slot_tags and
202   quiz_retrieve_slot_tag_ids. This information is now stored in question_set_references
203   and can be accessed in the results of qbank_helper::get_question_structure.
206 === 3.11 ===
208 * External function mod_quiz_external::get_user_best_grade now returns and additional optional field:
209   - gradetopass: The grade to pass the quiz (if set)
212 === 3.10.1 ===
214 * External functions mod_quiz_external::get_attempt_data, mod_quiz_external::get_attempt_summary
215   and mod_quiz_external::get_attempt_review now return a new additional optional field:
216    - settings: Containing the question definition settings for displaying the question in an external system.
218 === 3.10 ===
220 * External functions mod_quiz_external::get_attempt_data, mod_quiz_external::get_attempt_summary
221   and mod_quiz_external::get_attempt_review now return a new additional optional field:
222    - responsefileareas: Containing the user responses to questions file area names including files.
224 === 3.7 ===
226 * Quiz_cron() has been removed. Sub-plugins should implemented scheduled tasks, however legacy cron in subplugins are
227   supported.
229 === 3.6 ===
231 * The following renamed classes have been completely removed:
232   - quiz_question_bank_view (now: mod_quiz\question\bank\custom_view)
233   - question_bank_add_to_quiz_action_column (now: mod_quiz\question\bank\add_action_column)
234   - question_bank_question_name_text_column (now: mod_quiz\question\bank\question_name_text_column)
236 === 3.5 ===
237 * Removed questionbank.ajax.php. Please use the quiz_question_bank fragment instead.
238 * Adding "random" questions to a quiz via quiz_add_quiz_question() has been deprecated. Please use quiz_add_random_questions().
240 === 3.3.2 ===
242 * quiz_refresh_events() Now takes two additional parameters to refine the update to a specific instance. This function
243   now optionally takes the module instance object or ID, and the course module object or ID. Please try to send the full
244   objects instead of the ids to save DB calls.
246 === 3.2 ===
248 * External functions mod_quiz_external::get_attempt_data, mod_quiz_external::get_attempt_summary
249   and mod_quiz_external::get_attempt_review now return additional optional fields:
250    - blockedbyprevious: Whether a question is blocked by the previous question.
252 === 3.1 ===
254 * quiz_attempt::question_print_comment_fields() has been removed. It was broken
255   since at least Moodle 2.0.
257 * quiz::confirm_start_attempt_message and mod_quiz_view_object::$startattemptwarning
258   have been deprecated. This functionality is now entirely handled within the
259   quiz access rule plugins.
261 * The third argument to mod_quiz_renderer::start_attempt_button has been changed
262   from a warning string to a mod_quiz_preflight_check_form.
264 * mod_quiz_renderer::review_next_navigation has a new optional argument. If you
265   have overridden that method, consider updating your code to match.
267 * mod_quiz\output\edit_renderer::start_section_list now takes $structure as an
268   argument. If you have overridden this method (it's hard to believe anyone ever
269   would) you will need to update your renderer.
271 * Several methods relating to preview links/buttons/urls have a new optional
272   argument to make the preview be of a particular variant.
275 === 2.9 ===
277 * There have been changes in classes/output/edit_renderer.php for MDL-40990.
278   + Some methods use to take $structure & $question as the first two arguments.
279     They now take $structure & $slot number. If you need $question, you can get
280     it using $question = $structure->get_question_in_slot($slot);
281   + Some methods used to take $quiz & $question. They now take $structure & $slot
282     number. You can get $question as above. $quiz is $structure->get_quiz().
283   + initialise_editing_javascript has had some redundant arguments removed.
284   Hopefully, with these changes, we will have less need to make other changes in future.
286 * Due to MDL-40992, you should be aware that extra slots can get added to an attempt.
287   You may get slot numbers beyone the end of the original quiz layout, and you
288   may want to call $attemptobj->get_original_slot to find where the question
289   originally came from.
291 * You now need to pass an instance of the mod_quiz_renderer if you call
292   $attemptobj->render_question or $attemptobj->render_question_at_step.
294 * The array values in mod_quiz_links_to_other_attempts may now be either a moodle_url,
295   or renderable (or null). Previously they could only be a moodle_url or null.
297 * The contents of the navigation block is now not just quiz_nav_question_button-s.
298   It can also contain quiz_nav_section_heading-s. If you have overridden
299   mod_quiz_renderer::navigation_panel, then you may need to account for this.
300   This change also has implications for the Edit quiz page.
303 === 2.8 ===
305 * Classes that were defined in various lib files have been moved to the classes
306   folder to take advantage of auto-loading. This has involved renaming them.
307   see the list in mod/quiz/db/renamedclasses.php.
309 * The quiz no longer handles its own \mod_quiz\event\attempt_becameoverdue event,
310   and so the event handler function quiz_attempt_overdue_handler has been deleted.
311   Also, the internal function quiz_send_overdue_message has add the arguments
312   changed. It now takes the $attemptobj object, not separate stdClass objects.
314 * Major changes to the Edit quiz page.
316   The goal of this work was to increase usability, and also clean up the page
317   enough that it will be possible to add new features in future.
319   Display of mod/quiz/edit.php is now entirely generated by
320   mod_quiz\output\edit_renderer. This uses a helper class mod_quiz\structure
321   to provide details of the structure of the quiz, and mod_quiz\repaginate to
322   alter that structure. (Actually, there are still some modification methods on
323   mod_quiz\structure. Expect that to be cleaned up in future.)
325   The new code uses much more ajax, and there are new scripts mod/quiz/edit_rest.php
326   and mod/quiz/repaginate.php to handle this. (Again, don't be surprised if those
327   two scripts get merged in future.) Also questionbank.ajax.php (which may, in
328   future, be made more generic, and moved into the core question bank code.)
330   As a result of this, mod/quiz/editlib.php has gone. (A few remaining functions
331   were moved to locallib.php.)
333   Here is a list of all the old functions or classes that have changed.
334   If you used any of these in custom code, you will need to update your code.
335   (Note that many of these functions should have been considered private internals
336   of the quiz module, and you should not have been using them!)
338   From editlib.php:
339       quiz_remove_slot
340       quiz_delete_empty_page
341       quiz_add_page_break_after_slot    - Use methods of structure or repaginate
342       quiz_update_slot_maxmark          - classes instead.
343       _quiz_move_question
344       quiz_move_question_up
345       quiz_move_question_down
347       quiz_print_question_list
348       quiz_print_pagecontrols
349       quiz_print_singlequestion         - Use methods of edit_renderer instead.
350       quiz_print_randomquestion
351       quiz_print_singlequestion_reordertool
352       quiz_print_randomquestion_reordertool
353       print_random_option_icon
354       quiz_print_grading_form
355       quiz_print_status_bar
357   Moved from editlib.php to locallib.php:
358       quiz_question_tostring - now always returns a string (the only option used).
359                                The $return argument has gone.
361   Old editing JavaScript (e.g. mod/quiz/edit.js) is gone. Replaced with YUI modules.
364 === 2.7.1 ===
366 * The function quiz_fire_attempt_started_event has been removed. This function
367   should not have been used outside the quiz, but if you were using it, you should
368   trigger the event outside this function. Note that the appropriate start event is
369   fired automatically by the quiz_attempt_save_started function.
372 === 2.7 ===
374 * The old quiz.questions database column (comma-separated list of question ids)
375   is gone, and instead the quiz_question_instances table has been renamed to
376   to quiz_slots. Some of the columns of that table have been renamed to match
377   the coding guidelines. Specifically:
378       quiz     -> quizid
379       question -> questionid
380       grade    -> maxmark
381   also there are two new columns:
382       slot     -  numbers the questions in the quiz in order, as on the edit quiz page.
383       page     -  new way to determine which question is on which page.
384   naturally, other parts of the code and APIs have been updated to reflect that
385   change.
387 * The following functions, which were part of the internal workings of the quiz,
388   have been removed.
389       quiz_get_slot_for_question
390       quiz_number_of_questions_in_quiz
391       quiz_repaginate               (there is now a quiz_repaginate_questions with a different API).
392       quiz_add_page_break_at        (see quiz_add_page_break_after_slot)
393       quiz_add_page_break_after     (see quiz_add_page_break_after_slot)
394       quiz_number_of_pages
395       quiz_remove_question          (see quiz_remove_slot)
396       quiz_update_question_instance (see quiz_update_slot_maxmark)
398 * The following internal functions have had their API changed.
399       quiz_delete_empty_page: has had its arguments changed to $quiz and $pagenumber.
400       quiz_has_question_use: now takes $quiz and $slot, not $questionid.
403 === 2.6 ===
405 * As part of improving the page usability and accessibility, we updated the
406   heading levels for quiz module so it has a proper nesting. (MDL-41615)
408 * mod_quiz_renderer::view_best_score has been removed. (It did not do what the
409   name suggested anyway.)
412 === 2.4 ===
414 * mod_quiz_renderer::finish_review_link now requires $attemptobj to be passed in
415   instead of a moodle_url.
418 === Earlier changes ===
420 * Were not documented in this way. Sorry.