Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
Renderer outputting the quiz editing UI. More...
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. | |
Renderer outputting the quiz editing UI.
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.
structure | $structure | object containing the structure of the quiz. |
int | $page | the page number that this menu will add to. |
moodle_url | $pageurl | the canonical URL of this page. |
core_question\local\bank\question_edit_contexts | $contexts | the relevant question bank contexts. |
array | $pagevars | the variables from question_edit_setup(). |
string | HTML to output. |
|
protected |
HTML for a page, with ids stripped, so it can be used as a javascript template.
structure | $structure | object containing the structure of the quiz. |
string | HTML for a new icon |
|
protected |
Render the form that contains the data for adding a new question to the quiz.
structure | $structure | object containing the structure of the quiz. |
int | $page | the page number that this menu will add to. |
moodle_url | $pageurl | the canonical URL of this page. |
array | $pagevars | the variables from question_edit_setup(). |
string | HTML to output. |
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.
structure | $structure | object containing the structure of the quiz. |
int | $page | the page number that this menu will add to. |
moodle_url | $pageurl | the canonical URL of this page. |
array | $pagevars | the variables from question_edit_setup(). |
array | the actions. |
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.
mod_quiz\quiz_settings | $quizobj | object containing all the quiz settings information. |
structure | $structure | object containing the structure of the quiz. |
core_question\local\bank\question_edit_contexts | $contexts | the relevant question bank contexts. |
moodle_url | $pageurl | the canonical URL of this page. |
array | $pagevars | the variables from question_edit_setup(). |
string | HTML to output. |
|
protected |
Display the end of a section, after the questions.
string | HTML to output. |
|
protected |
Generate the closing container html for the end of a list of sections.
string | HTML to output. |
mod_quiz\output\edit_renderer::get_action_icon | ( | structure | $structure, |
int | $slot, | ||
moodle_url | $pageurl ) |
Get the action icons render.
structure | $structure | object containing the structure of the quiz. |
int | $slot | the slot on the page we are outputting. |
moodle_url | $pageurl | the canonical URL of this page. |
string | HTML to output. |
mod_quiz\output\edit_renderer::get_checkbox_render | ( | structure | $structure, |
int | $slot ) |
Get the checkbox render.
structure | $structure | object containing the structure of the quiz. |
int | $slot | the slot on the page we are outputting. |
string | HTML to output. |
mod_quiz\output\edit_renderer::get_question_name_for_slot | ( | structure | $structure, |
int | $slot, | ||
moodle_url | $pageurl ) |
Get the question name for the slot.
structure | $structure | object containing the structure of the quiz. |
int | $slot | the slot on the page we are outputting. |
moodle_url | $pageurl | the canonical URL of this page. |
string | HTML to output. |
|
protected |
Initialise the JavaScript for the general editing.
(JavaScript for popups is handled with the specific code for those.)
structure | $structure | object containing the structure of the quiz. |
core_question\local\bank\question_edit_contexts | $contexts | the relevant question bank contexts. |
array | $pagevars | the variables from question_edit_setup(). |
moodle_url | $pageurl | the canonical URL of this page. |
bool | Always returns true |
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.
structure | $structure | object containing the structure of the quiz. |
int | $slot | which slot we are outputting. |
string | HTML to output. |
mod_quiz\output\edit_renderer::maximum_grade_input | ( | $structure, | |
moodle_url | $pageurl ) |
Render the form for setting a quiz' overall grade.
structure | $structure | the quiz structure. |
moodle_url | $pageurl | the canonical URL of this page. |
string | HTML to output. |
|
protected |
HTML for a page, with ids stripped, so it can be used as a javascript template.
structure | $structure | object containing the structure of the quiz. |
core_question\local\bank\question_edit_contexts | $contexts | the relevant question bank contexts. |
array | $pagevars | the variables from question_edit_setup(). |
moodle_url | $pageurl | the canonical URL of this page. |
string | HTML for a new page. |
mod_quiz\output\edit_renderer::page_row | ( | structure | $structure, |
$slot, | |||
$contexts, | |||
$pagevars, | |||
$pageurl ) |
Displays one question with the surrounding controls.
structure | $structure | object containing the structure of the quiz. |
int | $slot | the first slot on the page we are outputting. |
core_question\local\bank\question_edit_contexts | $contexts | the relevant question bank contexts. |
array | $pagevars | the variables from question_edit_setup(). |
moodle_url | $pageurl | the canonical URL of this page. |
string | HTML to output. |
mod_quiz\output\edit_renderer::page_split_join_button | ( | $structure, | |
$slot ) |
Display an icon to split or join two pages of the quiz.
structure | $structure | object containing the structure of the quiz. |
int | $slot | the first slot on the page we are outputting. |
string | HTML to output. |
mod_quiz\output\edit_renderer::question | ( | structure | $structure, |
int | $slot, | ||
moodle_url | $pageurl ) |
Display a question.
structure | $structure | object containing the structure of the quiz. |
int | $slot | the first slot on the page we are outputting. |
moodle_url | $pageurl | the canonical URL of this page. |
string | HTML to output. |
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.
mod_quiz\question\bank\custom_view | $questionbank | the question bank view object. |
array | $pagevars | the variables from question_edit_setup(). |
string | HTML to output / send back in response to an AJAX request. |
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.
string | HTML to output. |
mod_quiz\output\edit_renderer::question_chooser | ( | ) |
Render the question type chooser dialogue.
string | HTML to output. |
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.
structure | $structure | object containing the structure of the quiz. |
int | $slot | the first slot on the page we are outputting. |
string | HTML to output. |
mod_quiz\output\edit_renderer::question_move_icon | ( | structure | $structure, |
$slot ) |
Render the move icon.
structure | $structure | object containing the structure of the quiz. |
int | $slot | the first slot on the page we are outputting. |
string | The markup for the move action. |
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
structure | $structure | object containing the structure of the quiz. |
int | $slot | which slot we are outputting. |
moodle_url | $pageurl | the canonical URL of this page. |
string | HTML to output. |
mod_quiz\output\edit_renderer::question_number | ( | string | $editablenumber, |
string | $uncustomisednumber ) |
Output the question number.
string | $editablenumber | The, which may be an in-place editable. |
string | $uncustomisednumber | The un-customised number number, or 'i'. |
string | HTML to output. |
mod_quiz\output\edit_renderer::question_preview_icon | ( | $quiz, | |
$questiondata, | |||
$label = null, | |||
$variant = null, | |||
$restartversion = null ) |
Render the preview icon.
stdClass | $quiz | the quiz settings from the database. |
stdClass | $questiondata | which question to preview. If ->questionid is set, that is used instead of ->id. |
bool | $label | if true, show the preview question label after the icon |
int | $variant | which question variant to preview (optional). |
int | $restartversion | version to use when restarting the preview |
string | HTML to output. |
mod_quiz\output\edit_renderer::question_remove_icon | ( | structure | $structure, |
$slot, | |||
$pageurl ) |
Render an icon to remove a question from the quiz.
structure | $structure | object containing the structure of the quiz. |
int | $slot | the first slot on the page we are outputting. |
moodle_url | $pageurl | the canonical URL of the edit page. |
string | HTML to output. |
mod_quiz\output\edit_renderer::question_row | ( | structure | $structure, |
$slot, | |||
$contexts, | |||
$pagevars, | |||
$pageurl ) |
Displays one question with the surrounding controls.
structure | $structure | object containing the structure of the quiz. |
int | $slot | which slot we are outputting. |
core_question\local\bank\question_edit_contexts | $contexts | the relevant question bank contexts. |
array | $pagevars | the variables from question_edit_setup(). |
moodle_url | $pageurl | the canonical URL of this page. |
string | HTML to output. |
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()
structure | $structure | object containing the structure of the quiz. |
stdClass | $section | information about the section. |
core_question\local\bank\question_edit_contexts | $contexts | the relevant question bank contexts. |
array | $pagevars | the variables from question_edit_setup(). |
moodle_url | $pageurl | the canonical URL of this page. |
string | HTML to output. |
mod_quiz\output\edit_renderer::quiz_information | ( | structure | $structure | ) |
Render the status bar.
structure | $structure | the quiz structure. |
string | HTML to output. |
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.
structure | $structure | the quiz structure. |
string | HTML to output. |
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.
structure | $structure | object containing the structure of the quiz. |
int | $slotnumber | which slot we are outputting. |
moodle_url | $pageurl | the canonical URL of this page. |
string | HTML to output. |
mod_quiz\output\edit_renderer::render_question_chooser | ( | renderable | $chooser | ) |
Renders the question chooser.
renderable |
string |
|
protected |
Return the repaginate button.
structure | $structure | the structure of the quiz being edited. |
moodle_url | $pageurl | the canonical URL of this page. |
string | HTML to output. |
|
protected |
Return the repaginate form.
structure | $structure | the structure of the quiz being edited. |
moodle_url | $pageurl | the canonical URL of this page. |
string | HTML to output. |
mod_quiz\output\edit_renderer::section_remove_icon | ( | $section | ) |
Render an icon to remove a section from the quiz.
stdClass | $section | the section to be removed. |
string | HTML to output. |
mod_quiz\output\edit_renderer::section_shuffle_questions | ( | structure | $structure, |
$section ) |
Display a checkbox for shuffling question within a section.
structure | $structure | object containing the structure of the quiz. |
stdClass | $section | data from the quiz_section table. |
string | HTML to output. |
|
protected |
Generate the bulk action button.
structure | $structure | the structure of the quiz being edited. |
string | HTML to output. |
|
protected |
Generate the controls that appear when the bulk action button is pressed.
structure | $structure | the structure of the quiz being edited. |
string | HTML to output. |
|
protected |
Display the start of a section, before the questions.
structure | $structure | the structure of the quiz being edited. |
stdClass | $section | The quiz_section entry from DB |
string | HTML to output. |
|
protected |
Generate the starting container html for the start of a list of sections.
structure | $structure | the structure of the quiz being edited. |
string | HTML to output. |
mod_quiz\output\edit_renderer::total_marks | ( | $quiz | ) |
Render the total marks available for the quiz.
stdClass | $quiz | the quiz settings from the database. |
string | HTML to output. |