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