MDL-25617 backup: backup/restore using extra_question_fields
[moodle.git] / question / type / upgrade.txt
CommitLineData
78fc17eb
TH
1This files describes API changes for question type plugins.
2
5a8d683f
NN
3== 3.5 ==
4 + Added new classes backup_qtype_extrafields_plugin and restore_qtype_extrafields_plugin
5 in order to use extra fields method in backup/restore question type. Require and inherit new classes for using it. See
6 backup_qtype_shortanswer_plugin and restore_qtype_shortanswer_plugin for an example of using this.
7
c28bfbef
TH
8=== 3.1.5, 3.2.2, 3.3 ===
9
10* If you are using check_combined_feedback_file_access in your check_file_access method,
11 then you must now pass $args as the 4th argument, so the correct permission checks
12 can be performed. If you don't, you will get a developer debug notice.
13
1405f010
EL
14=== 3.1 ===
15
16* The following functions, previously used (exclusively) by upgrade steps are not available
17 anymore because of the upgrade cleanup performed for this version. See MDL-51580 for more info:
18 - qtype_essay_convert_to_html()
19
3d6f2466
JP
20=== 2.7 ===
21 + We have added a new method to the question_type base class 'break_down_stats_and_response_analysis_by_variant'. By default it
22 returns true. If your question type does not have variants of question instances then you can ignore this method as it only
23 applies to question types that have variants. If a question type does have variants the default action is to break down
24 response analysis and question stats by variant. But for some question types there might be an almost infinite quantity of
25 variants for the question, in this case you can suppress break down by variant by returning false from this method. See for
26 example the non-core question type varnumeric or the slightly more complex stack question type.
58794ac9
JP
27 + We have added a pair of methods to the question_definition class 'prepare_simulated_post_data' and
28 'get_student_response_values_for_simulation'. You may want to override these methods in question.php in your question type plug
29 -in. These methods are used to convert data from a csv file of simulated step data into the simulated post data that is fed
30 to the question engine. These csv files can be used for unit testing or manual testing the use of your question type within the
31 quiz module. You can use the simulate quiz report for manual testing and also to easily generate csv test files. You can
32 run a number of students through a test and then download a csv file representing their interaction with the quiz. For most
33 question types the default of just passing csv data as post data, directly from the csv file will probably work fine. But for
34 certain question types where the meaning of the post data is deliberately obfuscated it might be necessary to convert from a
35 human friendly format in the csv file to response data expected by the question type using 'prepare_simulated_post_data' and
36 to convert back from a question type response array to values for download in a csv file using
37 'get_student_response_values_for_simulation'.
0c0dfa8f
DW
38=== 2.6 ===
39 + The changes in MDL-32750 were reverted in favour of the new pdw toggle toolbars
40 plugin for TinyMCE. The get_non_collapsible_editor_options method has been deprecated.
41
eca230b5
TH
42=== 2.5 ===
43
dc38c5b4 44* There have been some tweaks to the helper class that is used to write
eca230b5
TH
45 walkthrough tests. You should not have to change your code, but you might
46 like to take a look at some of the new helper methods available. In particular,
47 if you had any code that did
48 $this->process_submission(array('-finish' => 1));
49 you should change that to
50 $this->finish();
dc38c5b4
TH
51
52* There have been lots of usability improvements to the question editing forms.
53 MDL-37417 links to all the changes. There are only a few API changes that
54 *require* you to upgrade your question type, but you are strongly recommended
55 to make similar usability improvements in your own question types.
56
57 + Some of the ids used in the form HTML have had ‘id_’ added at the front.
58 Take care if you refer to these in your JavasSript or CSS.
59
60 + MDL-32750 The HTML editing tools are now collapsed. This is applied by default
61 to all HTML editors except question text and general feedback. If you want to
62 add more exceptions, see the get_non_collabsible_editor_options method.
63
64 + Form fields have been grouped onto one line where appropriate, to reduce
65 the height of the form. qtype_numerical is a good example of this.
66
67 + Where elements are in groups, we have changed the normal accesshide CSS, so
68 that their labels are visible. If you were using grouped elements in the past
69 with static elements to lable the fields, then you will need to remove the statics.
70
71 + All the choices / answers have been merged into a single section of the form.
72 This works better with the new 'shortforms' MDL-30637. Also the
73 "Add blanks for more ..." buttons are now inside that section. This probably
74 requries that you remove any headings from your per-answer fields, and change
75 some of the labels.
76
77 + Having merged all the elements into one form section, we then used CSS to
78 visually group the fields for one choice, answer, etc.
79
80 + When editing an existing question, we only show as many repeats are are
81 actually needed until the user clicks the "Add blanks for more ..." button.
82 Where you have your own repeat elements, you may need to change the
83 number of repeats calculation.
84
85 + As with all forms, setType() is now required for all text form elements.
86
87 + A good example of a question type being upgraded to take account of all these
88 changes is
89 https://github.com/moodleou/moodle-qtype_pmatch/commit/9d8e1beb9f780246416a0f3a7622f700b8fa90c8
90
eca230b5 91
e01cf1fa
TH
92=== 2.3.5 / 2.4.2 / 2.5 ===
93
94* The special value question_attempt::PARAM_CLEANHTML_FILES that could be used
95 in the get_expected_data method was renamed to question_attempt::PARAM_RAW_FILES
96 in order to fix a bug. We failed to think this throught, and so did not realised
97 that this might break some question types. If this affected your question type,
98 please accept our apologies. Details in MDL-37847.
99
100
a031b0f3 101=== 2.3 ===
c2f5e2ab 102
a031b0f3
TH
103* Support for backwards-compatible string names dropped. MDL-30120. (See under 2.2 below.)
104* If you are overriding export_to_xml and import_from_xml to provide Moodle XML format
105 import and export, then you will probably get PHP strict syntax notices in developer
106 debug mode until you change the method signature to include qformat_xml $format.
107 That is, you need to specify the argument type.
7a00d438
DM
108* qtype_xxx_pluginfile() is now given the 7th parameter (hopefully the last
109 one) that contains additional options for the file serving. The array should
110 be re-passed to question_pluginfile() as is.
c2f5e2ab
TH
111
112
78fc17eb
TH
113=== 2.2 ===
114
115* The XML import/export base class has had some minor API changes. The
116 - write_combined_feedback method now requires that you pass the questionid and
117 contextid. (MDL-29058)
118 - calls to the import_hints and import_answer methods now should pass the question
119 text format as the last argument, to be used as a default if necessary. (MDL-29739)
120 If you do not upgrade your code, it will not break, but there will be PHP
121 warnings, and it the export will not work 100% correctly.
122
226b3124
TH
123* The old
124 public function requires_qtypes()
125method is no more. Instead use the ->dependencies facility in version.php. E.g.
126$plugin->dependencies = array(
127 'qtype_numerical' => 2011102700,
128);
129
130* The plugin name and related strings used to be defined in language strings
131called the same thing as the format, for example:
132
133$string['addingdescription'] = 'Adding a Description';
134$string['description'] = 'Description';
135$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.
136$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.
137$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.';
138$string['editingdescription'] = 'Editing a Description';
139
140All these need to be changed to use the standard string name pluginname, as for
141other plugin types, and similar for the other strings.
142
143$string['pluginname'] = 'Description';
144$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.
145$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.
146$string['pluginnameadding'] = 'Adding a Description';
147$string['pluginnameediting'] = 'Editing a Description';
148$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.';
149
150The old strings will continue to work, but only until Moodle 2.3 is released.
56565037
VS
151
152* If you are using the facilities provided by overriding the extra_answer_fields
153 or questionid_column_name methods, then you must change these to be public
154 methods. (This is required so that backup and restore can be made to work
155 automatically. MDL-24408, MDL-25617, MDL-30562)
0b94d6bf 156
0b94d6bf 157
a031b0f3
TH
158=== 2.1 ===
159
160* Lots of API changes due to the new question engine. See
161http://docs.moodle.org/dev/Developing_a_Question_Type#Converting_a_Moodle_2.0_question_type
162
163
164=== 2.0 ===
165
166* Lots of changes due to all the API changes in Moodle 2.0.
167
168* This plugin type now supports cron in the standard way. If required, Create a
169 lib.php file containing
170function qtype_mypluginname_cron() {};