upgrade.txt 11 KB
Newer Older
1
2
This files describes API changes in the quiz code.

3
4
5
6
7
8
9
10
=== 4.0.2, 4.1 ===

* No external code should be calling quiz_overview_report::regrade_attempt because it is an
  internal method of the quiz_overview plugin. But if you are incorrectly using it, be aware
  that the API changed slightly. It now returns an array listing any questions which could
  not be regraded.


11
12
13
14
15
16
=== 4.0 ===

* The following API methods have a new parameter, $studentisonline, to define whether the student is currently interacting:
  - process_finish() in mod/quiz/attemptlib.php
  - quiz_send_confirmation() in mod/quiz/locallib.php
  - quiz_send_notification_messages() in mod/quiz/locallib.php
17
18
* The completionpass criteria has been moved to core as 'completionpassgrade'. Refer to completion/upgrade.txt for
  further information.
19
20
* New argument quizhasquestions has been added to public methods: view_information in mod/quiz/renderer.php.
* The function no_questions_message() in class mod_quiz_renderer is deprecated. There is no replacement.
21
22
23
24
* Related to the Moodle 4.0 question bank changes, the quiz_slots database table.
  The fields removed are now manage by new core_question tables:
  - question_references -> Records where a specific question is used.
  - question_set_references -> Records where groups of questions are used (e.g. random questions).
25
26
27
* The quiz_slots_tags database table has been removed entirely, as has the get_slot_tags_for_slot_id() method
  from mod/quiz/classes/structure.php and the the locallib.php functions quiz_retrieve_slot_tags and
  quiz_retrieve_slot_tag_ids. This information is now stored in question_set_references
28
  and can be accessed in the results of qbank_helper::get_question_structure.
29

30

31
32
33
34
35
=== 3.11 ===

* External function mod_quiz_external::get_user_best_grade now returns and additional optional field:
  - gradetopass: The grade to pass the quiz (if set)

36

37
38
39
40
41
42
=== 3.10.1 ===

* External functions mod_quiz_external::get_attempt_data, mod_quiz_external::get_attempt_summary
  and mod_quiz_external::get_attempt_review now return a new additional optional field:
   - settings: Containing the question definition settings for displaying the question in an external system.

43
44
45
46
47
48
=== 3.10 ===

* External functions mod_quiz_external::get_attempt_data, mod_quiz_external::get_attempt_summary
  and mod_quiz_external::get_attempt_review now return a new additional optional field:
   - responsefileareas: Containing the user responses to questions file area names including files.

49
50
51
52
53
=== 3.7 ===

* Quiz_cron() has been removed. Sub-plugins should implemented scheduled tasks, however legacy cron in subplugins are
  supported.

54
55
56
57
58
59
60
=== 3.6 ===

* The following renamed classes have been completely removed:
  - quiz_question_bank_view (now: mod_quiz\question\bank\custom_view)
  - question_bank_add_to_quiz_action_column (now: mod_quiz\question\bank\add_action_column)
  - question_bank_question_name_text_column (now: mod_quiz\question\bank\question_name_text_column)

61
62
=== 3.5 ===
* Removed questionbank.ajax.php. Please use the quiz_question_bank fragment instead.
63
* Adding "random" questions to a quiz via quiz_add_quiz_question() has been deprecated. Please use quiz_add_random_questions().
64

65
=== 3.3.2 ===
66
67
68
69
70

* quiz_refresh_events() Now takes two additional parameters to refine the update to a specific instance. This function
  now optionally takes the module instance object or ID, and the course module object or ID. Please try to send the full
  objects instead of the ids to save DB calls.

71
72
73
74
75
76
=== 3.2 ===

* External functions mod_quiz_external::get_attempt_data, mod_quiz_external::get_attempt_summary
  and mod_quiz_external::get_attempt_review now return additional optional fields:
   - blockedbyprevious: Whether a question is blocked by the previous question.

77
=== 3.1 ===
78

79
80
81
* quiz_attempt::question_print_comment_fields() has been removed. It was broken
  since at least Moodle 2.0.

82
83
84
85
86
87
88
* quiz::confirm_start_attempt_message and mod_quiz_view_object::$startattemptwarning
  have been deprecated. This functionality is now entirely handled within the
  quiz access rule plugins.

* The third argument to mod_quiz_renderer::start_attempt_button has been changed
  from a warning string to a mod_quiz_preflight_check_form.

89
90
91
* mod_quiz_renderer::review_next_navigation has a new optional argument. If you
  have overridden that method, consider updating your code to match.

92
93
94
* mod_quiz\output\edit_renderer::start_section_list now takes $structure as an
  argument. If you have overridden this method (it's hard to believe anyone ever
  would) you will need to update your renderer.
95

96
97
98
99
* Several methods relating to preview links/buttons/urls have a new optional
  argument to make the preview be of a particular variant.


100
101
102
103
104
105
106
107
108
109
110
=== 2.9 ===

* There have been changes in classes/output/edit_renderer.php for MDL-40990.
  + Some methods use to take $structure & $question as the first two arguments.
    They now take $structure & $slot number. If you need $question, you can get
    it using $question = $structure->get_question_in_slot($slot);
  + Some methods used to take $quiz & $question. They now take $structure & $slot
    number. You can get $question as above. $quiz is $structure->get_quiz().
  + initialise_editing_javascript has had some redundant arguments removed.
  Hopefully, with these changes, we will have less need to make other changes in future.

111
112
113
114
115
116
117
118
119
120
* Due to MDL-40992, you should be aware that extra slots can get added to an attempt.
  You may get slot numbers beyone the end of the original quiz layout, and you
  may want to call $attemptobj->get_original_slot to find where the question
  originally came from.

* You now need to pass an instance of the mod_quiz_renderer if you call
  $attemptobj->render_question or $attemptobj->render_question_at_step.

* The array values in mod_quiz_links_to_other_attempts may now be either a moodle_url,
  or renderable (or null). Previously they could only be a moodle_url or null.
121

122
123
124
125
126
127
* The contents of the navigation block is now not just quiz_nav_question_button-s.
  It can also contain quiz_nav_section_heading-s. If you have overridden
  mod_quiz_renderer::navigation_panel, then you may need to account for this.
  This change also has implications for the Edit quiz page.


128
129
=== 2.8 ===

130
* Classes that were defined in various lib files have been moved to the classes
131
132
133
  folder to take advantage of auto-loading. This has involved renaming them.
  see the list in mod/quiz/db/renamedclasses.php.

134
135
136
137
* The quiz no longer handles its own \mod_quiz\event\attempt_becameoverdue event,
  and so the event handler function quiz_attempt_overdue_handler has been deleted.
  Also, the internal function quiz_send_overdue_message has add the arguments
  changed. It now takes the $attemptobj object, not separate stdClass objects.
138

139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
* Major changes to the Edit quiz page.

  The goal of this work was to increase usability, and also clean up the page
  enough that it will be possible to add new features in future.

  Display of mod/quiz/edit.php is now entirely generated by
  mod_quiz\output\edit_renderer. This uses a helper class mod_quiz\structure
  to provide details of the structure of the quiz, and mod_quiz\repaginate to
  alter that structure. (Actually, there are still some modification methods on
  mod_quiz\structure. Expect that to be cleaned up in future.)

  The new code uses much more ajax, and there are new scripts mod/quiz/edit_rest.php
  and mod/quiz/repaginate.php to handle this. (Again, don't be surprised if those
  two scripts get merged in future.) Also questionbank.ajax.php (which may, in
  future, be made more generic, and moved into the core question bank code.)

155
156
  As a result of this, mod/quiz/editlib.php has gone. (A few remaining functions
  were moved to locallib.php.)
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188

  Here is a list of all the old functions or classes that have changed.
  If you used any of these in custom code, you will need to update your code.
  (Note that many of these functions should have been considered private internals
  of the quiz module, and you should not have been using them!)

  From editlib.php:
      quiz_remove_slot
      quiz_delete_empty_page
      quiz_add_page_break_after_slot    - Use methods of structure or repaginate
      quiz_update_slot_maxmark          - classes instead.
      _quiz_move_question
      quiz_move_question_up
      quiz_move_question_down

      quiz_print_question_list
      quiz_print_pagecontrols
      quiz_print_singlequestion         - Use methods of edit_renderer instead.
      quiz_print_randomquestion
      quiz_print_singlequestion_reordertool
      quiz_print_randomquestion_reordertool
      print_random_option_icon
      quiz_print_grading_form
      quiz_print_status_bar

  Moved from editlib.php to locallib.php:
      quiz_question_tostring - now always returns a string (the only option used).
                               The $return argument has gone.

  Old editing JavaScript (e.g. mod/quiz/edit.js) is gone. Replaced with YUI modules.


189
190
191
192
193
194
195
=== 2.7.1 ===

* The function quiz_fire_attempt_started_event has been removed. This function
  should not have been used outside the quiz, but if you were using it, you should
  trigger the event outside this function. Note that the appropriate start event is
  fired automatically by the quiz_attempt_save_started function.

196

197
198
=== 2.7 ===

199
200
201
202
* The old quiz.questions database column (comma-separated list of question ids)
  is gone, and instead the quiz_question_instances table has been renamed to
  to quiz_slots. Some of the columns of that table have been renamed to match
  the coding guidelines. Specifically:
203
204
205
      quiz     -> quizid
      question -> questionid
      grade    -> maxmark
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
  also there are two new columns:
      slot     -  numbers the questions in the quiz in order, as on the edit quiz page.
      page     -  new way to determine which question is on which page.
  naturally, other parts of the code and APIs have been updated to reflect that
  change.

* The following functions, which were part of the internal workings of the quiz,
  have been removed.
      quiz_get_slot_for_question
      quiz_number_of_questions_in_quiz
      quiz_repaginate               (there is now a quiz_repaginate_questions with a different API).
      quiz_add_page_break_at        (see quiz_add_page_break_after_slot)
      quiz_add_page_break_after     (see quiz_add_page_break_after_slot)
      quiz_number_of_pages
      quiz_remove_question          (see quiz_remove_slot)
      quiz_update_question_instance (see quiz_update_slot_maxmark)

* The following internal functions have had their API changed.
      quiz_delete_empty_page: has had its arguments changed to $quiz and $pagenumber.
      quiz_has_question_use: now takes $quiz and $slot, not $questionid.
226

227

228
=== 2.6 ===
229

230
231
* As part of improving the page usability and accessibility, we updated the
  heading levels for quiz module so it has a proper nesting. (MDL-41615)
232
233
234
235
236

* mod_quiz_renderer::view_best_score has been removed. (It did not do what the
  name suggested anyway.)


237
238
239
240
241
242
243
244
245
=== 2.4 ===

* mod_quiz_renderer::finish_review_link now requires $attemptobj to be passed in
  instead of a moodle_url.


=== Earlier changes ===

* Were not documented in this way. Sorry.