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