1 This files describes API changes in the quiz code.
5 * There have been changes in classes/output/edit_renderer.php for MDL-40990.
6 + Some methods use to take $structure & $question as the first two arguments.
7 They now take $structure & $slot number. If you need $question, you can get
8 it using $question = $structure->get_question_in_slot($slot);
9 + Some methods used to take $quiz & $question. They now take $structure & $slot
10 number. You can get $question as above. $quiz is $structure->get_quiz().
11 + initialise_editing_javascript has had some redundant arguments removed.
12 Hopefully, with these changes, we will have less need to make other changes in future.
14 * Due to MDL-40992, you should be aware that extra slots can get added to an attempt.
15 You may get slot numbers beyone the end of the original quiz layout, and you
16 may want to call $attemptobj->get_original_slot to find where the question
19 * You now need to pass an instance of the mod_quiz_renderer if you call
20 $attemptobj->render_question or $attemptobj->render_question_at_step.
22 * The array values in mod_quiz_links_to_other_attempts may now be either a moodle_url,
23 or renderable (or null). Previously they could only be a moodle_url or null.
25 * The contents of the navigation block is now not just quiz_nav_question_button-s.
26 It can also contain quiz_nav_section_heading-s. If you have overridden
27 mod_quiz_renderer::navigation_panel, then you may need to account for this.
28 This change also has implications for the Edit quiz page.
33 * Classes that were defined in various lib files have been moved to the classes
34 folder to take advantage of auto-loading. This has involved renaming them.
35 see the list in mod/quiz/db/renamedclasses.php.
37 * The quiz no longer handles its own \mod_quiz\event\attempt_becameoverdue event,
38 and so the event handler function quiz_attempt_overdue_handler has been deleted.
39 Also, the internal function quiz_send_overdue_message has add the arguments
40 changed. It now takes the $attemptobj object, not separate stdClass objects.
42 * Major changes to the Edit quiz page.
44 The goal of this work was to increase usability, and also clean up the page
45 enough that it will be possible to add new features in future.
47 Display of mod/quiz/edit.php is now entirely generated by
48 mod_quiz\output\edit_renderer. This uses a helper class mod_quiz\structure
49 to provide details of the structure of the quiz, and mod_quiz\repaginate to
50 alter that structure. (Actually, there are still some modification methods on
51 mod_quiz\structure. Expect that to be cleaned up in future.)
53 The new code uses much more ajax, and there are new scripts mod/quiz/edit_rest.php
54 and mod/quiz/repaginate.php to handle this. (Again, don't be surprised if those
55 two scripts get merged in future.) Also questionbank.ajax.php (which may, in
56 future, be made more generic, and moved into the core question bank code.)
58 As a result of this, mod/quiz/editlib.php has gone. (A few remaining functions
59 were moved to locallib.php.)
61 Here is a list of all the old functions or classes that have changed.
62 If you used any of these in custom code, you will need to update your code.
63 (Note that many of these functions should have been considered private internals
64 of the quiz module, and you should not have been using them!)
68 quiz_delete_empty_page
69 quiz_add_page_break_after_slot - Use methods of structure or repaginate
70 quiz_update_slot_maxmark - classes instead.
73 quiz_move_question_down
75 quiz_print_question_list
76 quiz_print_pagecontrols
77 quiz_print_singlequestion - Use methods of edit_renderer instead.
78 quiz_print_randomquestion
79 quiz_print_singlequestion_reordertool
80 quiz_print_randomquestion_reordertool
81 print_random_option_icon
82 quiz_print_grading_form
85 Moved from editlib.php to locallib.php:
86 quiz_question_tostring - now always returns a string (the only option used).
87 The $return argument has gone.
89 Old editing JavaScript (e.g. mod/quiz/edit.js) is gone. Replaced with YUI modules.
94 * The function quiz_fire_attempt_started_event has been removed. This function
95 should not have been used outside the quiz, but if you were using it, you should
96 trigger the event outside this function. Note that the appropriate start event is
97 fired automatically by the quiz_attempt_save_started function.
101 * The old quiz.questions database column (comma-separated list of question ids)
102 is gone, and instead the quiz_question_instances table has been renamed to
103 to quiz_slots. Some of the columns of that table have been renamed to match
104 the coding guidelines. Specifically:
106 question -> questionid
108 also there are two new columns:
109 slot - numbers the questions in the quiz in order, as on the edit quiz page.
110 page - new way to determine which question is on which page.
111 naturally, other parts of the code and APIs have been updated to reflect that
114 * The following functions, which were part of the internal workings of the quiz,
116 quiz_get_slot_for_question
117 quiz_number_of_questions_in_quiz
118 quiz_repaginate (there is now a quiz_repaginate_questions with a different API).
119 quiz_add_page_break_at (see quiz_add_page_break_after_slot)
120 quiz_add_page_break_after (see quiz_add_page_break_after_slot)
122 quiz_remove_question (see quiz_remove_slot)
123 quiz_update_question_instance (see quiz_update_slot_maxmark)
125 * The following internal functions have had their API changed.
126 quiz_delete_empty_page: has had its arguments changed to $quiz and $pagenumber.
127 quiz_has_question_use: now takes $quiz and $slot, not $questionid.
131 * As part of improving the page usability and accessibility, we updated the
132 heading levels for quiz module so it has a proper nesting. (MDL-41615)
134 * mod_quiz_renderer::view_best_score has been removed. (It did not do what the
135 name suggested anyway.)
140 * mod_quiz_renderer::finish_review_link now requires $attemptobj to be passed in
141 instead of a moodle_url.
144 === Earlier changes ===
146 * Were not documented in this way. Sorry.