Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

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