Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Public Member Functions | |
add_question_identifier_to_label (string $label, bool $sridentifier=false, bool $addbefore=false) | |
Helper to add the question identify (if there is one) to the label of an input field in a question. | |
has_question_identifier () | |
Whether a question number has been provided for the question that is being displayed. | |
hide_all_feedback () | |
Set all the feedback-related fields, feedback, numpartscorrect, generalfeedback, rightanswer, manualcomment} and correctness to {. | |
Static Public Member Functions | |
static | get_dp_options () |
Returns the valid choices for the number of decimal places for showing question marks. | |
static | make_from_quiz (\stdClass $quiz, int $when) |
Set up the various options from the quiz settings, and a time constant. | |
Public Attributes | |
bool | $attempt = true |
if this is false, then the student is not allowed to review anything about the attempt. | |
boolean | $clearwrong = false |
whether the question type should output hidden form fields to reset any incorrect parts of the resonse to blank. | |
context | $context |
the context the attempt being output belongs to. | |
int | $correctness = self::VISIBLE |
Should the student have what they got right and wrong clearly indicated. | |
array | $editquestionparams = array() |
If not empty, then a link to edit the question will be included in the info box for the question. | |
string | $extrahistorycontent = '' |
string | $extrainfocontent = '' |
int | $feedback = self::VISIBLE |
Should the specific feedback be visible. | |
int | $flags = self::VISIBLE |
Should the flag this question UI element be visible, and if so, should the flag state be changeable? | |
int | $generalfeedback = self::VISIBLE |
Should the general feedback be visible? | |
int | $history = self::HIDDEN |
Should the history of previous question states table be visible? {. | |
int | $manualcomment = self::VISIBLE |
Should the manually added marker's comment be visible. | |
string | $manualcommentlink = null |
Should we show a 'Make comment or override grade' link? base URL for the edit comment script, which will be shown if $manualcomment = self\VISIBLE. | |
int | $markdp = 2 |
of decimal places to use when formatting marks for output. | |
int | $marks = self::MARK_AND_MAX |
The the mark and/or the maximum available mark for this question be visible? {. | |
int | $numpartscorrect = self::VISIBLE |
For questions with a number of sub-parts (like matching, or multiple-choice, multiple-reponse) display the number of sub-parts that were correct. | |
int | $overallfeedback = self::VISIBLE |
whether the attempt overall feedback is visible. | |
string | $questionidentifier = null |
This identifier should be added to the labels of all input fields in the question. | |
moodle_url | $questionreviewlink = null |
Used in places like the question history table, to show a link to review this question in a certain state. | |
boolean | $readonly = false |
whether the question should be displayed as a read-only review, or in an active state where you can change the answer. | |
int | $rightanswer = self::VISIBLE |
Should the automatically generated display of what the correct answer be visible? | |
int | $userinfoinhistory = self::HIDDEN |
The option to show the action author in the response history. | |
int const | AFTER_CLOSE = 0x00010 |
as above, bit used to indicate 'after the quiz is closed'. | |
int const | DURING = 0x10000 |
The bitmask patterns use in the review option settings. | |
const | EDITABLE = 2 |
const | HIDDEN = 0 |
int const | IMMEDIATELY_AFTER = 0x01000 |
as above, bit used to indicate 'immediately after the attempt'. | |
int const | LATER_WHILE_OPEN = 0x00100 |
as above, bit used to indicate 'later while the quiz is still open'. | |
const | MARK_AND_MAX = 2 |
int const | MAX_DP = 7 |
#- | |
int const | MAX_ONLY = 1 |
#- | |
int const | SHOW_ALL = -1 |
#+ named constants for the values that most of the options take. | |
const | VISIBLE = 1 |
Static Protected Member Functions | |
static | extract (int $setting, int $when, $whenset=self::VISIBLE, $whennotset=self::HIDDEN) |
Helper function to return one value or another depending on whether one bit is set. | |
|
inherited |
Helper to add the question identify (if there is one) to the label of an input field in a question.
string | $label | The plain field label. E.g. 'Answer 1' |
bool | $sridentifier | If true, the question identifier, if added, will be wrapped in a sr-only span. Default false. |
bool | $addbefore | If true, the question identifier will be added before the label. |
string | The amended label. For example 'Answer 1, Question 1'. |
|
staticprotected |
Helper function to return one value or another depending on whether one bit is set.
int | $setting | the setting to unpack (e.g. $quiz->reviewmarks). |
int | $when | of the constants { |
bool | int | $whenset | value to return when the bit is set. |
bool | int | $whennotset | value to return when the bit is set. |
bool|int\$whenset | or $whennotset, depending. |
|
staticinherited |
Returns the valid choices for the number of decimal places for showing question marks.
For use in the user interface.
Calling code should probably use {
array | suitable for passing to { |
|
inherited |
Whether a question number has been provided for the question that is being displayed.
bool |
|
inherited |
Set all the feedback-related fields, feedback, numpartscorrect, generalfeedback, rightanswer, manualcomment} and correctness to {.
|
static |
Set up the various options from the quiz settings, and a time constant.
stdClass | $quiz | the quiz settings from the database. |
int | $when | of the constants { |
display_options | instance of this class set up appropriately. |
|
inherited |
Should the student have what they got right and wrong clearly indicated.
This includes the green/red hilighting of the bits of their response, whether the one-line summary of the current state of the question says correct/incorrect or just answered. {
|
inherited |
If not empty, then a link to edit the question will be included in the info box for the question.
If used, this array must contain an element courseid or cmid.
It shoudl also contain a parameter returnurl => moodle_url giving a sensible URL to go back to when the editing form is submitted or cancelled.
url parameter for the edit link. id => questiosnid will be added automatically.
|
inherited |
|
inherited |
This field is now badly named. The place it included is was changed (for the better) but the name was left unchanged for backwards compatibility.
|
inherited |
Should the specific feedback be visible.
Specific feedback is typically the part of the feedback that changes based on the answer that the student gave. For example the feedback shown if a particular choice has been chosen in a multi-choice question. It also includes the combined feedback that a lost of question types have (e.g. feedback for any correct/incorrect response.)
{
|
inherited |
Should the flag this question UI element be visible, and if so, should the flag state be changeable?
{
|
inherited |
Should the general feedback be visible?
This is typically feedback shown to all students after the question is finished, irrespective of which answer they gave.
{
|
inherited |
Should the history of previous question states table be visible? {.
|
inherited |
Should the manually added marker's comment be visible.
Should the link for adding/editing the comment be there. {
|
inherited |
The the mark and/or the maximum available mark for this question be visible? {.
|
inherited |
For questions with a number of sub-parts (like matching, or multiple-choice, multiple-reponse) display the number of sub-parts that were correct.
{
|
inherited |
This identifier should be added to the labels of all input fields in the question.
This is so people using assistive technology can easily tell which input belong to which question. The helper {
If not set before the question is rendered, then it defaults to 'Question N'. (lang string)
The identifier that the question being rendered is associated with. E.g. The question number when it is rendered on a quiz.
|
inherited |
Used in places like the question history table, to show a link to review this question in a certain state.
If blank, a link is not shown. base URL for a review question script.
|
inherited |
Should the automatically generated display of what the correct answer be visible?
{
int const mod_quiz\question\display_options::DURING = 0x10000 |
The bitmask patterns use in the review option settings.
In the quiz settings, the review... (e.g. reviewmarks) values are bit patterns that allow what is visible to be change at different times. These constants define which bit is for which time.
bit used to indicate 'during the attempt'.
|
inherited |
#-
maximum value for the {
|
inherited |
#-
#+ named constants for the {