MDL-63497 mod_feedback: Add support for removal of context users
[moodle.git] / mod / quiz / upgrade.txt
blobf0265b024c5b3bac4c344754ea85762ad0d38c93
1 This files describes API changes in the quiz code.
3 === 3.6 ===
5 * The following renamed classes have been completely removed:
6   - quiz_question_bank_view (now: mod_quiz\question\bank\custom_view)
7   - question_bank_add_to_quiz_action_column (now: mod_quiz\question\bank\add_action_column)
8   - question_bank_question_name_text_column (now: mod_quiz\question\bank\question_name_text_column)
10 === 3.5 ===
11 * Removed questionbank.ajax.php. Please use the quiz_question_bank fragment instead.
12 * Adding "random" questions to a quiz via quiz_add_quiz_question() has been deprecated. Please use quiz_add_random_questions().
14 === 3.3.2 ===
16 * quiz_refresh_events() Now takes two additional parameters to refine the update to a specific instance. This function
17   now optionally takes the module instance object or ID, and the course module object or ID. Please try to send the full
18   objects instead of the ids to save DB calls.
20 === 3.2 ===
22 * External functions mod_quiz_external::get_attempt_data, mod_quiz_external::get_attempt_summary
23   and mod_quiz_external::get_attempt_review now return additional optional fields:
24    - blockedbyprevious: Whether a question is blocked by the previous question.
26 === 3.1 ===
28 * quiz_attempt::question_print_comment_fields() has been removed. It was broken
29   since at least Moodle 2.0.
31 * quiz::confirm_start_attempt_message and mod_quiz_view_object::$startattemptwarning
32   have been deprecated. This functionality is now entirely handled within the
33   quiz access rule plugins.
35 * The third argument to mod_quiz_renderer::start_attempt_button has been changed
36   from a warning string to a mod_quiz_preflight_check_form.
38 * mod_quiz_renderer::review_next_navigation has a new optional argument. If you
39   have overridden that method, consider updating your code to match.
41 * mod_quiz\output\edit_renderer::start_section_list now takes $structure as an
42   argument. If you have overridden this method (it's hard to believe anyone ever
43   would) you will need to update your renderer.
45 * Several methods relating to preview links/buttons/urls have a new optional
46   argument to make the preview be of a particular variant.
49 === 2.9 ===
51 * There have been changes in classes/output/edit_renderer.php for MDL-40990.
52   + Some methods use to take $structure & $question as the first two arguments.
53     They now take $structure & $slot number. If you need $question, you can get
54     it using $question = $structure->get_question_in_slot($slot);
55   + Some methods used to take $quiz & $question. They now take $structure & $slot
56     number. You can get $question as above. $quiz is $structure->get_quiz().
57   + initialise_editing_javascript has had some redundant arguments removed.
58   Hopefully, with these changes, we will have less need to make other changes in future.
60 * Due to MDL-40992, you should be aware that extra slots can get added to an attempt.
61   You may get slot numbers beyone the end of the original quiz layout, and you
62   may want to call $attemptobj->get_original_slot to find where the question
63   originally came from.
65 * You now need to pass an instance of the mod_quiz_renderer if you call
66   $attemptobj->render_question or $attemptobj->render_question_at_step.
68 * The array values in mod_quiz_links_to_other_attempts may now be either a moodle_url,
69   or renderable (or null). Previously they could only be a moodle_url or null.
71 * The contents of the navigation block is now not just quiz_nav_question_button-s.
72   It can also contain quiz_nav_section_heading-s. If you have overridden
73   mod_quiz_renderer::navigation_panel, then you may need to account for this.
74   This change also has implications for the Edit quiz page.
77 === 2.8 ===
79 * Classes that were defined in various lib files have been moved to the classes
80   folder to take advantage of auto-loading. This has involved renaming them.
81   see the list in mod/quiz/db/renamedclasses.php.
83 * The quiz no longer handles its own \mod_quiz\event\attempt_becameoverdue event,
84   and so the event handler function quiz_attempt_overdue_handler has been deleted.
85   Also, the internal function quiz_send_overdue_message has add the arguments
86   changed. It now takes the $attemptobj object, not separate stdClass objects.
88 * Major changes to the Edit quiz page.
90   The goal of this work was to increase usability, and also clean up the page
91   enough that it will be possible to add new features in future.
93   Display of mod/quiz/edit.php is now entirely generated by
94   mod_quiz\output\edit_renderer. This uses a helper class mod_quiz\structure
95   to provide details of the structure of the quiz, and mod_quiz\repaginate to
96   alter that structure. (Actually, there are still some modification methods on
97   mod_quiz\structure. Expect that to be cleaned up in future.)
99   The new code uses much more ajax, and there are new scripts mod/quiz/edit_rest.php
100   and mod/quiz/repaginate.php to handle this. (Again, don't be surprised if those
101   two scripts get merged in future.) Also questionbank.ajax.php (which may, in
102   future, be made more generic, and moved into the core question bank code.)
104   As a result of this, mod/quiz/editlib.php has gone. (A few remaining functions
105   were moved to locallib.php.)
107   Here is a list of all the old functions or classes that have changed.
108   If you used any of these in custom code, you will need to update your code.
109   (Note that many of these functions should have been considered private internals
110   of the quiz module, and you should not have been using them!)
112   From editlib.php:
113       quiz_remove_slot
114       quiz_delete_empty_page
115       quiz_add_page_break_after_slot    - Use methods of structure or repaginate
116       quiz_update_slot_maxmark          - classes instead.
117       _quiz_move_question
118       quiz_move_question_up
119       quiz_move_question_down
121       quiz_print_question_list
122       quiz_print_pagecontrols
123       quiz_print_singlequestion         - Use methods of edit_renderer instead.
124       quiz_print_randomquestion
125       quiz_print_singlequestion_reordertool
126       quiz_print_randomquestion_reordertool
127       print_random_option_icon
128       quiz_print_grading_form
129       quiz_print_status_bar
131   Moved from editlib.php to locallib.php:
132       quiz_question_tostring - now always returns a string (the only option used).
133                                The $return argument has gone.
135   Old editing JavaScript (e.g. mod/quiz/edit.js) is gone. Replaced with YUI modules.
138 === 2.7.1 ===
140 * The function quiz_fire_attempt_started_event has been removed. This function
141   should not have been used outside the quiz, but if you were using it, you should
142   trigger the event outside this function. Note that the appropriate start event is
143   fired automatically by the quiz_attempt_save_started function.
146 === 2.7 ===
148 * The old quiz.questions database column (comma-separated list of question ids)
149   is gone, and instead the quiz_question_instances table has been renamed to
150   to quiz_slots. Some of the columns of that table have been renamed to match
151   the coding guidelines. Specifically:
152       quiz     -> quizid
153       question -> questionid
154       grade    -> maxmark
155   also there are two new columns:
156       slot     -  numbers the questions in the quiz in order, as on the edit quiz page.
157       page     -  new way to determine which question is on which page.
158   naturally, other parts of the code and APIs have been updated to reflect that
159   change.
161 * The following functions, which were part of the internal workings of the quiz,
162   have been removed.
163       quiz_get_slot_for_question
164       quiz_number_of_questions_in_quiz
165       quiz_repaginate               (there is now a quiz_repaginate_questions with a different API).
166       quiz_add_page_break_at        (see quiz_add_page_break_after_slot)
167       quiz_add_page_break_after     (see quiz_add_page_break_after_slot)
168       quiz_number_of_pages
169       quiz_remove_question          (see quiz_remove_slot)
170       quiz_update_question_instance (see quiz_update_slot_maxmark)
172 * The following internal functions have had their API changed.
173       quiz_delete_empty_page: has had its arguments changed to $quiz and $pagenumber.
174       quiz_has_question_use: now takes $quiz and $slot, not $questionid.
177 === 2.6 ===
179 * As part of improving the page usability and accessibility, we updated the
180   heading levels for quiz module so it has a proper nesting. (MDL-41615)
182 * mod_quiz_renderer::view_best_score has been removed. (It did not do what the
183   name suggested anyway.)
186 === 2.4 ===
188 * mod_quiz_renderer::finish_review_link now requires $attemptobj to be passed in
189   instead of a moodle_url.
192 === Earlier changes ===
194 * Were not documented in this way. Sorry.