MDL-43539 quiz statistics : coding error from progress bar
[moodle.git] / question / type / upgrade.txt
CommitLineData
78fc17eb
TH
1This files describes API changes for question type plugins.
2
0c0dfa8f
DW
3=== 2.6 ===
4 + The changes in MDL-32750 were reverted in favour of the new pdw toggle toolbars
5 plugin for TinyMCE. The get_non_collapsible_editor_options method has been deprecated.
6
eca230b5
TH
7=== 2.5 ===
8
dc38c5b4 9* There have been some tweaks to the helper class that is used to write
eca230b5
TH
10 walkthrough tests. You should not have to change your code, but you might
11 like to take a look at some of the new helper methods available. In particular,
12 if you had any code that did
13 $this->process_submission(array('-finish' => 1));
14 you should change that to
15 $this->finish();
dc38c5b4
TH
16
17* There have been lots of usability improvements to the question editing forms.
18 MDL-37417 links to all the changes. There are only a few API changes that
19 *require* you to upgrade your question type, but you are strongly recommended
20 to make similar usability improvements in your own question types.
21
22 + Some of the ids used in the form HTML have had ‘id_’ added at the front.
23 Take care if you refer to these in your JavasSript or CSS.
24
25 + MDL-32750 The HTML editing tools are now collapsed. This is applied by default
26 to all HTML editors except question text and general feedback. If you want to
27 add more exceptions, see the get_non_collabsible_editor_options method.
28
29 + Form fields have been grouped onto one line where appropriate, to reduce
30 the height of the form. qtype_numerical is a good example of this.
31
32 + Where elements are in groups, we have changed the normal accesshide CSS, so
33 that their labels are visible. If you were using grouped elements in the past
34 with static elements to lable the fields, then you will need to remove the statics.
35
36 + All the choices / answers have been merged into a single section of the form.
37 This works better with the new 'shortforms' MDL-30637. Also the
38 "Add blanks for more ..." buttons are now inside that section. This probably
39 requries that you remove any headings from your per-answer fields, and change
40 some of the labels.
41
42 + Having merged all the elements into one form section, we then used CSS to
43 visually group the fields for one choice, answer, etc.
44
45 + When editing an existing question, we only show as many repeats are are
46 actually needed until the user clicks the "Add blanks for more ..." button.
47 Where you have your own repeat elements, you may need to change the
48 number of repeats calculation.
49
50 + As with all forms, setType() is now required for all text form elements.
51
52 + A good example of a question type being upgraded to take account of all these
53 changes is
54 https://github.com/moodleou/moodle-qtype_pmatch/commit/9d8e1beb9f780246416a0f3a7622f700b8fa90c8
55
eca230b5 56
e01cf1fa
TH
57=== 2.3.5 / 2.4.2 / 2.5 ===
58
59* The special value question_attempt::PARAM_CLEANHTML_FILES that could be used
60 in the get_expected_data method was renamed to question_attempt::PARAM_RAW_FILES
61 in order to fix a bug. We failed to think this throught, and so did not realised
62 that this might break some question types. If this affected your question type,
63 please accept our apologies. Details in MDL-37847.
64
65
a031b0f3 66=== 2.3 ===
c2f5e2ab 67
a031b0f3
TH
68* Support for backwards-compatible string names dropped. MDL-30120. (See under 2.2 below.)
69* If you are overriding export_to_xml and import_from_xml to provide Moodle XML format
70 import and export, then you will probably get PHP strict syntax notices in developer
71 debug mode until you change the method signature to include qformat_xml $format.
72 That is, you need to specify the argument type.
7a00d438
DM
73* qtype_xxx_pluginfile() is now given the 7th parameter (hopefully the last
74 one) that contains additional options for the file serving. The array should
75 be re-passed to question_pluginfile() as is.
c2f5e2ab
TH
76
77
78fc17eb
TH
78=== 2.2 ===
79
80* The XML import/export base class has had some minor API changes. The
81 - write_combined_feedback method now requires that you pass the questionid and
82 contextid. (MDL-29058)
83 - calls to the import_hints and import_answer methods now should pass the question
84 text format as the last argument, to be used as a default if necessary. (MDL-29739)
85 If you do not upgrade your code, it will not break, but there will be PHP
86 warnings, and it the export will not work 100% correctly.
87
226b3124
TH
88* The old
89 public function requires_qtypes()
90method is no more. Instead use the ->dependencies facility in version.php. E.g.
91$plugin->dependencies = array(
92 'qtype_numerical' => 2011102700,
93);
94
95* The plugin name and related strings used to be defined in language strings
96called the same thing as the format, for example:
97
98$string['addingdescription'] = 'Adding a Description';
99$string['description'] = 'Description';
100$string['description_help'] = 'A description is not really a question type. It simply enables text to be displayed without requiring any answers, similar to a label on the course page.
101$string['description_link'] = 'A description is not really a question type. It simply enables text to be displayed without requiring any answers, similar to a label on the course page.
102$string['descriptionsummary'] = 'This is not actually a question. Instead it is a way to add some instructions, rubric or other content to the activity. This is similar to the way that labels can be used to add content to the course page.';
103$string['editingdescription'] = 'Editing a Description';
104
105All these need to be changed to use the standard string name pluginname, as for
106other plugin types, and similar for the other strings.
107
108$string['pluginname'] = 'Description';
109$string['pluginname_help'] = 'A description is not really a question type. It simply enables text to be displayed without requiring any answers, similar to a label on the course page.
110$string['pluginname_link'] = 'A description is not really a question type. It simply enables text to be displayed without requiring any answers, similar to a label on the course page.
111$string['pluginnameadding'] = 'Adding a Description';
112$string['pluginnameediting'] = 'Editing a Description';
113$string['pluginnamesummary'] = 'This is not actually a question. Instead it is a way to add some instructions, rubric or other content to the activity. This is similar to the way that labels can be used to add content to the course page.';
114
115The old strings will continue to work, but only until Moodle 2.3 is released.
56565037
VS
116
117* If you are using the facilities provided by overriding the extra_answer_fields
118 or questionid_column_name methods, then you must change these to be public
119 methods. (This is required so that backup and restore can be made to work
120 automatically. MDL-24408, MDL-25617, MDL-30562)
0b94d6bf 121
0b94d6bf 122
a031b0f3
TH
123=== 2.1 ===
124
125* Lots of API changes due to the new question engine. See
126http://docs.moodle.org/dev/Developing_a_Question_Type#Converting_a_Moodle_2.0_question_type
127
128
129=== 2.0 ===
130
131* Lots of changes due to all the API changes in Moodle 2.0.
132
133* This plugin type now supports cron in the standard way. If required, Create a
134 lib.php file containing
135function qtype_mypluginname_cron() {};