2013-07-17 19:46:27 +01:00
|
|
|
This files describes API changes for code that uses the question API.
|
|
|
|
|
2021-06-24 15:58:09 +10:00
|
|
|
=== 4.0 ==
|
|
|
|
|
|
|
|
1) Previously, the questionbank api classes were coupled in one place. Now the classes
|
|
|
|
are divided in two different parts, base classes and feature classes. All the base
|
|
|
|
classes are moved classes/local/bank and all the feature classes will be moved to
|
|
|
|
the plugin for that feature.
|
2021-08-07 02:03:58 +10:00
|
|
|
|
2021-06-07 19:17:06 +10:00
|
|
|
2) submit_tags_form and associated external services for question tag, tags_form in question/type,
|
|
|
|
core_question_output_fragment_tags_form method in lib is deprecated and moved to the tagquestion plugin.
|
2021-06-24 15:58:09 +10:00
|
|
|
|
2021-09-08 09:29:22 +02:00
|
|
|
3) Function question_get_export_single_question_url() in questionlib has been deprecated
|
2021-06-03 11:28:28 +10:00
|
|
|
and moved to qbank_exporttoxml plugin, the new location is:
|
2021-09-06 15:40:11 +02:00
|
|
|
qbank_exporttoxml\helper::question_get_export_single_question_url().
|
2021-06-03 11:28:28 +10:00
|
|
|
|
2021-09-08 09:29:22 +02:00
|
|
|
4) The following methods are deprecated in previewlib and moved to the previewquestion plugin:
|
2021-06-02 12:36:52 +10:00
|
|
|
restart_preview(), question_preview_form_url(), question_preview_action_url(),
|
|
|
|
question_preview_question_pluginfile()
|
|
|
|
The following classes are deprecated in previewlib and moves the previewquestion plugin:
|
|
|
|
question_preview_options, preview_options_form.
|
2021-06-24 15:58:09 +10:00
|
|
|
|
2021-08-07 02:03:58 +10:00
|
|
|
5) submit_tags_form and associated external services for question tag, tags_form in question/type,
|
|
|
|
core_question_output_fragment_tags_form method in lib is deprecated and moved to the tagquestion plugin.
|
|
|
|
|
|
|
|
6) Function question_get_export_single_question_url() in questionlib has been deprecated
|
|
|
|
and moved to qbank_exporttoxml plugin, the new location is:
|
|
|
|
qbank_exporttoxml\exporttoxml_helper::question_get_export_single_question_url().
|
|
|
|
|
|
|
|
7) The following classes are deleted and available in the new location:
|
|
|
|
'core_question\bank\action_column_base' => 'core_question\local\bank\action_column_base',
|
|
|
|
'core_question\bank\checkbox_column' => 'core_question\local\bank\checkbox_column',
|
|
|
|
'core_question\bank\column_base' => 'core_question\local\bank\column_base',
|
|
|
|
'core_question\bank\edit_menu_column' => 'core_question\local\bank\edit_menu_column',
|
|
|
|
'core_question\bank\menu_action_column_base' => 'core_question\local\bank\menu_action_column_base',
|
|
|
|
'core_question\bank\menuable_action' => 'core_question\local\bank\menuable_action',
|
|
|
|
'core_question\bank\random_question_loader' => 'core_question\local\bank\random_question_loader',
|
|
|
|
'core_question\bank\row_base' => 'core_question\local\bank\row_base',
|
|
|
|
'core_question\bank\view' => 'core_question\local\bank\view',
|
|
|
|
'core_question\bank\copy_action_column' => 'qbank_editquestion\copy_action_column',
|
|
|
|
'core_question\bank\edit_action_column' => 'qbank_editquestion\edit_action_column',
|
|
|
|
'core_question\bank\creator_name_column' => 'qbank_viewcreator\creator_name_column',
|
|
|
|
'core_question\bank\question_name_column' => 'qbank_viewquestionname\viewquestionname_column_helper',
|
|
|
|
'core_question\bank\question_name_idnumber_tags_column' => 'qbank_viewquestionname\question_name_idnumber_tags_column',
|
|
|
|
'core_question\bank\delete_action_column' => 'qbank_deletequestion\delete_action_column',
|
|
|
|
'core_question\bank\export_xml_action_column' => 'qbank_exporttoxml\export_xml_action_column',
|
|
|
|
'core_question\bank\preview_action_column' => 'qbank_previewquestion\preview_action_column',
|
|
|
|
'core_question\bank\question_text_row' => 'qbank_viewquestiontext\question_text_row',
|
|
|
|
'core_question\bank\question_type_column' => 'qbank_viewquestiontype\question_type_column',
|
|
|
|
'core_question\bank\tags_action_column' => 'qbank_tagquestion\tags_action_column',
|
|
|
|
'core_question\form\tags' => '\qbank_tagquestion\form\tags_form',
|
|
|
|
'core_question\output\qbank_chooser' => 'qbank_editquestion\qbank_chooser',
|
|
|
|
'core_question\output\qbank_chooser_item' => 'qbank_editquestion\qbank_chooser_item',
|
|
|
|
|
|
|
|
8) The following classes are deprecated and moved to a new location. These are marked for final deprecation on 4.4:
|
|
|
|
'question_category_list' => 'qbank_managecategories\question_category_list',
|
|
|
|
'question_category_list_item' => 'qbank_managecategories\question_category_list_item',
|
|
|
|
'question_category_object' => 'qbank_managecategories\question_category_object',
|
|
|
|
'question_category_edit_form' => 'qbank_managecategories\form\category_form',
|
|
|
|
'question_export_form' => 'qbank_exportquestions\form\export_form',
|
|
|
|
'question_import_form' => 'qbank_importquestions\form\question_import_form',
|
|
|
|
'question_move_form' => 'qbank_managecategories\form\question_move_form',
|
|
|
|
'preview_options_form' => 'qbank_previewquestion\form\preview_options_form',
|
|
|
|
'question_preview_options' => 'qbank_previewquestion\output\question_preview_options',
|
|
|
|
'category_form' => 'qbank_managecategories\form\category_form',
|
|
|
|
'export_form' => 'qbank_exportquestions\form\export_form'.
|
|
|
|
|
|
|
|
9) The following functions are deprecated and moved to the new location:
|
|
|
|
question_preview_question_pluginfile() => qbank_previewquestion\helper::question_preview_question_pluginfile(),
|
|
|
|
question_preview_action_url() => qbank_previewquestion\helper::question_preview_action_url(),
|
|
|
|
question_preview_form_url() => qbank_previewquestion\helper::question_preview_form_url(),
|
|
|
|
restart_preview() => qbank_previewquestion\helper::restart_preview(),
|
|
|
|
core_question_output_fragment_tags_form() => /question/bank/qbank_tagquestion/lib.php.
|
|
|
|
|
2021-09-26 18:09:01 +10:00
|
|
|
10)The qbank api now allows bulk actions from qbank plugins. Its possible to implement a qbank plugin and pass the bulk
|
|
|
|
bulk action object from the plugin feature using the get_bulk_actions(). The base class for this feature is bulk_action_base.
|
|
|
|
The following methods are deprecated as a part of bulk actions ui implementation and its no more required to call these methods
|
|
|
|
anymore as the api is now self sufficient, calling the api will fetch all the features:
|
|
|
|
process_actions(), process_actions_needing_ui().
|
|
|
|
|
2022-03-08 12:42:48 +00:00
|
|
|
12) The Behat class for question-related steps has been renamed to behat_core_question
|
|
|
|
to match the expected naming convention. In the unlikely event that you are directly
|
|
|
|
referring to the behat_question class name (nothing in the standard Moodle code was)
|
|
|
|
then you will have to update your reference.
|
|
|
|
|
|
|
|
|
2020-02-13 16:09:33 +00:00
|
|
|
=== 3.9 ==
|
|
|
|
|
2020-05-18 13:09:24 +01:00
|
|
|
1) For years, the ..._questions_in_use callback has been the right way for plugins to
|
|
|
|
tell the core question system if questions are required. Previously this callback
|
|
|
|
only worked in mods. Now it works in all plugins.
|
|
|
|
|
|
|
|
At the same time, if you are still relying on the legacy ..._question_list_instances
|
|
|
|
callback for this, you will now get a debugging warning telling you to upgrade.
|
|
|
|
|
|
|
|
2) Previously, the functions question_delete_activity, question_delete_course and
|
|
|
|
question_delete_course_category would echo output. This was not correct behaviour for
|
|
|
|
a low-level API function. Now, they no longer output. Related to this, the helper
|
|
|
|
function they use, question_delete_context, now always returns an empty array.
|
|
|
|
|
|
|
|
This probably won't acutally cause you any problems. However, you may previously
|
|
|
|
have had to add expectOutputRegex calls to your unit tests to avoid warnings about
|
|
|
|
risky tests. If you have done that, those tests will now fail until you delete that expectation.
|
2020-02-13 16:09:33 +00:00
|
|
|
|
|
|
|
|
2019-08-29 15:41:00 +01:00
|
|
|
=== 3.8 ===
|
|
|
|
|
|
|
|
If you have customised the display of the question bank (using $CFG->questionbankcolumns)
|
|
|
|
then be aware that the default configuration has changed, and you may wish to make
|
|
|
|
equivalent changes in your customised version. The old column question_name_column
|
|
|
|
has been replaced by question_name_idnumber_tags_column. The old question_name_column
|
|
|
|
still exists, so it is safe to continue using it.
|
|
|
|
|
2019-10-02 13:51:48 +01:00
|
|
|
There is a new question bank column edit_menu_column which displays all actions
|
|
|
|
in a drop-down menu, instead of as separate icons. This is now used by default.
|
|
|
|
Specifically, it gathers all other columns which implement the new interface
|
|
|
|
menuable_action. If you have made a custom subclasses of action_column_base,
|
|
|
|
you probably want to implement the new interface. If your column is a simple action,
|
|
|
|
the easiest way to do this will be to subclass menu_action_column_base. If your action
|
|
|
|
is more complex, and does not follow the simple pattern that menu_action_column_base
|
|
|
|
uses, then you will need to implement menuable_action yourself. The commit for
|
|
|
|
MDL-66816 updates all the core action columns. Looking at that change should make
|
|
|
|
it clearly the changes you need to make to your columns.
|
|
|
|
|
|
|
|
|
2019-02-18 17:48:32 +01:00
|
|
|
=== 3.7 ===
|
|
|
|
|
|
|
|
The code for the is_valid_number function that was duplicated in the
|
2019-03-07 09:09:23 +08:00
|
|
|
qtype_numerical and qtype_multianswer plugins in the qtype_numerical_edit_form
|
2019-02-18 17:48:32 +01:00
|
|
|
and qtype_multianswer_edit_form classes has been moved to a static function
|
|
|
|
in the qtype_numerical class of the qtype_numerical plugin.
|
|
|
|
|
2014-10-09 17:44:11 +02:00
|
|
|
The exportprocess function of the qformat_default class doesn't output a blank line
|
|
|
|
if the result of the writequestion function is null. This permit to qformat plugins
|
|
|
|
to ignore some questions without the need to overwrite this function.
|
|
|
|
|
2019-03-28 16:38:49 +08:00
|
|
|
* The question_preview_cron() has been deleted. Please use \core\task\question_cron_task::execute().
|
|
|
|
* The question_usage_statistics_cron() has been deleted. Please use \core\task\question_cron_task::execute().
|
|
|
|
* The method question_bank::cron() has been deleted, please use question related scheduled tasks.
|
|
|
|
|
2018-04-15 17:29:04 +08:00
|
|
|
=== 3.5 ===
|
|
|
|
|
|
|
|
1) The question format exportprocess function now adds a
|
|
|
|
$checkcapabilities boolean to allow questions to be exported in
|
|
|
|
certain circumstances.
|
|
|
|
|
2016-09-01 17:30:46 +08:00
|
|
|
=== 3.2 ===
|
|
|
|
|
|
|
|
1) The following renderers have been deprecated in favour of the renderable
|
|
|
|
core_question\output\qbank_chooser and associated render_* method.
|
|
|
|
* qbank_chooser
|
|
|
|
* qbank_chooser_types
|
|
|
|
* qbank_chooser_qtype
|
|
|
|
* qbank_chooser_title
|
|
|
|
|
2015-11-26 15:04:10 +00:00
|
|
|
=== 3.1 ===
|
|
|
|
|
|
|
|
1) The argument $requirecourseid was removed from question_edit_setup() and
|
|
|
|
is no longer respected. The behaviour was found to be buggy and now throws
|
|
|
|
debugging notices if passed.
|
|
|
|
|
2014-11-17 15:06:53 +00:00
|
|
|
=== 2.9 ===
|
|
|
|
|
2014-11-17 15:06:53 +00:00
|
|
|
1) Some functions in questionlib.php which were deprecated in the past have now
|
|
|
|
been deleted:
|
2014-11-17 15:06:53 +00:00
|
|
|
|
|
|
|
Deprecated since 2.1
|
|
|
|
* question_list_instances
|
|
|
|
* get_grade_options
|
|
|
|
* question_category_isused
|
|
|
|
* save_question_options
|
|
|
|
* question_get_real_state
|
|
|
|
|
2014-11-17 15:06:53 +00:00
|
|
|
Deprecated since 2.6
|
|
|
|
* question_rewrite_questiontext_preview_urls
|
|
|
|
* question_send_questiontext_file
|
|
|
|
* question_pluginfile no longer falls back to using the old
|
|
|
|
{$previewcomponent}_questiontext_preview_pluginfile callback if the new
|
|
|
|
{$previewcomponent}_question_preview_pluginfile callback is missing.
|
|
|
|
|
2014-11-17 15:06:53 +00:00
|
|
|
|
2014-09-08 13:24:17 +01:00
|
|
|
=== 2.8 ===
|
|
|
|
|
2015-03-13 19:07:44 +00:00
|
|
|
1) This is just a warning that some methods of the question_engine_data_mapper
|
2014-09-08 13:24:17 +01:00
|
|
|
class have changed. All these methods are ones that you should not have been
|
|
|
|
calling directly from your code, so this should not cause any problems.
|
|
|
|
The changed methods are:
|
|
|
|
* insert_question_attempt
|
|
|
|
* insert_step_data
|
|
|
|
* update_question_attempt_step
|
|
|
|
|
|
|
|
|
2014-01-08 14:08:40 -06:00
|
|
|
=== 2.7 ===
|
|
|
|
|
|
|
|
1) Changes to class question_bank_view:
|
|
|
|
|
|
|
|
Filters, including $recurse and $showhidden, are now implemented as
|
2014-01-09 12:43:56 +00:00
|
|
|
pluggable \core_question\bank\search\condition classes.
|
2014-01-08 14:08:40 -06:00
|
|
|
|
|
|
|
Therefore $recurse and $showhidden are no longer passed to the following functions:
|
|
|
|
protected function display_options [deprecated, use display_options_form()]
|
|
|
|
protected function build_query_sql [deprecated, use build_query()]
|
|
|
|
|
2014-01-09 12:43:56 +00:00
|
|
|
protected function display_category_form() is deprecated. Use \core_question\bank\search\category_condition
|
2014-01-08 14:08:40 -06:00
|
|
|
|
2014-01-09 12:43:56 +00:00
|
|
|
protected function display_category_form_checkbox deprecated use html_writer::checkbox and separate JavaScript
|
2014-01-08 14:08:40 -06:00
|
|
|
|
|
|
|
To add filters, local plugins can now implement the function local_[pluginname]_get_question_bank_search_conditions,
|
|
|
|
|
2014-03-11 09:16:33 -05:00
|
|
|
2) To make columns available to question_bank_view, plugins can extend core_question\bank\column_base.
|
|
|
|
Users may choose to display additional columns by setting $CFG->questionbankcolumns to a comma-delimited list of columns.
|
|
|
|
|
|
|
|
3) The subsort separator has changed from _ to - in order to distinuguish subsorts vs frankenstyle component separators.
|
|
|
|
|
|
|
|
4) Because of the move to autoloading, $knowncolumntypes and known_field_types() are no longer used.
|
|
|
|
|
|
|
|
5) question_bank_column_base and it's derived classes have been namespaced to core_question\bank\column_base.
|
2014-01-09 12:43:56 +00:00
|
|
|
|
2014-09-08 13:24:17 +01:00
|
|
|
|
2013-07-17 19:46:27 +01:00
|
|
|
=== 2.6 ===
|
|
|
|
|
2013-09-19 14:26:37 +08:00
|
|
|
1) Modules using the question bank MUST now declare their use of it with the xxx_supports()
|
|
|
|
flag FEATURE_USES_QUESTIONS. question_module_uses_questions() should be used to determine
|
|
|
|
if a module uses questions.
|
|
|
|
|
|
|
|
2) It is sometimes necessary to display bits of question content without having
|
2013-07-17 19:46:27 +01:00
|
|
|
and attempt (question_usage) in progress. Two examples of this are the option
|
|
|
|
in the question bank to display the questiontext, and in the quiz statistics
|
|
|
|
report, where it displays the question text above the report.
|
|
|
|
|
|
|
|
Previously, this display was done using a special method that only worked for
|
|
|
|
the question text, but which would not work for other parts of the question.
|
|
|
|
That old mechanism has been deprecated, and there is a new method that you
|
|
|
|
should use.
|
|
|
|
|
|
|
|
To display the question, replace calls to question_rewrite_questiontext_preview_urls
|
|
|
|
with calls to question_rewrite_question_preview_urls. Because the new function
|
|
|
|
is more flexibile, you have to pass more arguments.
|
|
|
|
|
|
|
|
To perform the necessary permission checks when the file is downloaded, you need
|
|
|
|
to implement the callback [component name]_question_preview_pluginfile.
|
|
|
|
(Previously you implemented [component name]_questiontext_preview_pluginfile.)
|
|
|
|
quiz_statistics_question_preview_pluginfile is an example of what to do.
|
|
|
|
|
|
|
|
question_send_questiontext_file has been deprecated. It is no longer necessary.
|
|
|
|
|
|
|
|
To ensure you are no longer using or defining any deprecated functions,
|
|
|
|
search for the regular expression:
|
|
|
|
question_rewrite_questiontext_preview_urls|_questiontext_preview_pluginfile|question_send_questiontext_file
|
2014-01-31 14:12:19 +00:00
|
|
|
|
2014-02-05 11:23:42 +00:00
|
|
|
3) The argument list for core_question_renderer::mark_summary has changed.
|
|
|
|
Please update your calls. (The most likely scenario for this is if you have
|
|
|
|
overridden core_question_renderer::info in your own renderer.) You need to
|
|
|
|
make a change like:
|
|
|
|
- $this->mark_summary($qa, $options);
|
|
|
|
+ $this->mark_summary($qa, $behaviouroutput, $options);
|