In order to do this in a sane way, I cleaned up a lot of old mess,
inclduing:
1. Previously, qtype_calcuated used ->answeres when importing, and
->answer when saving the form. This was crazy, so I fixed it, and
stripped out the code that made the alternative variable name work.
2. Similarly, it could handle ->answer being either an array, such as
you would get form the HTML editor, or a simple string, which is what
you get form the form. I simplified that too.
3. Finally, I made import use a transaction around saving each
question, so we don't get half questions in the database when an error
occurs.
Allows plugins to add columns to the question bank view by extending core_question\bank\column_base
Columns to display are set in $CFG->questionbankcolumns. Columns are namespaced and autoloaded to support this.
Four core library classes renamed for autoloading with deprecated stubs
have been converted to the new scheme for autoloading.
They are:
* textlib
* collatorlib
* plugin_manager
* plugininfo_base
These will be removed in 2.9 by MDL-46124
Some time ago, it when from using '0' for no-subcategories to blank.
Change to properly define '0' or '1', update old questions, and make
sure to fix newly restored questions.
Some browsers do not bubble form submission events to the window, and we
had more than one form on the page in certain conditions. We need to select
all of the forms on a page and then test the action.
question_type::save_question_answers function added, supporting
saving answers and extra answer fields. It can be called from
save_question_options function for the questions, using
question_answers table. Special functions created for overloading
so that every question could tune it to it's own form.
Shortanswer qtype save_question_options() converted as a proof of
concept and for testing purposes.
Now question_edit_form can load extra answer fields. If a question
type need to do something more complex for particular field, it
can overload added functions without duplicating other code.
Extra answer data may be optional, saving DB space - i.e. not every row in
question_answers will have respective row in extra answers table. Current
implementation of question_type::get_question_options() won't return such
answers at all. This commit fix that, changing join type for db query.
Also fixed coding style violation in the variable name in get_question_options.