Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Classes | Functions | Variables
questiontype.php File Reference

Question type class for the multi-answer question type. More...

Classes

class  qtype_multianswer
 The multi-answer question type class. More...
 

Functions

 qtype_multianswer_extract_question ($text)
 
 qtype_multianswer_initialise_multichoice_subquestion ($wrapped)
 Initialise subquestion fields that are constant across all MULTICHOICE types. More...
 
 qtype_multianswer_validate_question (stdClass $question)
 Validate a multianswer question. More...
 

Variables

const ANSWER_ALTERNATIVE_ANSWER_REGEX '.+?(?<!\\\\|&|&amp;)(?=[~#}]|$)'
 
const ANSWER_ALTERNATIVE_FEEDBACK_REGEX '.*?(?<!::::::::)(?=[~}]|$)'
 
const ANSWER_ALTERNATIVE_FRACTION_REGEX '=|%(-?[0-9]+(?:[.,][0-9]*)?)%'
 
const ANSWER_ALTERNATIVE_REGEX '(' . ANSWER_ALTERNATIVE_FRACTION_REGEX .')?' . '(' . ANSWER_ALTERNATIVE_ANSWER_REGEX . ')' . '(#(' . ANSWER_ALTERNATIVE_FEEDBACK_REGEX .'))?'
 
const ANSWER_ALTERNATIVE_REGEX_ANSWER 3
 
const ANSWER_ALTERNATIVE_REGEX_FEEDBACK 5
 
const ANSWER_ALTERNATIVE_REGEX_FRACTION 1
 
const ANSWER_ALTERNATIVE_REGEX_PERCENTILE_FRACTION 2
 
const ANSWER_REGEX ANSWER_START_REGEX . '(' . ANSWER_ALTERNATIVE_REGEX . '(~' . ANSWER_ALTERNATIVE_REGEX . ')*)::}'
 
const ANSWER_REGEX_ALTERNATIVES 16
 
const ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE 4
 
const ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE_HORIZONTAL 6
 
const ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE_HORIZONTAL_SHUFFLED 11
 
const ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE_REGULAR 5
 
const ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE_REGULAR_SHUFFLED 10
 
const ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE_SHUFFLED 9
 
const ANSWER_REGEX_ANSWER_TYPE_MULTIRESPONSE 12
 
const ANSWER_REGEX_ANSWER_TYPE_MULTIRESPONSE_HORIZONTAL 13
 
const ANSWER_REGEX_ANSWER_TYPE_MULTIRESPONSE_HORIZONTAL_SHUFFLED 15
 
const ANSWER_REGEX_ANSWER_TYPE_MULTIRESPONSE_SHUFFLED 14
 
const ANSWER_REGEX_ANSWER_TYPE_NUMERICAL 3
 
const ANSWER_REGEX_ANSWER_TYPE_SHORTANSWER 7
 
const ANSWER_REGEX_ANSWER_TYPE_SHORTANSWER_C 8
 
const ANSWER_REGEX_NORM 1
 
const ANSWER_START_REGEX '\{([0-9]*):(' . ANSWER_TYPE_DEF_REGEX . '):'
 
const ANSWER_TYPE_DEF_REGEX '(NUMERICAL|NM)|(MULTICHOICE|MC)|(MULTICHOICE_V|MCV)|(MULTICHOICE_H|MCH)|' . '(SHORTANSWER|SA|MW)|(SHORTANSWER_C|SAC|MWC)|' . '(MULTICHOICE_S|MCS)|(MULTICHOICE_VS|MCVS)|(MULTICHOICE_HS|MCHS)|'. '(MULTIRESPONSE|MR)|(MULTIRESPONSE_H|MRH)|(MULTIRESPONSE_S|MRS)|(MULTIRESPONSE_HS|MRHS)'
 
const NUMBER_REGEX '-?(([0-9]+[.,]?[0-9]*|[.,][0-9]+)([eE][-+]?[0-9]+)?)'
 
const NUMERICAL_ABS_ERROR_MARGIN 6
 
const NUMERICAL_ALTERNATIVE_REGEX '^(' . NUMBER_REGEX . ')(:' . NUMBER_REGEX . ')?$'
 
const NUMERICAL_CORRECT_ANSWER 1
 

Detailed Description

Question type class for the multi-answer question type.

@subpackage multianswer

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later