Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Class: edit_renderer  - X-Ref

Renderer outputting the quiz editing UI.

edit_page(\mod_quiz\quiz_settings $quizobj, structure $structure,\core_question\local\bank\question_edit_contexts $contexts, \moodle_url $pageurl, array $pagevars)   X-Ref
Render the edit page

param: \mod_quiz\quiz_settings $quizobj object containing all the quiz settings information.
param: structure $structure object containing the structure of the quiz.
param: \core_question\local\bank\question_edit_contexts $contexts the relevant question bank contexts.
param: \moodle_url $pageurl the canonical URL of this page.
param: array $pagevars the variables from {@link question_edit_setup()}.
return: string HTML to output.

quiz_state_warnings(structure $structure)   X-Ref
Render any warnings that might be required about the state of the quiz,
e.g. if it has been attempted, or if the shuffle questions option is
turned on.

param: structure $structure the quiz structure.
return: string HTML to output.

quiz_information(structure $structure)   X-Ref
Render the status bar.

param: structure $structure the quiz structure.
return: string HTML to output.

maximum_grade_input($structure, \moodle_url $pageurl)   X-Ref
Render the form for setting a quiz' overall grade

param: structure $structure the quiz structure.
param: \moodle_url $pageurl the canonical URL of this page.
return: string HTML to output.

repaginate_button(structure $structure, \moodle_url $pageurl)   X-Ref
Return the repaginate button

param: structure $structure the structure of the quiz being edited.
param: \moodle_url $pageurl the canonical URL of this page.
return: string HTML to output.

selectmultiple_button(structure $structure)   X-Ref
Generate the bulk action button.

param: structure $structure the structure of the quiz being edited.
return: string HTML to output.

selectmultiple_controls(structure $structure)   X-Ref
Generate the controls that appear when the bulk action button is pressed.

param: structure $structure the structure of the quiz being edited.
return: string HTML to output.

repaginate_form(structure $structure, \moodle_url $pageurl)   X-Ref
Return the repaginate form

param: structure $structure the structure of the quiz being edited.
param: \moodle_url $pageurl the canonical URL of this page.
return: string HTML to output.

total_marks($quiz)   X-Ref
Render the total marks available for the quiz.

param: \stdClass $quiz the quiz settings from the database.
return: string HTML to output.

start_section_list(structure $structure)   X-Ref
Generate the starting container html for the start of a list of sections

param: structure $structure the structure of the quiz being edited.
return: string HTML to output.

end_section_list()   X-Ref
Generate the closing container html for the end of a list of sections

return: string HTML to output.

start_section($structure, $section)   X-Ref
Display the start of a section, before the questions.

param: structure $structure the structure of the quiz being edited.
param: \stdClass $section The quiz_section entry from DB
return: string HTML to output.

section_shuffle_questions(structure $structure, $section)   X-Ref
Display a checkbox for shuffling question within a section.

param: structure $structure object containing the structure of the quiz.
param: \stdClass $section data from the quiz_section table.
return: string HTML to output.

end_section()   X-Ref
Display the end of a section, after the questions.

return: string HTML to output.

section_remove_icon($section)   X-Ref
Render an icon to remove a section from the quiz.

param: stdClass $section the section to be removed.
return: string HTML to output.

questions_in_section(structure $structure, $section,$contexts, $pagevars, $pageurl)   X-Ref
Renders HTML to display the questions in a section of the quiz.

This function calls {@link core_course_renderer::quiz_section_question()}

param: structure $structure object containing the structure of the quiz.
param: \stdClass $section information about the section.
param: \core_question\local\bank\question_edit_contexts $contexts the relevant question bank contexts.
param: array $pagevars the variables from {@link \question_edit_setup()}.
param: \moodle_url $pageurl the canonical URL of this page.
return: string HTML to output.

question_row(structure $structure, $slot, $contexts, $pagevars, $pageurl)   X-Ref
Displays one question with the surrounding controls.

param: structure $structure object containing the structure of the quiz.
param: int $slot which slot we are outputting.
param: \core_question\local\bank\question_edit_contexts $contexts the relevant question bank contexts.
param: array $pagevars the variables from {@link \question_edit_setup()}.
param: \moodle_url $pageurl the canonical URL of this page.
return: string HTML to output.

page_row(structure $structure, $slot, $contexts, $pagevars, $pageurl)   X-Ref
Displays one question with the surrounding controls.

param: structure $structure object containing the structure of the quiz.
param: int $slot the first slot on the page we are outputting.
param: \core_question\local\bank\question_edit_contexts $contexts the relevant question bank contexts.
param: array $pagevars the variables from {@link \question_edit_setup()}.
param: \moodle_url $pageurl the canonical URL of this page.
return: string HTML to output.

add_menu_actions(structure $structure, $page, \moodle_url $pageurl,\core_question\local\bank\question_edit_contexts $contexts, array $pagevars)   X-Ref
Returns the add menu that is output once per page.

param: structure $structure object containing the structure of the quiz.
param: int $page the page number that this menu will add to.
param: \moodle_url $pageurl the canonical URL of this page.
param: \core_question\local\bank\question_edit_contexts $contexts the relevant question bank contexts.
param: array $pagevars the variables from {@link \question_edit_setup()}.
return: string HTML to output.

edit_menu_actions(structure $structure, $page,\moodle_url $pageurl, array $pagevars)   X-Ref
Returns the list of actions to go in the add menu.

param: structure $structure object containing the structure of the quiz.
param: int $page the page number that this menu will add to.
param: \moodle_url $pageurl the canonical URL of this page.
param: array $pagevars the variables from {@link \question_edit_setup()}.
return: array the actions.

add_question_form(structure $structure, $page, \moodle_url $pageurl, array $pagevars)   X-Ref
Render the form that contains the data for adding a new question to the quiz.

param: structure $structure object containing the structure of the quiz.
param: int $page the page number that this menu will add to.
param: \moodle_url $pageurl the canonical URL of this page.
param: array $pagevars the variables from {@link \question_edit_setup()}.
return: string HTML to output.

question(structure $structure, int $slot, \moodle_url $pageurl)   X-Ref
Display a question.

param: structure $structure object containing the structure of the quiz.
param: int $slot the first slot on the page we are outputting.
param: \moodle_url $pageurl the canonical URL of this page.
return: string HTML to output.

get_checkbox_render(structure $structure, int $slot)   X-Ref
Get the checkbox render.

param: structure $structure object containing the structure of the quiz.
param: int $slot the slot on the page we are outputting.
return: string HTML to output.

get_question_name_for_slot(structure $structure, int $slot, \moodle_url $pageurl)   X-Ref
Get the question name for the slot.

param: structure $structure object containing the structure of the quiz.
param: int $slot the slot on the page we are outputting.
param: \moodle_url $pageurl the canonical URL of this page.
return: string HTML to output.

get_action_icon(structure $structure, int $slot, \moodle_url $pageurl)   X-Ref
Get the action icons render.

param: structure $structure object containing the structure of the quiz.
param: int $slot the slot on the page we are outputting.
param: \moodle_url $pageurl the canonical URL of this page.
return: string HTML to output.

question_move_icon(structure $structure, $slot)   X-Ref
Render the move icon.

param: structure $structure object containing the structure of the quiz.
param: int $slot the first slot on the page we are outputting.
return: string The markup for the move action.

question_number(string $editablenumber, string $uncustomisednumber)   X-Ref
Output the question number.

param: string $editablenumber The, which may be an in-place editable.
param: string $uncustomisednumber The un-customised number number, or 'i'.
return: string HTML to output.

question_preview_icon($quiz, $questiondata, $label = null, $variant = null, $restartversion = null)   X-Ref
Render the preview icon.

param: \stdClass $quiz the quiz settings from the database.
param: \stdClass $questiondata which question to preview.
param: bool $label if true, show the preview question label after the icon
param: int $variant which question variant to preview (optional).
param: int $restartversion version to use when restarting the preview
return: string HTML to output.

question_remove_icon(structure $structure, $slot, $pageurl)   X-Ref
Render an icon to remove a question from the quiz.

param: structure $structure object containing the structure of the quiz.
param: int $slot the first slot on the page we are outputting.
param: \moodle_url $pageurl the canonical URL of the edit page.
return: string HTML to output.

page_split_join_button($structure, $slot)   X-Ref
Display an icon to split or join two pages of the quiz.

param: structure $structure object containing the structure of the quiz.
param: int $slot the first slot on the page we are outputting.
return: string HTML to output.

question_dependency_icon($structure, $slot)   X-Ref
Display the icon for whether this question can only be seen if the previous
one has been answered.

param: structure $structure object containing the structure of the quiz.
param: int $slot the first slot on the page we are outputting.
return: string HTML to output.

question_name(structure $structure, $slot, $pageurl)   X-Ref
Renders html to display a name with the link to the question on a quiz edit page

If the user does not have permission to edi the question, it is rendered
without a link

param: structure $structure object containing the structure of the quiz.
param: int $slot which slot we are outputting.
param: \moodle_url $pageurl the canonical URL of this page.
return: string HTML to output.

random_question(structure $structure, $slotnumber, $pageurl)   X-Ref
Renders html to display a random question the link to edit the configuration
and also to see that category in the question bank.

param: structure $structure object containing the structure of the quiz.
param: int $slotnumber which slot we are outputting.
param: \moodle_url $pageurl the canonical URL of this page.
return: string HTML to output.

marked_out_of_field(structure $structure, $slot)   X-Ref
Display the 'marked out of' information for a question.
Along with the regrade action.

param: structure $structure object containing the structure of the quiz.
param: int $slot which slot we are outputting.
return: string HTML to output.

render_question_chooser(renderable $chooser)   X-Ref
Renders the question chooser.

param: renderable
return: string

question_chooser()   X-Ref
Render the question type chooser dialogue.

return: string HTML to output.

question_bank_loading()   X-Ref
Render the contents of the question bank pop-up in its initial state,
when it just contains a loading progress indicator.

return: string HTML to output.

initialise_editing_javascript(structure $structure,\core_question\local\bank\question_edit_contexts $contexts, array $pagevars, \moodle_url $pageurl)   X-Ref
Initialise the JavaScript for the general editing. (JavaScript for popups
is handled with the specific code for those.)

param: structure $structure object containing the structure of the quiz.
param: \core_question\local\bank\question_edit_contexts $contexts the relevant question bank contexts.
param: array $pagevars the variables from {@link \question_edit_setup()}.
param: \moodle_url $pageurl the canonical URL of this page.
return: bool Always returns true

new_page_template(structure $structure,\core_question\local\bank\question_edit_contexts $contexts, array $pagevars, \moodle_url $pageurl)   X-Ref
HTML for a page, with ids stripped, so it can be used as a javascript template.

param: structure $structure object containing the structure of the quiz.
param: \core_question\local\bank\question_edit_contexts $contexts the relevant question bank contexts.
param: array $pagevars the variables from {@link \question_edit_setup()}.
param: \moodle_url $pageurl the canonical URL of this page.
return: string HTML for a new page.

add_page_icon_template(structure $structure)   X-Ref
HTML for a page, with ids stripped, so it can be used as a javascript template.

param: structure $structure object containing the structure of the quiz.
return: string HTML for a new icon

question_bank_contents(\mod_quiz\question\bank\custom_view $questionbank, array $pagevars)   X-Ref
Return the contents of the question bank, to be displayed in the question-bank pop-up.

param: \mod_quiz\question\bank\custom_view $questionbank the question bank view object.
param: array $pagevars the variables from {@link \question_edit_setup()}.
return: string HTML to output / send back in response to an AJAX request.