1 |
efrain |
1 |
This files describes API changes for question behaviour plugins.
|
|
|
2 |
|
|
|
3 |
=== 4.0 ===
|
|
|
4 |
|
|
|
5 |
1) The major question bank changes should not affect behaviour plugins.
|
|
|
6 |
The navigation changes may affect Behat tests. If you encounter this,
|
|
|
7 |
the best way to fix it is to use the new navigation steps in MDL-74130.
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
=== 3.10 ===
|
|
|
11 |
|
|
|
12 |
1) The slot parameter of method M.core_question_engine.init_submit_button now removed.
|
|
|
13 |
The method will get the unique id by using the 'Check' button element.
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
=== 3.1 ===
|
|
|
17 |
|
|
|
18 |
1) The standard behaviours that use a 'Check' button have all been changed so
|
|
|
19 |
that they only show the button when the question is active. Your behaviour
|
|
|
20 |
may interit this behaviour, because the change was made in the base class,
|
|
|
21 |
and this is probably good for consistency. However, if your question behaviour
|
|
|
22 |
uses the Check button, your probably want to test it carefully, and you will
|
|
|
23 |
probably have to update your unit tests. See MDL-53304 for more details.
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
=== 2.9 ===
|
|
|
27 |
|
|
|
28 |
1) There are new methods question_behaviour::can_finish_during_attempt and
|
|
|
29 |
question_behaviour_type::can_finish_during_attempt. These methods both return
|
|
|
30 |
false by default. You should override it if, with your behaviour, questions may
|
|
|
31 |
finish just through the student interacting with them (e.g. by clicking the
|
|
|
32 |
Check button within the question).
|
|
|
33 |
|
|
|
34 |
The behaviour type method answers the the question for this behaviour in
|
|
|
35 |
general, without reference to a specific question. The method on the
|
|
|
36 |
behaviour class answers the question for a specific attempt at a specific
|
|
|
37 |
question.
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
=== 2.7 ===
|
|
|
41 |
|
|
|
42 |
1) question_behaviour_type has a new method allows_multiple_submitted_responses
|
|
|
43 |
which defaults to false but should return true if this question behaviour
|
|
|
44 |
accepts multiple submissions of responses within one attempt eg. multiple
|
|
|
45 |
tries for the interactive or adaptive question behaviours.
|
|
|
46 |
question_behaviour has a new method step_has_a_submitted_response($step). For
|
|
|
47 |
question behaviours where it is not only the final response that is
|
|
|
48 |
submitted by the student, you need to override this method to return true
|
|
|
49 |
for other steps where a student has submitted a response. See
|
|
|
50 |
question_behaviour_with_multiple_tries::step_has_a_submitted_response($step)
|
|
|
51 |
for example. This method only needs to be overriden if you are returning
|
|
|
52 |
true from allows_multiple_response_submissions.
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
=== 2.6 ===
|
|
|
56 |
|
|
|
57 |
1) Legacy required_question_definition_type no longer supported. (See 2.2 point 2) below.)
|
|
|
58 |
|
|
|
59 |
2) Behaviours now have to define an extra class
|
|
|
60 |
class qbehaviour_mybehaviour_type extends question_behaviour_type {
|
|
|
61 |
This class returns information about the type of behaviour, as opposed to
|
|
|
62 |
the qbehaviour_mybehaviour class which controls a particular
|
|
|
63 |
question_attempt. That is like the difference between the qtype_mytype and
|
|
|
64 |
the qtype_mytype_question classes.
|
|
|
65 |
|
|
|
66 |
Practically, what this means is that any of the methods that used to be
|
|
|
67 |
static methods of qbehaviour_mybehaviour class are now normal instance
|
|
|
68 |
methods of the qbehaviour_mybehaviour_type class. Specifically.
|
|
|
69 |
2.5 / qbehaviour_mybehaviour -> 2.6 / qbehaviour_mybehaviour_type
|
|
|
70 |
IS_ARCHETYPAL -> is_archetypal()
|
|
|
71 |
adjust_random_guess_score() -> adjust_random_guess_score()
|
|
|
72 |
get_unused_display_options() -> get_unused_display_options()
|
|
|
73 |
|
|
|
74 |
3) The static method is_manual_grade_in_range has moved from the
|
|
|
75 |
question_behaviour class to the question_engine class.
|
|
|
76 |
|
|
|
77 |
4) Behaviours can now control how the marks information is displayed in the
|
|
|
78 |
grey info area to the left of the question. There is a new method
|
|
|
79 |
mark_summary that you can override, although the default implementation is
|
|
|
80 |
fine in most cases. it uses the marked_out_of_max and mark_out_of_max methods
|
|
|
81 |
as appropriate, so you may just wish to override those.
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
=== 2.3 ===
|
|
|
85 |
|
|
|
86 |
1) This plugin type now supports cron in the standard way. If required, Create a
|
|
|
87 |
lib.php file containing
|
|
|
88 |
function qbehaviour_mypluginname_cron() {};
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
=== 2.2 ===
|
|
|
92 |
|
|
|
93 |
1) The old
|
|
|
94 |
public static function get_required_behaviours()
|
|
|
95 |
method is no more. Instead use the ->dependencies facility in version.php. E.g.
|
|
|
96 |
$plugin->dependencies = array(
|
|
|
97 |
'qbehaviour_immediatefeedback' => 2011102700,
|
|
|
98 |
'qbehaviour_deferredcbm' => 2011102700
|
|
|
99 |
);
|
|
|
100 |
|
|
|
101 |
2) The old required_question_definition_type method has been replaced by a new
|
|
|
102 |
is_compatible_question method. You should change your behaviour to override
|
|
|
103 |
the new method, not the old one. This change has been implemented in a
|
|
|
104 |
backwards-compatible way, so behaviours will not break.
|