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 401 and 403]

Helper class for adding/editing a question. This code is based on question/editlib.php by Martin Dougiamas.

Author: Safat Shahin <safatshahin@catalyst-au.net>
Copyright: 2021 Catalyst IT Australia Pty Ltd
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 115 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: editquestion_helper  - X-Ref

Class editquestion_helper for methods related to add/edit/copy

print_choose_qtype_to_add_form(array $hiddenparams, array $allowedqtypes = null, $enablejs = true)   X-Ref
Print a form to let the user choose which question type to add.
When the form is submitted, it goes to the question.php script.

param: array|null $hiddenparams hidden parameters to add to the form, in addition to
param: array|null $allowedqtypes optional list of qtypes that are allowed. If given, only
param: bool $enablejs
return: bool|string

create_new_question_button($categoryid, $params, $canadd, $tooltip = '', $disabled = false)   X-Ref
Print a button for creating a new question. This will open question/addquestion.php,
which in turn goes to question/question.php before getting back to $params['returnurl']
(by default the question bank screen).

param: int $categoryid The id of the category that the new question should be added to.
param: array $params Other paramters to add to the URL. You need either $params['cmid'] or
param: bool $canadd the text to display on the button.
param: string $tooltip a tooltip to add to the button (optional).
param: bool $disabled if true, the button will be disabled.

get_question_status_string($status)   X-Ref
Get the string for the status of the question.

param: string $status
return: string

get_question_status_list()   X-Ref
Get the array of status of the questions.

return: array