Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.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