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