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]

Defines the renderer base class for question behaviours.

Copyright: 2009 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 297 lines (13 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

qbehaviour_renderer:: (10 methods):
  controls()
  feedback()
  manual_comment_fields()
  manual_comment_view()
  manual_comment()
  submit_button()
  head_code()
  mark_summary()
  marked_out_of_max()
  mark_out_of_max()


Class: qbehaviour_renderer  - X-Ref

Renderer base class for question behaviours.

The methods in this class are mostly called from {@link core_question_renderer}
which coordinates the overall output of questions.

controls(question_attempt $qa, question_display_options $options)   X-Ref
Generate some HTML (which may be blank) that appears in the question
formulation area, afer the question type generated output.

For example.
immediatefeedback and interactive mode use this to show the Submit button,
and CBM use this to display the certainty choices.

param: question_attempt $qa a question attempt.
param: question_display_options $options controls what should and should not be displayed.
return: string HTML fragment.

feedback(question_attempt $qa, question_display_options $options)   X-Ref
Generate some HTML (which may be blank) that appears in the outcome area,
after the question-type generated output.

For example, the CBM models use this to display an explanation of the score
adjustment that was made based on the certainty selected.

param: question_attempt $qa a question attempt.
param: question_display_options $options controls what should and should not be displayed.
return: string HTML fragment.

manual_comment_fields(question_attempt $qa, question_display_options $options)   X-Ref
No description

manual_comment_view(question_attempt $qa, question_display_options $options)   X-Ref
No description

manual_comment(question_attempt $qa, question_display_options $options)   X-Ref
Display the manual comment, and a link to edit it, if appropriate.

param: question_attempt $qa a question attempt.
param: question_display_options $options controls what should and should not be displayed.
return: string HTML fragment.

submit_button(question_attempt $qa, question_display_options $options)   X-Ref
Several behaviours need a submit button, so put the common code here.
The button is disabled if the question is displayed read-only.

param: question_display_options $options controls what should and should not be displayed.
return: string HTML fragment.

head_code(question_attempt $qa)   X-Ref
Return any HTML that needs to be included in the page's <head> when
questions using this model are used.

param: $qa the question attempt that will be displayed on the page.
return: string HTML fragment.

mark_summary(question_attempt $qa, core_question_renderer $qoutput,question_display_options $options)   X-Ref
Generate the display of the marks for this question.

param: question_attempt $qa the question attempt to display.
param: core_question_renderer $qoutput the renderer for standard parts of questions.
param: question_display_options $options controls what should and should not be displayed.
return: HTML fragment.

marked_out_of_max(question_attempt $qa, core_question_renderer $qoutput,question_display_options $options)   X-Ref
Generate the display of the available marks for this question.

param: question_attempt $qa the question attempt to display.
param: core_question_renderer $qoutput the renderer for standard parts of questions.
param: question_display_options $options controls what should and should not be displayed.
return: HTML fragment.

mark_out_of_max(question_attempt $qa, core_question_renderer $qoutput,question_display_options $options)   X-Ref
Generate the display of the marks for this question out of the available marks.

param: question_attempt $qa the question attempt to display.
param: core_question_renderer $qoutput the renderer for standard parts of questions.
param: question_display_options $options controls what should and should not be displayed.
return: HTML fragment.