Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
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. More... | |
add_action_handler (component_action $action, $id=null) | |
Adds a JS action for the element with the provided id. More... | |
add_menu_actions (structure $structure, $page, moodle_url $pageurl, question_edit_contexts $contexts, array $pagevars) | |
Returns the add menu that is output once per page. More... | |
edit_menu_actions (structure $structure, $page, moodle_url $pageurl, array $pagevars) | |
Returns the list of actions to go in the add menu. More... | |
edit_page (\quiz $quizobj, structure $structure, question_edit_contexts $contexts, moodle_url $pageurl, array $pagevars) | |
Render the edit page. More... | |
get_compact_logo_url ($maxwidth=300, $maxheight=300) | |
Return the site's compact logo URL, if any. More... | |
get_logo_url ($maxwidth=null, $maxheight=200) | |
Return the site's logo URL, if any. More... | |
has_started () | |
Returns true is output has already started, and false if not. More... | |
image_url ($imagename, $component='moodle') | |
Return the moodle_url for an image. More... | |
marked_out_of_field (structure $structure, $slot) | |
Display the 'marked out of' information for a question. More... | |
maximum_grade_input ($structure, moodle_url $pageurl) | |
Render the form for setting a quiz' overall grade. More... | |
page_row (structure $structure, $slot, $contexts, $pagevars, $pageurl) | |
Displays one question with the surrounding controls. More... | |
page_split_join_button ($structure, $slot) | |
Display an icon to split or join two pages of the quiz. More... | |
pix_url ($imagename, $component='moodle') | |
Return the direct URL for an image from the pix folder. More... | |
question (structure $structure, $slot, moodle_url $pageurl) | |
Display a question. More... | |
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. More... | |
question_bank_loading () | |
Render the contents of the question bank pop-up in its initial state, when it just contains a loading progress indicator. More... | |
question_chooser () | |
Render the question type chooser dialogue. More... | |
question_dependency_icon ($structure, $slot) | |
Display the icon for whether this question can only be seen if the previous one has been answered. More... | |
question_move_icon (structure $structure, $slot) | |
Render the move icon. More... | |
question_name (structure $structure, $slot, $pageurl) | |
Renders html to display a name with the link to the question on a quiz edit page. More... | |
question_number ($number) | |
Output the question number. More... | |
question_preview_icon ($quiz, $question, $label=null, $variant=null) | |
Render the preview icon. More... | |
question_remove_icon (structure $structure, $slot, $pageurl) | |
Render an icon to remove a question from the quiz. More... | |
question_row (structure $structure, $slot, $contexts, $pagevars, $pageurl) | |
Displays one question with the surrounding controls. More... | |
questions_in_section (structure $structure, $section, $contexts, $pagevars, $pageurl) | |
Renders HTML to display the questions in a section of the quiz. More... | |
quiz_information (structure $structure) | |
Render the status bar. More... | |
quiz_state_warnings (structure $structure) | |
Render any warnings that might be required about the state of the quiz, e.g. More... | |
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. More... | |
render (renderable $widget) | |
Renders the provided widget and returns the HTML to display it. More... | |
render_from_template ($templatename, $context) | |
Renders a template by name with the given context. More... | |
render_question_chooser (renderable $chooser) | |
Renders the question chooser. More... | |
section_remove_icon ($section) | |
Render an icon to remove a section from the quiz. More... | |
section_shuffle_questions (structure $structure, $section) | |
Display a checkbox for shuffling question within a section. More... | |
should_display_main_logo ($headinglevel=1) | |
Whether we should display the main logo. More... | |
should_display_navbar_logo () | |
Whether we should display the logo in the navbar. More... | |
total_marks ($quiz) | |
Render the total marks available for the quiz. More... | |
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. More... | |
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. More... | |
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. More... | |
end_section () | |
Display the end of a section, after the questions. More... | |
end_section_list () | |
Generate the closing container html for the end of a list of sections. More... | |
get_mustache () | |
Return an instance of the mustache class. More... | |
initialise_editing_javascript (structure $structure, question_edit_contexts $contexts, array $pagevars, moodle_url $pageurl) | |
Initialise the JavaScript for the general editing. More... | |
new_page_template (structure $structure, 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. More... | |
repaginate_button (structure $structure, moodle_url $pageurl) | |
Return the repaginate button. More... | |
repaginate_form (structure $structure, moodle_url $pageurl) | |
Return the repaginate form. More... | |
selectmultiple_button (structure $structure) | |
Generate the bulk action button. More... | |
selectmultiple_controls (structure $structure) | |
Generate the controls that appear when the bulk action button is pressed. More... | |
start_section ($structure, $section) | |
Display the start of a section, before the questions. More... | |
start_section_list (structure $structure) | |
Generate the starting container html for the start of a list of sections. More... | |
Protected Attributes | |
xhtml_container_stack | $opencontainers |
The xhtml_container_stack to use. | |
renderer_base core_renderer | $output |
A reference to the current renderer. More... | |
moodle_page | $page |
The Moodle page the renderer has been created to assist with. | |
string | $target |
The requested rendering target. | |
string | $togglegroup = 'quiz-questions' |
The toggle group name of the checkboxes for the toggle-all functionality. | |
Renderer outputting the quiz editing UI.
|
inherited |
Magic method used to pass calls otherwise meant for the standard renderer to it to ensure we don't go causing unnecessary grief.
string | $method | |
array | $arguments |
mixed |
|
inherited |
Adds a JS action for the element with the provided id.
This method adds a JS event for the provided component action to the page and then returns the id that the event has been attached to. If no id has been provided then a new ID is generated by html_writer::random_id()
component_action | $action | |
string | $id |
string | id of element, either original submitted or random new if not supplied |
mod_quiz\output\edit_renderer::add_menu_actions | ( | structure | $structure, |
$page, | |||
moodle_url | $pageurl, | ||
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. |
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 | ( | \quiz | $quizobj, |
structure | $structure, | ||
question_edit_contexts | $contexts, | ||
moodle_url | $pageurl, | ||
array | $pagevars | ||
) |
Render the edit page.
quiz | $quizobj | object containing all the quiz settings information. |
structure | $structure | object containing the structure of the quiz. |
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. |
|
inherited |
Return the site's compact logo URL, if any.
int | $maxwidth | The maximum width, or null when the maximum width does not matter. |
int | $maxheight | The maximum height, or null when the maximum height does not matter. |
moodle_url|false |
|
inherited |
Return the site's logo URL, if any.
int | $maxwidth | The maximum width, or null when the maximum width does not matter. |
int | $maxheight | The maximum height, or null when the maximum height does not matter. |
moodle_url|false |
|
protectedinherited |
Return an instance of the mustache class.
Mustache_Engine |
|
inherited |
Returns true is output has already started, and false if not.
boolean | true if the header has been printed. |
|
inherited |
Return the moodle_url for an image.
The exact image location and extension is determined automatically by searching for gif|png|jpg|jpeg, please note there can not be diferent images with the different extension. The imagename is for historical reasons a relative path name, it may be changed later for core images. It is recommended to not use subdirectories in plugin and theme pix directories.
There are three types of images: 1/ theme images - stored in theme/mytheme/pix/, use component 'theme' 2/ core images - stored in /pix/, overridden via theme/mytheme/pix_core/ 3/ plugin images - stored in mod/mymodule/pix, overridden via theme/mytheme/pix_plugins/mod/mymodule/, example: image_url('comment', 'mod_glossary')
string | $imagename | the pathname of the image |
string | $component | full plugin name (aka component) or 'theme' |
moodle_url |
|
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. |
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. |
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. |
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. |
|
inherited |
Return the direct URL for an image from the pix folder.
Use this function sparingly and never for icons. For icons use pix_icon or the pix helper in a mustache template.
string | $imagename | the name of the icon. |
string | $component | specification of one plugin like in get_string() |
moodle_url |
|
staticinherited |
Given an array or space-separated list of classes, prepares and returns the HTML class attribute value.
mixed | $classes | Space-separated string or array of classes |
string | HTML class attribute value |
mod_quiz\output\edit_renderer::question | ( | structure | $structure, |
$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 | ( | $number | ) |
Output the question number.
string | $number | The number, or 'i'. |
string | HTML to output. |
mod_quiz\output\edit_renderer::question_preview_icon | ( | $quiz, | |
$question, | |||
$label = null , |
|||
$variant = null |
|||
) |
Render the preview icon.
stdClass | $quiz | the quiz settings from the database. |
stdClass | $question | data from the question and quiz_slots tables. |
bool | $label | if true, show the preview question label after the icon |
int | $variant | which question variant to preview (optional). |
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. |
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. |
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. |
|
inherited |
Renders the provided widget and returns the HTML to display it.
renderable | $widget | instance with renderable interface |
string |
Reimplemented from renderer_base.
Reimplemented in tool_policy\output\renderer.
|
inherited |
Renders a template by name with the given context.
The provided data needs to be array/stdClass made up of only simple types. Simple types are array,stdClass,bool,int,float,string
array | stdClass | $context | Context containing data for the template. |
string|boolean |
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.
object | $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. |
|
inherited |
Whether we should display the main logo.
int | $headinglevel | The heading level we want to check against. |
bool |
|
inherited |
Whether we should display the logo in the navbar.
We will when there are no main logos, and we have compact logo.
bool |
|
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. |
|
protectedinherited |
A reference to the current renderer.
The renderer provided here will be determined by the page but will in 90% of cases by the core_renderer