Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Question type class for the randomsamatch question type.

Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 235 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: qtype_randomsamatch  - X-Ref

The randomsamatch question type class.

TODO: Make sure short answer questions chosen by a randomsamatch question
can not also be used by a random question

is_usable_by_random()   X-Ref
No description

get_question_options($question)   X-Ref
No description

save_question_options($question)   X-Ref
No description

make_hint($hint)   X-Ref
No description

delete_question($questionid, $contextid)   X-Ref
No description

move_files($questionid, $oldcontextid, $newcontextid)   X-Ref
No description

delete_files($questionid, $contextid)   X-Ref
No description

initialise_question_instance(question_definition $question, $questiondata)   X-Ref
No description

can_analyse_responses()   X-Ref
No description

get_available_saquestions_from_category($categoryid, $subcategories)   X-Ref
Get all the usable shortanswer questions from a particular question category.

param: integer $categoryid the id of a question category.
param: bool $subcategories whether to include questions from subcategories.
return: array of question records.

get_random_guess_score($question)   X-Ref

param: object $question
return: mixed either a integer score out of 1 that the average random

extra_question_fields()   X-Ref
Defines the table which extends the question table. This allows the base questiontype
to automatically save, backup and restore the extra fields.

return: an array with the table name (first) and then the column names (apart from id and questionid)

import_from_xml($xml, $fromform, qformat_xml $format, $extra=null)   X-Ref
Imports the question from Moodle XML format.

param: array $xml structure containing the XML data
param: object $fromform question object to fill: ignored by this function (assumed to be null)
param: qformat_xml $format format class exporting the question
param: object $extra extra information (not required for importing this question in this format)
return: object question object

export_to_xml($question, qformat_xml $format, $extra=null)   X-Ref
Exports the question to Moodle XML format.

param: object $question question to be exported into XML format
param: qformat_xml $format format class exporting the question
param: object $extra extra information (not required for exporting this question in this format)
return: string containing the question data in XML format