Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Class helper contains all the helper functions. More...
Static Public Member Functions | |
static | get_preview_extra_elements (question_definition $question, int $courseid) |
Get the extra elements for preview from qbank plugins. | |
static | get_restart_id (array $versions, int $restartversion) |
Return the question ID from the array of id => version that corresponds to the requested version. | |
static | is_latest (string $version, string $questionbankentryid) |
Checks if question is the latest version. | |
static | load_versions (string $questionbankentryid) |
Loads question version ids for current question. | |
static | question_preview_action_url ($questionid, $qubaid, question_preview_options $options, $context, $returnurl=null, $restartversion=null) |
The the URL to use for actions relating to this preview. | |
static | question_preview_form_url ($questionid, $context, $previewid=null, $returnurl=null) |
The the URL to use for actions relating to this preview. | |
static | question_preview_popup_params () |
Popup params for the question preview. | |
static | question_preview_question_pluginfile ($course, $context, $component, $filearea, $qubaid, $slot, $args, $forcedownload, $fileoptions) |
Called via pluginfile.php -> question_pluginfile to serve files belonging to a question in a question_attempt when that attempt is a preview. | |
static | question_preview_url ($questionid, $preferredbehaviour=null, $maxmark=null, $displayoptions=null, $variant=null, $context=null, $returnurl=null, $restartversion=null) |
Generate the URL for starting a new preview of a given question with the given options. | |
static | restart_preview ($previewid, $questionid, $displayoptions, $context, $returnurl=null, $restartversion=null) |
Delete the current preview, if any, and redirect to start a new preview. | |
Class helper contains all the helper functions.
|
static |
Get the extra elements for preview from qbank plugins.
question_definition | $question | question definition object |
int | $courseid | id of the course |
array |
|
static |
Return the question ID from the array of id => version that corresponds to the requested version.
If the requested version is question_preview_options\ALWAYS_LATEST, this will return the latest version.
array | $versions | |
int | $restartversion |
?int |
|
static |
Checks if question is the latest version.
string | $version | Question version to check |
string | $questionbankentryid | Entry to check against |
bool |
|
static |
Loads question version ids for current question.
string | $questionbankentryid | Question bank entry id |
array\$questionids | Array containing question id as key and version as value. |
|
static |
The the URL to use for actions relating to this preview.
int | $questionid | the question being previewed |
int | $qubaid | the id of the question usage for this preview |
question_preview_options | $options | the options in use |
context | $context | context for the question preview |
moodle_url | $returnurl | url of the page to return to |
int | null | $restartversion | version of the question to use when next restarting the preview. |
moodle_url |
|
static |
The the URL to use for actions relating to this preview.
int | $questionid | the question being previewed |
context | $context | the current moodle context |
int | $previewid | optional previewid to sign post saved previewed answers |
moodle_url | $returnurl | url of the page to return to |
moodle_url |
|
static |
Popup params for the question preview.
array | that can be passed as $params to the { |
|
static |
Called via pluginfile.php -> question_pluginfile to serve files belonging to a question in a question_attempt when that attempt is a preview.
stdClass | $course | course settings object |
stdClass | $context | context object |
string | $component | the name of the component we are serving files for. |
string | $filearea | the name of the file area. |
int | $qubaid | the question_usage this image belongs to. |
int | $slot | the relevant slot within the usage. |
array | $args | the remaining bits of the file path. |
bool | $forcedownload | whether the user must be forced to download the file. |
array | $fileoptions | options for the stored files |
void | false if file not found, does not return if found - justsend the file |
|
static |
Generate the URL for starting a new preview of a given question with the given options.
integer | $questionid | the question to preview |
string | $preferredbehaviour | the behaviour to use for the preview |
float | $maxmark | the maximum to mark the question out of |
question_display_options | $displayoptions | the display options to use |
int | $variant | the variant of the question to preview. If null, one will be picked randomly |
object | $context | context to run the preview in (affects things like filter settings, theme, lang, etc.) Defaults to $PAGE->context |
moodle_url | $returnurl | url of the page to return to |
int | $restartversion | The version of the question to use when restarting the preview. |
moodle_url | the URL |
|
static |
Delete the current preview, if any, and redirect to start a new preview.
int | $previewid | id of the preview while restarting it |
int | $questionid | id of the question in preview |
object | $displayoptions | display options for the question in preview |
object | $context | context of the question for preview |
moodle_url | $returnurl | url of the page to return to |
int | null | $restartversion | version of the question to use when next restarting the preview. |
void |