See Release Notes
Long Term Support Release
Differences Between: [Versions 401 and 402] [Versions 401 and 403]
(no description)
File Size: | 260 lines (12 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
qbank_helper:: (5 methods):
get_version_options()
get_question_structure()
get_tag_ids_for_slot()
describe_random_question()
choose_question_for_redo()
Class: qbank_helper - X-Ref
Helper class for question bank and its associated data.get_version_options(int $questionid) X-Ref |
Get the available versions of a question where one of the version has the given question id. param: int $questionid id of a question. return: \stdClass[] other versions of this question. Each object has fields versionid, |
get_question_structure(int $quizid, \context_module $quizcontext,int $slotid = null) X-Ref |
Get the information about which questions should be used to create a quiz attempt. Each element in the returned array is indexed by slot.slot (slot number) an each object hass: - All the field of the slot table. - contextid for where the question(s) come from. - category id for where the questions come from. - For non-random questions, All the fields of the question table (but id is in questionid). Also question version and question bankentryid. - For random questions, filtercondition, which is also unpacked into category, randomrecurse, randomtags, and note that these also have a ->name set and ->qtype set to 'random'. param: int $quizid the id of the quiz to load the data for. param: \context_module $quizcontext the context of this quiz. param: int|null $slotid optional, if passed only load the data for this one slot (if it is in this quiz). return: array indexed by slot, with information about the content of each slot. |
get_tag_ids_for_slot(\stdClass $slotdata) X-Ref |
Get this list of random selection tag ids from one of the slots returned by get_question_structure. param: \stdClass $slotdata one of the array elements returned by get_question_structure. return: array list of tag ids. |
describe_random_question(\stdClass $slotdata) X-Ref |
Given a slot from the array returned by get_question_structure, describe the random question it represents. param: \stdClass $slotdata one of the array elements returned by get_question_structure. return: string that can be used to display the random slot. |
choose_question_for_redo(int $quizid, \context_module $quizcontext,int $slotid, qubaid_condition $qubaids) X-Ref |
Choose question for redo in a particular slot. param: int $quizid the id of the quiz to load the data for. param: \context_module $quizcontext the context of this quiz. param: int $slotid optional, if passed only load the data for this one slot (if it is in this quiz). param: qubaid_condition $qubaids attempts to consider when avoiding picking repeats of random questions. return: int the id of the question to use. |