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]

Multianswer question renderer classes. Handle shortanswer, numerical and various multichoice subquestions

Copyright: 2010 Pierre Pichet
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 760 lines (30 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 8 classes

qtype_multianswer_renderer:: (3 methods):
  formulation_and_controls()
  subquestion()
  correct_response()

qtype_multianswer_subq_renderer_base:: (3 methods):
  feedback_popup()
  get_feedback_image()
  get_answer_label()

qtype_multianswer_textfield_renderer:: (1 method):
  subquestion()

qtype_multianswer_multichoice_inline_renderer:: (1 method):
  subquestion()

qtype_multianswer_multichoice_vertical_renderer:: (5 methods):
  subquestion()
  choice_wrapper_start()
  choice_wrapper_end()
  all_choices_wrapper_start()
  all_choices_wrapper_end()

qtype_multianswer_multichoice_horizontal_renderer:: (4 methods):
  choice_wrapper_start()
  choice_wrapper_end()
  all_choices_wrapper_start()
  all_choices_wrapper_end()

qtype_multianswer_multiresponse_vertical_renderer:: (5 methods):
  subquestion()
  choice_wrapper_start()
  choice_wrapper_end()
  all_choices_wrapper_start()
  all_choices_wrapper_end()

qtype_multianswer_multiresponse_horizontal_renderer:: (4 methods):
  choice_wrapper_start()
  choice_wrapper_end()
  all_choices_wrapper_start()
  all_choices_wrapper_end()


Class: qtype_multianswer_renderer  - X-Ref

Base class for generating the bits of output common to multianswer
(Cloze) questions.
This render the main question text and transfer to the subquestions
the task of display their input elements and status
feedback, grade, correct answer(s)

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

subquestion(question_attempt $qa,question_display_options $options, $index, question_automatically_gradable $subq)   X-Ref
No description

correct_response(question_attempt $qa)   X-Ref
No description

Class: qtype_multianswer_subq_renderer_base  - X-Ref

Subclass for generating the bits of output specific to shortanswer
subquestions.

feedback_popup(question_graded_automatically $subq,$fraction, $feedbacktext, $rightanswer, question_display_options $options)   X-Ref
Render the feedback pop-up contents.

param: question_graded_automatically $subq the subquestion.
param: float $fraction the mark the student got. null if this subq was not answered.
param: string $feedbacktext the feedback text, already processed with format_text etc.
param: string $rightanswer the right answer, already processed with format_text etc.
param: question_display_options $options the display options.
return: string the HTML for the feedback popup.

get_feedback_image(string $icon, string $feedbackcontents)   X-Ref
Render the feedback icon for a sub-question which is also the trigger for the feedback popover.

param: string $icon The feedback icon
param: string $feedbackcontents The feedback contents to be shown on the popover.
return: string

get_answer_label(string $langkey = 'answerx',string $component = 'question')   X-Ref
Generates a label for an answer field.

If the question number is set ({@see qtype_renderer::$questionnumber}), the label will
include the question number in order to indicate which question the answer field belongs to.

param: string $langkey The lang string key for the lang string that does not include the question number.
param: string $component The Frankenstyle component name.
return: string

Class: qtype_multianswer_textfield_renderer  - X-Ref

Subclass for generating the bits of output specific to shortanswer
subquestions.

subquestion(question_attempt $qa, question_display_options $options,$index, question_graded_automatically $subq)   X-Ref
No description

Class: qtype_multianswer_multichoice_inline_renderer  - X-Ref

Render an embedded multiple-choice question that is displayed as a select menu.

subquestion(question_attempt $qa, question_display_options $options,$index, question_graded_automatically $subq)   X-Ref
No description

Class: qtype_multianswer_multichoice_vertical_renderer  - X-Ref

Render an embedded multiple-choice question vertically, like for a normal
multiple-choice question.

subquestion(question_attempt $qa, question_display_options $options,$index, question_graded_automatically $subq)   X-Ref
No description

choice_wrapper_start($class)   X-Ref

param: string $class class attribute value.
return: string HTML to go before each choice.

choice_wrapper_end()   X-Ref

return: string HTML to go after each choice.

all_choices_wrapper_start()   X-Ref

return: string HTML to go before all the choices.

all_choices_wrapper_end()   X-Ref

return: string HTML to go after all the choices.

Class: qtype_multianswer_multichoice_horizontal_renderer  - X-Ref

Render an embedded multiple-choice question vertically, like for a normal
multiple-choice question.

choice_wrapper_start($class)   X-Ref
No description

choice_wrapper_end()   X-Ref
No description

all_choices_wrapper_start()   X-Ref
No description

all_choices_wrapper_end()   X-Ref
No description

Class: qtype_multianswer_multiresponse_vertical_renderer  - X-Ref

Class qtype_multianswer_multiresponse_renderer

subquestion(question_attempt $qa, question_display_options $options,$index, question_graded_automatically $subq)   X-Ref
Output the content of the subquestion.

param: question_attempt $qa
param: question_display_options $options
param: int $index
param: question_graded_automatically $subq
return: string

choice_wrapper_start($class)   X-Ref

param: string $class class attribute value.
return: string HTML to go before each choice.

choice_wrapper_end()   X-Ref

return: string HTML to go after each choice.

all_choices_wrapper_start()   X-Ref

return: string HTML to go before all the choices.

all_choices_wrapper_end()   X-Ref

return: string HTML to go after all the choices.

Class: qtype_multianswer_multiresponse_horizontal_renderer  - X-Ref

Render an embedded multiple-response question horizontally.

choice_wrapper_start($class)   X-Ref
No description

choice_wrapper_end()   X-Ref
No description

all_choices_wrapper_start()   X-Ref
No description

all_choices_wrapper_end()   X-Ref
No description