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.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

External question API

Copyright: 2016 Pau Ferrer <pau@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 336 lines (13 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 1 class


Class: core_question_external  - X-Ref

Question external functions

update_flag_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

update_flag($qubaid, $questionid, $qaid, $slot, $checksum, $newstate)   X-Ref
Update the flag state of a question attempt.

param: int $qubaid the question usage id.
param: int $questionid the question id.
param: int $qaid the question_attempt id.
param: int $slot the slot number within the usage.
param: string $checksum checksum, as computed by {@link get_toggle_checksum()}
param: bool $newstate the new state of the flag. true = flagged.
return: array (success infos and fail infos)

update_flag_returns()   X-Ref
Returns description of method result value

return: external_description

submit_tags_form_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters.

submit_tags_form($questionid, $contextid, $formdata)   X-Ref
Handles the tags form submission.

param: int $questionid The question id.
param: int $contextid The editing context id.
param: string $formdata The question tag form data in a URI encoded param string
return: array The created or modified question tag

submit_tags_form_returns()   X-Ref
Returns description of method result value.


submit_tags_form_is_deprecated()   X-Ref
Marking the method as deprecated.

return: bool

get_random_question_summaries_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters.

get_random_question_summaries($categoryid,$includesubcategories,$tagids,$contextid,$limit = 0,$offset = 0)   X-Ref
Gets the list of random questions for the given criteria. The questions
will be exported in a summaries format and won't include all of the
question data.

param: int $categoryid Category id to find random questions
param: bool $includesubcategories Include the subcategories in the search
param: int[] $tagids Only include questions with these tags
param: int $contextid The context id where the questions will be rendered
param: int $limit Maximum number of results to return
param: int $offset Number of items to skip from the beginning of the result set.
return: array The list of questions and total question count.

get_random_question_summaries_returns()   X-Ref
Returns description of method result value.