Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

Renderer outputting the quiz editing UI.

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

Defines 1 class


Class: edit_renderer  - X-Ref

Renderer outputting the quiz editing UI.

edit_page(\quiz $quizobj, structure $structure,\question_edit_contexts $contexts, \moodle_url $pageurl, array $pagevars)   X-Ref
Render the edit page

param: \quiz $quizobj object containing all the quiz settings information.
param: structure $structure object containing the structure of the quiz.
param: \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: object $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: \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: \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: \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,\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: \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, $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.

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($number)   X-Ref
Output the question number.

param: string $number The number, or 'i'.
return: string HTML to output.

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

param: \stdClass $quiz the quiz settings from the database.
param: \stdClass $question data from the question and quiz_slots tables.
param: bool $label if true, show the preview question label after the icon
param: int $variant which question variant to preview (optional).
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,\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: \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,\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: \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.