MDL-76614 quiz: move quiz_access_manager -> mod_quiz\access_manager
[moodle.git] / mod / quiz / upgrade.txt
blobf9b020dabf0d09b3213176160ba83b3041780efa
1 This files describes API changes in the quiz code.
3 === 4.2 ===
5 * The quiz has a lot of old classes in lib.php files. These have now been moved into the classes folder,
6   and so are now in namespaces. Because of Moodle's class renaming support, your code should continue
7   working, but output deprecated warnings, so you probably want to update. This should mostly be
8   doable by adding use statements, and a search/replace.
9   - mod_quiz_display_options => mod_quiz\question\display_options
10   - qubaids_for_quiz => mod_quiz\question\qubaids_for_quiz
11   - qubaids_for_quiz_user => mod_quiz\question\qubaids_for_quiz_user - which is deprecated, because
12           it is almost the same as mod_quiz\question\qubaids_for_users_attempts.
13   - mod_quiz_admin_setting_browsersecurity => mod_quiz\admin\browser_security_setting
14   - mod_quiz_admin_setting_grademethod => mod_quiz\admin\grade_method_setting
15   - mod_quiz_admin_setting_overduehandling => mod_quiz\admin\overdue_handling_setting
16   - mod_quiz_admin_review_setting => mod_quiz\admin\review_setting
17   - mod_quiz_admin_setting_user_image => mod_quiz\admin\user_image_setting
18   - mod_quiz_admin_setting_browsersecurity => mod_quiz\admin\browser_security_setting
19   - mod_quiz_admin_setting_grademethod => mod_quiz\admin\grade_method_setting
20   - mod_quiz_admin_setting_overduehandling => mod_quiz\admin\overdue_handling_setting
21   - mod_quiz_admin_review_setting => mod_quiz\admin\review_setting
22   - mod_quiz_admin_setting_user_image => mod_quiz\admin\user_image_setting
23   - mod_quiz\adminpresets\adminpresets_mod_quiz_admin_setting_browsersecurity =>
24             mod_quiz\adminpresets\adminpresets_browser_security_setting
25   - mod_quiz\adminpresets/adminpresets_mod_quiz_admin_setting_grademethod =>
26             mod_quiz\adminpresets\adminpresets_grade_method_setting
27   - mod_quiz\adminpresets\adminpresets_mod_quiz_admin_setting_overduehandling =>
28             mod_quiz\adminpresets\adminpresets_overdue_handling_setting
29   - mod_quiz\adminpresets\adminpresets_mod_quiz_admin_review_setting =>
30             mod_quiz\adminpresets\adminpresets_review_setting
31   - mod_quiz\adminpresets\adminpresets_mod_quiz_admin_setting_user_image =>
32             mod_quiz\adminpresets\adminpresets_user_image_setting
33   - quiz_default_report => mod_quiz\local\reports\report_base
34   - quiz_attempts_report => mod_quiz\local\reports\attempts_report
35   - mod_quiz_attempts_report_form => mod_quiz\local\reports\attempts_report_options_form
36   - mod_quiz_attempts_report_options => mod_quiz\local\reports\attempts_report_options
37   - quiz_attempts_report_table => mod_quiz\local\reports\attempts_report_table
38   - quiz_access_manager => mod_quiz\access_manager
40 * As part of the clean-up, the following files are no longer required, and if you try to
41   include them, you will get a debugging notices telling you not to:
42   - mod/quiz/report/attemptsreport.php
43   - mod/quiz/report/attemptsreport_form.php
44   - mod/quiz/report/attemptsreport_options.php
45   - mod/quiz/report/attemptsreport_table.php
46   - mod/quiz/report/default.php
47   - mod/quiz/accessmanager.php
50 === 4.1 ===
52 * quiz_has_question_use is now deprecated. Use mod_quiz\structure::has_use_capability istead.
55 === 4.0.3, 4.1 ===
57 * 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
58 related to out of sequence question except while reviewing the quiz (MDL-75210).
60 === 4.0.2, 4.1 ===
62 * No external code should be calling quiz_overview_report::regrade_attempt because it is an
63   internal method of the quiz_overview plugin. But if you are incorrectly using it, be aware
64   that the API changed slightly. It now returns an array listing any questions which could
65   not be regraded.
66 * New method called get_number_of_unanswered_questions() has been added to mod/quiz/attemptlib.php
67   to get the total number of unanswered questions in the current attempt.
69 === 4.0 ===
71 * The following API methods have a new parameter, $studentisonline, to define whether the student is currently interacting:
72   - process_finish() in mod/quiz/attemptlib.php
73   - quiz_send_confirmation() in mod/quiz/locallib.php
74   - quiz_send_notification_messages() in mod/quiz/locallib.php
75 * The completionpass criteria has been moved to core as 'completionpassgrade'. Refer to completion/upgrade.txt for
76   further information.
77 * New argument quizhasquestions has been added to public methods: view_information in mod/quiz/renderer.php.
78 * The function no_questions_message() in class mod_quiz_renderer is deprecated. There is no replacement.
79 * Related to the Moodle 4.0 question bank changes, the quiz_slots database table.
80   The fields removed are now manage by new core_question tables:
81   - question_references -> Records where a specific question is used.
82   - question_set_references -> Records where groups of questions are used (e.g. random questions).
83 * The quiz_slots_tags database table has been removed entirely, as has the get_slot_tags_for_slot_id() method
84   from mod/quiz/classes/structure.php and the the locallib.php functions quiz_retrieve_slot_tags and
85   quiz_retrieve_slot_tag_ids. This information is now stored in question_set_references
86   and can be accessed in the results of qbank_helper::get_question_structure.
89 === 3.11 ===
91 * External function mod_quiz_external::get_user_best_grade now returns and additional optional field:
92   - gradetopass: The grade to pass the quiz (if set)
95 === 3.10.1 ===
97 * External functions mod_quiz_external::get_attempt_data, mod_quiz_external::get_attempt_summary
98   and mod_quiz_external::get_attempt_review now return a new additional optional field:
99    - settings: Containing the question definition settings for displaying the question in an external system.
101 === 3.10 ===
103 * External functions mod_quiz_external::get_attempt_data, mod_quiz_external::get_attempt_summary
104   and mod_quiz_external::get_attempt_review now return a new additional optional field:
105    - responsefileareas: Containing the user responses to questions file area names including files.
107 === 3.7 ===
109 * Quiz_cron() has been removed. Sub-plugins should implemented scheduled tasks, however legacy cron in subplugins are
110   supported.
112 === 3.6 ===
114 * The following renamed classes have been completely removed:
115   - quiz_question_bank_view (now: mod_quiz\question\bank\custom_view)
116   - question_bank_add_to_quiz_action_column (now: mod_quiz\question\bank\add_action_column)
117   - question_bank_question_name_text_column (now: mod_quiz\question\bank\question_name_text_column)
119 === 3.5 ===
120 * Removed questionbank.ajax.php. Please use the quiz_question_bank fragment instead.
121 * Adding "random" questions to a quiz via quiz_add_quiz_question() has been deprecated. Please use quiz_add_random_questions().
123 === 3.3.2 ===
125 * quiz_refresh_events() Now takes two additional parameters to refine the update to a specific instance. This function
126   now optionally takes the module instance object or ID, and the course module object or ID. Please try to send the full
127   objects instead of the ids to save DB calls.
129 === 3.2 ===
131 * External functions mod_quiz_external::get_attempt_data, mod_quiz_external::get_attempt_summary
132   and mod_quiz_external::get_attempt_review now return additional optional fields:
133    - blockedbyprevious: Whether a question is blocked by the previous question.
135 === 3.1 ===
137 * quiz_attempt::question_print_comment_fields() has been removed. It was broken
138   since at least Moodle 2.0.
140 * quiz::confirm_start_attempt_message and mod_quiz_view_object::$startattemptwarning
141   have been deprecated. This functionality is now entirely handled within the
142   quiz access rule plugins.
144 * The third argument to mod_quiz_renderer::start_attempt_button has been changed
145   from a warning string to a mod_quiz_preflight_check_form.
147 * mod_quiz_renderer::review_next_navigation has a new optional argument. If you
148   have overridden that method, consider updating your code to match.
150 * mod_quiz\output\edit_renderer::start_section_list now takes $structure as an
151   argument. If you have overridden this method (it's hard to believe anyone ever
152   would) you will need to update your renderer.
154 * Several methods relating to preview links/buttons/urls have a new optional
155   argument to make the preview be of a particular variant.
158 === 2.9 ===
160 * There have been changes in classes/output/edit_renderer.php for MDL-40990.
161   + Some methods use to take $structure & $question as the first two arguments.
162     They now take $structure & $slot number. If you need $question, you can get
163     it using $question = $structure->get_question_in_slot($slot);
164   + Some methods used to take $quiz & $question. They now take $structure & $slot
165     number. You can get $question as above. $quiz is $structure->get_quiz().
166   + initialise_editing_javascript has had some redundant arguments removed.
167   Hopefully, with these changes, we will have less need to make other changes in future.
169 * Due to MDL-40992, you should be aware that extra slots can get added to an attempt.
170   You may get slot numbers beyone the end of the original quiz layout, and you
171   may want to call $attemptobj->get_original_slot to find where the question
172   originally came from.
174 * You now need to pass an instance of the mod_quiz_renderer if you call
175   $attemptobj->render_question or $attemptobj->render_question_at_step.
177 * The array values in mod_quiz_links_to_other_attempts may now be either a moodle_url,
178   or renderable (or null). Previously they could only be a moodle_url or null.
180 * The contents of the navigation block is now not just quiz_nav_question_button-s.
181   It can also contain quiz_nav_section_heading-s. If you have overridden
182   mod_quiz_renderer::navigation_panel, then you may need to account for this.
183   This change also has implications for the Edit quiz page.
186 === 2.8 ===
188 * Classes that were defined in various lib files have been moved to the classes
189   folder to take advantage of auto-loading. This has involved renaming them.
190   see the list in mod/quiz/db/renamedclasses.php.
192 * The quiz no longer handles its own \mod_quiz\event\attempt_becameoverdue event,
193   and so the event handler function quiz_attempt_overdue_handler has been deleted.
194   Also, the internal function quiz_send_overdue_message has add the arguments
195   changed. It now takes the $attemptobj object, not separate stdClass objects.
197 * Major changes to the Edit quiz page.
199   The goal of this work was to increase usability, and also clean up the page
200   enough that it will be possible to add new features in future.
202   Display of mod/quiz/edit.php is now entirely generated by
203   mod_quiz\output\edit_renderer. This uses a helper class mod_quiz\structure
204   to provide details of the structure of the quiz, and mod_quiz\repaginate to
205   alter that structure. (Actually, there are still some modification methods on
206   mod_quiz\structure. Expect that to be cleaned up in future.)
208   The new code uses much more ajax, and there are new scripts mod/quiz/edit_rest.php
209   and mod/quiz/repaginate.php to handle this. (Again, don't be surprised if those
210   two scripts get merged in future.) Also questionbank.ajax.php (which may, in
211   future, be made more generic, and moved into the core question bank code.)
213   As a result of this, mod/quiz/editlib.php has gone. (A few remaining functions
214   were moved to locallib.php.)
216   Here is a list of all the old functions or classes that have changed.
217   If you used any of these in custom code, you will need to update your code.
218   (Note that many of these functions should have been considered private internals
219   of the quiz module, and you should not have been using them!)
221   From editlib.php:
222       quiz_remove_slot
223       quiz_delete_empty_page
224       quiz_add_page_break_after_slot    - Use methods of structure or repaginate
225       quiz_update_slot_maxmark          - classes instead.
226       _quiz_move_question
227       quiz_move_question_up
228       quiz_move_question_down
230       quiz_print_question_list
231       quiz_print_pagecontrols
232       quiz_print_singlequestion         - Use methods of edit_renderer instead.
233       quiz_print_randomquestion
234       quiz_print_singlequestion_reordertool
235       quiz_print_randomquestion_reordertool
236       print_random_option_icon
237       quiz_print_grading_form
238       quiz_print_status_bar
240   Moved from editlib.php to locallib.php:
241       quiz_question_tostring - now always returns a string (the only option used).
242                                The $return argument has gone.
244   Old editing JavaScript (e.g. mod/quiz/edit.js) is gone. Replaced with YUI modules.
247 === 2.7.1 ===
249 * The function quiz_fire_attempt_started_event has been removed. This function
250   should not have been used outside the quiz, but if you were using it, you should
251   trigger the event outside this function. Note that the appropriate start event is
252   fired automatically by the quiz_attempt_save_started function.
255 === 2.7 ===
257 * The old quiz.questions database column (comma-separated list of question ids)
258   is gone, and instead the quiz_question_instances table has been renamed to
259   to quiz_slots. Some of the columns of that table have been renamed to match
260   the coding guidelines. Specifically:
261       quiz     -> quizid
262       question -> questionid
263       grade    -> maxmark
264   also there are two new columns:
265       slot     -  numbers the questions in the quiz in order, as on the edit quiz page.
266       page     -  new way to determine which question is on which page.
267   naturally, other parts of the code and APIs have been updated to reflect that
268   change.
270 * The following functions, which were part of the internal workings of the quiz,
271   have been removed.
272       quiz_get_slot_for_question
273       quiz_number_of_questions_in_quiz
274       quiz_repaginate               (there is now a quiz_repaginate_questions with a different API).
275       quiz_add_page_break_at        (see quiz_add_page_break_after_slot)
276       quiz_add_page_break_after     (see quiz_add_page_break_after_slot)
277       quiz_number_of_pages
278       quiz_remove_question          (see quiz_remove_slot)
279       quiz_update_question_instance (see quiz_update_slot_maxmark)
281 * The following internal functions have had their API changed.
282       quiz_delete_empty_page: has had its arguments changed to $quiz and $pagenumber.
283       quiz_has_question_use: now takes $quiz and $slot, not $questionid.
286 === 2.6 ===
288 * As part of improving the page usability and accessibility, we updated the
289   heading levels for quiz module so it has a proper nesting. (MDL-41615)
291 * mod_quiz_renderer::view_best_score has been removed. (It did not do what the
292   name suggested anyway.)
295 === 2.4 ===
297 * mod_quiz_renderer::finish_review_link now requires $attemptobj to be passed in
298   instead of a moodle_url.
301 === Earlier changes ===
303 * Were not documented in this way. Sorry.