Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
mod_quiz\output\edit_renderer Class Reference

Renderer outputting the quiz editing UI. More...

Inheritance diagram for mod_quiz\output\edit_renderer:
plugin_renderer_base renderer_base

Public Member Functions

 __call ($method, $arguments)
 Magic method used to pass calls otherwise meant for the standard renderer to it to ensure we don't go causing unnecessary grief.
 
 add_action_handler (component_action $action, $id=null)
 Adds a JS action for the element with the provided id.
 
 add_menu_actions (structure $structure, $page, moodle_url $pageurl, core_question\local\bank\question_edit_contexts $contexts, array $pagevars)
 Returns the add menu that is output once per page.
 
 edit_menu_actions (structure $structure, $page, moodle_url $pageurl, array $pagevars)
 Returns the list of actions to go in the add menu.
 
 edit_page (\mod_quiz\quiz_settings $quizobj, structure $structure, core_question\local\bank\question_edit_contexts $contexts, moodle_url $pageurl, array $pagevars)
 Render the edit page.
 
 get_action_icon (structure $structure, int $slot, moodle_url $pageurl)
 Get the action icons render.
 
 get_checkbox_render (structure $structure, int $slot)
 Get the checkbox render.
 
 get_compact_logo_url ($maxwidth=300, $maxheight=300)
 Return the site's compact logo URL, if any.
 
 get_logo_url ($maxwidth=null, $maxheight=200)
 Return the site's logo URL, if any.
 
 get_page ()
 Returns the moodle page object.
 
 get_question_name_for_slot (structure $structure, int $slot, moodle_url $pageurl)
 Get the question name for the slot.
 
 has_started ()
 Returns true is output has already started, and false if not.
 
 image_url ($imagename, $component='moodle')
 Return the moodle_url for an image.
 
 marked_out_of_field (structure $structure, $slot)
 Display the 'marked out of' information for a question.
 
 maximum_grade_input ($structure, moodle_url $pageurl)
 Render the form for setting a quiz' overall grade.
 
 page_row (structure $structure, $slot, $contexts, $pagevars, $pageurl)
 Displays one question with the surrounding controls.
 
 page_split_join_button ($structure, $slot)
 Display an icon to split or join two pages of the quiz.
 
 pix_url ($imagename, $component='moodle')
 Return the direct URL for an image from the pix folder.
 
 question (structure $structure, int $slot, moodle_url $pageurl)
 Display a question.
 
 question_bank_contents (\mod_quiz\question\bank\custom_view $questionbank, array $pagevars)
 Return the contents of the question bank, to be displayed in the question-bank pop-up.
 
 question_bank_loading ()
 Render the contents of the question bank pop-up in its initial state, when it just contains a loading progress indicator.
 
 question_chooser ()
 Render the question type chooser dialogue.
 
 question_dependency_icon ($structure, $slot)
 Display the icon for whether this question can only be seen if the previous one has been answered.
 
 question_move_icon (structure $structure, $slot)
 Render the move icon.
 
 question_name (structure $structure, $slot, $pageurl)
 Renders html to display a name with the link to the question on a quiz edit page.
 
 question_number (string $editablenumber, string $uncustomisednumber)
 Output the question number.
 
 question_preview_icon ($quiz, $questiondata, $label=null, $variant=null, $restartversion=null)
 Render the preview icon.
 
 question_remove_icon (structure $structure, $slot, $pageurl)
 Render an icon to remove a question from the quiz.
 
 question_row (structure $structure, $slot, $contexts, $pagevars, $pageurl)
 Displays one question with the surrounding controls.
 
 questions_in_section (structure $structure, $section, $contexts, $pagevars, $pageurl)
 Renders HTML to display the questions in a section of the quiz.
 
 quiz_information (structure $structure)
 Render the status bar.
 
 quiz_state_warnings (structure $structure)
 Render any warnings that might be required about the state of the quiz, e.g.
 
 random_question (structure $structure, $slotnumber, $pageurl)
 Renders html to display a random question the link to edit the configuration and also to see that category in the question bank.
 
 render (renderable $widget)
 Renders the provided widget and returns the HTML to display it.
 
 render_from_template ($templatename, $context)
 Renders a template by name with the given context.
 
 render_question_chooser (renderable $chooser)
 Renders the question chooser.
 
 section_remove_icon ($section)
 Render an icon to remove a section from the quiz.
 
 section_shuffle_questions (structure $structure, $section)
 Display a checkbox for shuffling question within a section.
 
 should_display_main_logo ()
 
 should_display_navbar_logo ()
 Whether we should display the logo in the navbar.
 
 total_marks ($quiz)
 Render the total marks available for the quiz.
 

Static Public Member Functions

static prepare_classes ($classes)
 Given an array or space-separated list of classes, prepares and returns the HTML class attribute value.
 

Protected Member Functions

 add_page_icon_template (structure $structure)
 HTML for a page, with ids stripped, so it can be used as a javascript template.
 
 add_question_form (structure $structure, $page, moodle_url $pageurl, array $pagevars)
 Render the form that contains the data for adding a new question to the quiz.
 
 end_section ()
 Display the end of a section, after the questions.
 
 end_section_list ()
 Generate the closing container html for the end of a list of sections.
 
 get_mustache ()
 Return an instance of the mustache class.
 
 initialise_editing_javascript (structure $structure, core_question\local\bank\question_edit_contexts $contexts, array $pagevars, moodle_url $pageurl)
 Initialise the JavaScript for the general editing.
 
 new_page_template (structure $structure, core_question\local\bank\question_edit_contexts $contexts, array $pagevars, moodle_url $pageurl)
 HTML for a page, with ids stripped, so it can be used as a javascript template.
 
 repaginate_button (structure $structure, moodle_url $pageurl)
 Return the repaginate button.
 
 repaginate_form (structure $structure, moodle_url $pageurl)
 Return the repaginate form.
 
 selectmultiple_button (structure $structure)
 Generate the bulk action button.
 
 selectmultiple_controls (structure $structure)
 Generate the controls that appear when the bulk action button is pressed.
 
 start_section ($structure, $section)
 Display the start of a section, before the questions.
 
 start_section_list (structure $structure)
 Generate the starting container html for the start of a list of sections.
 

Protected Attributes

xhtml_container_stack $opencontainers
 The xhtml_container_stack to use.
 
renderer_base core_renderer $output
 A reference to the current renderer.
 
moodle_page $page
 The Moodle page the renderer has been created to assist with.
 
string $target
 The requested rendering target.
 
array $templatecache = []
 $templatecache The mustache template cache.
 
string $togglegroup = 'quiz-questions'
 The toggle group name of the checkboxes for the toggle-all functionality.
 

Detailed Description

Renderer outputting the quiz editing UI.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Since
Moodle 2.7

Member Function Documentation

◆ add_menu_actions()

mod_quiz\output\edit_renderer::add_menu_actions ( structure $structure,
$page,
moodle_url $pageurl,
core_question\local\bank\question_edit_contexts $contexts,
array $pagevars )

Returns the add menu that is output once per page.

Parameters
structure$structureobject containing the structure of the quiz.
int$pagethe page number that this menu will add to.
moodle_url$pageurlthe canonical URL of this page.
core_question\local\bank\question_edit_contexts$contextsthe relevant question bank contexts.
array$pagevarsthe variables from question_edit_setup().
Return values
stringHTML to output.

◆ add_page_icon_template()

mod_quiz\output\edit_renderer::add_page_icon_template ( structure $structure)
protected

HTML for a page, with ids stripped, so it can be used as a javascript template.

Parameters
structure$structureobject containing the structure of the quiz.
Return values
stringHTML for a new icon

◆ add_question_form()

mod_quiz\output\edit_renderer::add_question_form ( structure $structure,
$page,
moodle_url $pageurl,
array $pagevars )
protected

Render the form that contains the data for adding a new question to the quiz.

Parameters
structure$structureobject containing the structure of the quiz.
int$pagethe page number that this menu will add to.
moodle_url$pageurlthe canonical URL of this page.
array$pagevarsthe variables from question_edit_setup().
Return values
stringHTML to output.

◆ edit_menu_actions()

mod_quiz\output\edit_renderer::edit_menu_actions ( structure $structure,
$page,
moodle_url $pageurl,
array $pagevars )

Returns the list of actions to go in the add menu.

Parameters
structure$structureobject containing the structure of the quiz.
int$pagethe page number that this menu will add to.
moodle_url$pageurlthe canonical URL of this page.
array$pagevarsthe variables from question_edit_setup().
Return values
arraythe actions.

◆ edit_page()

mod_quiz\output\edit_renderer::edit_page ( \mod_quiz\quiz_settings $quizobj,
structure $structure,
core_question\local\bank\question_edit_contexts $contexts,
moodle_url $pageurl,
array $pagevars )

Render the edit page.

Parameters
mod_quiz\quiz_settings$quizobjobject containing all the quiz settings information.
structure$structureobject containing the structure of the quiz.
core_question\local\bank\question_edit_contexts$contextsthe relevant question bank contexts.
moodle_url$pageurlthe canonical URL of this page.
array$pagevarsthe variables from question_edit_setup().
Return values
stringHTML to output.

◆ end_section()

mod_quiz\output\edit_renderer::end_section ( )
protected

Display the end of a section, after the questions.

Return values
stringHTML to output.

◆ end_section_list()

mod_quiz\output\edit_renderer::end_section_list ( )
protected

Generate the closing container html for the end of a list of sections.

Return values
stringHTML to output.

◆ get_action_icon()

mod_quiz\output\edit_renderer::get_action_icon ( structure $structure,
int $slot,
moodle_url $pageurl )

Get the action icons render.

Parameters
structure$structureobject containing the structure of the quiz.
int$slotthe slot on the page we are outputting.
moodle_url$pageurlthe canonical URL of this page.
Return values
stringHTML to output.

◆ get_checkbox_render()

mod_quiz\output\edit_renderer::get_checkbox_render ( structure $structure,
int $slot )

Get the checkbox render.

Parameters
structure$structureobject containing the structure of the quiz.
int$slotthe slot on the page we are outputting.
Return values
stringHTML to output.

◆ get_question_name_for_slot()

mod_quiz\output\edit_renderer::get_question_name_for_slot ( structure $structure,
int $slot,
moodle_url $pageurl )

Get the question name for the slot.

Parameters
structure$structureobject containing the structure of the quiz.
int$slotthe slot on the page we are outputting.
moodle_url$pageurlthe canonical URL of this page.
Return values
stringHTML to output.

◆ initialise_editing_javascript()

mod_quiz\output\edit_renderer::initialise_editing_javascript ( structure $structure,
core_question\local\bank\question_edit_contexts $contexts,
array $pagevars,
moodle_url $pageurl )
protected

Initialise the JavaScript for the general editing.

(JavaScript for popups is handled with the specific code for those.)

Parameters
structure$structureobject containing the structure of the quiz.
core_question\local\bank\question_edit_contexts$contextsthe relevant question bank contexts.
array$pagevarsthe variables from question_edit_setup().
moodle_url$pageurlthe canonical URL of this page.
Return values
boolAlways returns true

◆ marked_out_of_field()

mod_quiz\output\edit_renderer::marked_out_of_field ( structure $structure,
$slot )

Display the 'marked out of' information for a question.

Along with the regrade action.

Parameters
structure$structureobject containing the structure of the quiz.
int$slotwhich slot we are outputting.
Return values
stringHTML to output.

◆ maximum_grade_input()

mod_quiz\output\edit_renderer::maximum_grade_input ( $structure,
moodle_url $pageurl )

Render the form for setting a quiz' overall grade.

Parameters
structure$structurethe quiz structure.
moodle_url$pageurlthe canonical URL of this page.
Return values
stringHTML to output.

◆ new_page_template()

mod_quiz\output\edit_renderer::new_page_template ( structure $structure,
core_question\local\bank\question_edit_contexts $contexts,
array $pagevars,
moodle_url $pageurl )
protected

HTML for a page, with ids stripped, so it can be used as a javascript template.

Parameters
structure$structureobject containing the structure of the quiz.
core_question\local\bank\question_edit_contexts$contextsthe relevant question bank contexts.
array$pagevarsthe variables from question_edit_setup().
moodle_url$pageurlthe canonical URL of this page.
Return values
stringHTML for a new page.

◆ page_row()

mod_quiz\output\edit_renderer::page_row ( structure $structure,
$slot,
$contexts,
$pagevars,
$pageurl )

Displays one question with the surrounding controls.

Parameters
structure$structureobject containing the structure of the quiz.
int$slotthe first slot on the page we are outputting.
core_question\local\bank\question_edit_contexts$contextsthe relevant question bank contexts.
array$pagevarsthe variables from question_edit_setup().
moodle_url$pageurlthe canonical URL of this page.
Return values
stringHTML to output.

◆ page_split_join_button()

mod_quiz\output\edit_renderer::page_split_join_button ( $structure,
$slot )

Display an icon to split or join two pages of the quiz.

Parameters
structure$structureobject containing the structure of the quiz.
int$slotthe first slot on the page we are outputting.
Return values
stringHTML to output.

◆ question()

mod_quiz\output\edit_renderer::question ( structure $structure,
int $slot,
moodle_url $pageurl )

Display a question.

Parameters
structure$structureobject containing the structure of the quiz.
int$slotthe first slot on the page we are outputting.
moodle_url$pageurlthe canonical URL of this page.
Return values
stringHTML to output.

◆ question_bank_contents()

mod_quiz\output\edit_renderer::question_bank_contents ( \mod_quiz\question\bank\custom_view $questionbank,
array $pagevars )

Return the contents of the question bank, to be displayed in the question-bank pop-up.

Parameters
mod_quiz\question\bank\custom_view$questionbankthe question bank view object.
array$pagevarsthe variables from question_edit_setup().
Return values
stringHTML to output / send back in response to an AJAX request.

◆ question_bank_loading()

mod_quiz\output\edit_renderer::question_bank_loading ( )

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

Return values
stringHTML to output.

◆ question_chooser()

mod_quiz\output\edit_renderer::question_chooser ( )

Render the question type chooser dialogue.

Return values
stringHTML to output.

◆ question_dependency_icon()

mod_quiz\output\edit_renderer::question_dependency_icon ( $structure,
$slot )

Display the icon for whether this question can only be seen if the previous one has been answered.

Parameters
structure$structureobject containing the structure of the quiz.
int$slotthe first slot on the page we are outputting.
Return values
stringHTML to output.

◆ question_move_icon()

mod_quiz\output\edit_renderer::question_move_icon ( structure $structure,
$slot )

Render the move icon.

Parameters
structure$structureobject containing the structure of the quiz.
int$slotthe first slot on the page we are outputting.
Return values
stringThe markup for the move action.

◆ question_name()

mod_quiz\output\edit_renderer::question_name ( structure $structure,
$slot,
$pageurl )

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

Parameters
structure$structureobject containing the structure of the quiz.
int$slotwhich slot we are outputting.
moodle_url$pageurlthe canonical URL of this page.
Return values
stringHTML to output.

◆ question_number()

mod_quiz\output\edit_renderer::question_number ( string $editablenumber,
string $uncustomisednumber )

Output the question number.

Parameters
string$editablenumberThe, which may be an in-place editable.
string$uncustomisednumberThe un-customised number number, or 'i'.
Return values
stringHTML to output.

◆ question_preview_icon()

mod_quiz\output\edit_renderer::question_preview_icon ( $quiz,
$questiondata,
$label = null,
$variant = null,
$restartversion = null )

Render the preview icon.

Parameters
stdClass$quizthe quiz settings from the database.
stdClass$questiondatawhich question to preview. If ->questionid is set, that is used instead of ->id.
bool$labelif true, show the preview question label after the icon
int$variantwhich question variant to preview (optional).
int$restartversionversion to use when restarting the preview
Return values
stringHTML to output.

◆ question_remove_icon()

mod_quiz\output\edit_renderer::question_remove_icon ( structure $structure,
$slot,
$pageurl )

Render an icon to remove a question from the quiz.

Parameters
structure$structureobject containing the structure of the quiz.
int$slotthe first slot on the page we are outputting.
moodle_url$pageurlthe canonical URL of the edit page.
Return values
stringHTML to output.

◆ question_row()

mod_quiz\output\edit_renderer::question_row ( structure $structure,
$slot,
$contexts,
$pagevars,
$pageurl )

Displays one question with the surrounding controls.

Parameters
structure$structureobject containing the structure of the quiz.
int$slotwhich slot we are outputting.
core_question\local\bank\question_edit_contexts$contextsthe relevant question bank contexts.
array$pagevarsthe variables from question_edit_setup().
moodle_url$pageurlthe canonical URL of this page.
Return values
stringHTML to output.

◆ questions_in_section()

mod_quiz\output\edit_renderer::questions_in_section ( structure $structure,
$section,
$contexts,
$pagevars,
$pageurl )

Renders HTML to display the questions in a section of the quiz.

This function calls core_course_renderer::quiz_section_question()

Parameters
structure$structureobject containing the structure of the quiz.
stdClass$sectioninformation about the section.
core_question\local\bank\question_edit_contexts$contextsthe relevant question bank contexts.
array$pagevarsthe variables from question_edit_setup().
moodle_url$pageurlthe canonical URL of this page.
Return values
stringHTML to output.

◆ quiz_information()

mod_quiz\output\edit_renderer::quiz_information ( structure $structure)

Render the status bar.

Parameters
structure$structurethe quiz structure.
Return values
stringHTML to output.

◆ quiz_state_warnings()

mod_quiz\output\edit_renderer::quiz_state_warnings ( structure $structure)

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.

Parameters
structure$structurethe quiz structure.
Return values
stringHTML to output.

◆ random_question()

mod_quiz\output\edit_renderer::random_question ( structure $structure,
$slotnumber,
$pageurl )

Renders html to display a random question the link to edit the configuration and also to see that category in the question bank.

Parameters
structure$structureobject containing the structure of the quiz.
int$slotnumberwhich slot we are outputting.
moodle_url$pageurlthe canonical URL of this page.
Return values
stringHTML to output.

◆ render_question_chooser()

mod_quiz\output\edit_renderer::render_question_chooser ( renderable $chooser)

Renders the question chooser.

Parameters
renderable
Return values
string

◆ repaginate_button()

mod_quiz\output\edit_renderer::repaginate_button ( structure $structure,
moodle_url $pageurl )
protected

Return the repaginate button.

Parameters
structure$structurethe structure of the quiz being edited.
moodle_url$pageurlthe canonical URL of this page.
Return values
stringHTML to output.

◆ repaginate_form()

mod_quiz\output\edit_renderer::repaginate_form ( structure $structure,
moodle_url $pageurl )
protected

Return the repaginate form.

Parameters
structure$structurethe structure of the quiz being edited.
moodle_url$pageurlthe canonical URL of this page.
Return values
stringHTML to output.

◆ section_remove_icon()

mod_quiz\output\edit_renderer::section_remove_icon ( $section)

Render an icon to remove a section from the quiz.

Parameters
stdClass$sectionthe section to be removed.
Return values
stringHTML to output.

◆ section_shuffle_questions()

mod_quiz\output\edit_renderer::section_shuffle_questions ( structure $structure,
$section )

Display a checkbox for shuffling question within a section.

Parameters
structure$structureobject containing the structure of the quiz.
stdClass$sectiondata from the quiz_section table.
Return values
stringHTML to output.

◆ selectmultiple_button()

mod_quiz\output\edit_renderer::selectmultiple_button ( structure $structure)
protected

Generate the bulk action button.

Parameters
structure$structurethe structure of the quiz being edited.
Return values
stringHTML to output.

◆ selectmultiple_controls()

mod_quiz\output\edit_renderer::selectmultiple_controls ( structure $structure)
protected

Generate the controls that appear when the bulk action button is pressed.

Parameters
structure$structurethe structure of the quiz being edited.
Return values
stringHTML to output.

◆ start_section()

mod_quiz\output\edit_renderer::start_section ( $structure,
$section )
protected

Display the start of a section, before the questions.

Parameters
structure$structurethe structure of the quiz being edited.
stdClass$sectionThe quiz_section entry from DB
Return values
stringHTML to output.

◆ start_section_list()

mod_quiz\output\edit_renderer::start_section_list ( structure $structure)
protected

Generate the starting container html for the start of a list of sections.

Parameters
structure$structurethe structure of the quiz being edited.
Return values
stringHTML to output.

◆ total_marks()

mod_quiz\output\edit_renderer::total_marks ( $quiz)

Render the total marks available for the quiz.

Parameters
stdClass$quizthe quiz settings from the database.
Return values
stringHTML to output.

The documentation for this class was generated from the following file: