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