Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
mod_quiz\output\attempt_summary_information Class Reference
Inheritance diagram for mod_quiz\output\attempt_summary_information:
renderable core\output\named_templatable templatable

Public Member Functions

 add_attempt_grades_if_appropriate (quiz_attempt $attemptobj, display_options $options,)
 Add the grade information to this summary information.
 
 add_item (string $shortname, string|renderable $title, string|renderable $content)
 Add an item to the summary.
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template.
 
 filter_keeping_only (array $shortnames)
 Filter the data held, to keep only the information with the given shortnames.
 
 get_template_name (\renderer_base $renderer)
 Get the name of the template to use for this templatable.
 
 get_template_name (renderer_base $renderer)
 

Static Public Member Functions

static create_for_attempt (quiz_attempt $attemptobj, display_options $options, ?int $pageforlinkingtootherattempts=null, ?bool $showall=null,)
 Initialise an instance of this class for a particular quiz attempt.
 
static create_from_legacy_array (array $items)
 To aid conversion of old code.
 

Protected Attributes

array[] array $summarydata = []
 The rows of summary data.
 

Member Function Documentation

◆ add_attempt_grades_if_appropriate()

mod_quiz\output\attempt_summary_information::add_attempt_grades_if_appropriate ( quiz_attempt $attemptobj,
display_options $options )

Add the grade information to this summary information.

This is a helper used by {

See also
create_for_attempt()}.
Parameters
quiz_attempt$attemptobjthe attempt to summarise.
display_options$optionsoptions for what can be seen.
Return values
float|nullthe overall attempt grade, if it exists, else null. Raw value, not formatted.

◆ add_item()

mod_quiz\output\attempt_summary_information::add_item ( string $shortname,
string|renderable $title,
string|renderable $content )

Add an item to the summary.

Parameters
string$shortnameunique identifier of this item (not displayed).
string | renderable$titlethe title of this item.
string | renderable$contentthe content of this item.

◆ create_for_attempt()

static mod_quiz\output\attempt_summary_information::create_for_attempt ( quiz_attempt $attemptobj,
display_options $options,
?int $pageforlinkingtootherattempts = null,
?bool $showall = null )
static

Initialise an instance of this class for a particular quiz attempt.

Parameters
quiz_attempt$attemptobjthe attempt to summarise.
display_options$optionsoptions for what can be seen.
int | null$pageforlinkingtootherattemptsif null, no links to other attempsts will be created. If specified, the URL of this particular page of the attempt, otherwise the URL will go to the first page. If -1, deduce $page from $slot.
bool | null$showallif true, the URL will be to review the entire attempt on one page, and $page will be ignored. If null, a sensible default will be chosen.
Return values
selfsummary information.

◆ create_from_legacy_array()

static mod_quiz\output\attempt_summary_information::create_from_legacy_array ( array $items)
static

To aid conversion of old code.

This converts the old array format into an instance of this class.

Parameters
array$itemsarray of $shortname => [$title, $content].
Return values
static

◆ export_for_template()

mod_quiz\output\attempt_summary_information::export_for_template ( renderer_base $output)

Function to export the renderer data in a format that is suitable for a mustache template.

This means:

  1. No complex types - only stdClass, array, int, string, float, bool
  2. Any additional info that is required for the template is pre-calculated (e.g. capability checks).
Parameters
renderer_base$outputUsed to do a final render of any components that need to be rendered for export.
Return values
stdClass|array

Implements templatable.

◆ filter_keeping_only()

mod_quiz\output\attempt_summary_information::filter_keeping_only ( array $shortnames)

Filter the data held, to keep only the information with the given shortnames.

Parameters
array$shortnamesitems to keep.

◆ get_template_name()

core\output\named_templatable::get_template_name ( \renderer_base $renderer)
inherited

Get the name of the template to use for this templatable.

Parameters
renderer_base$rendererThe renderer requesting the template name
Return values
string

Implemented in core\output\local\dropdown\dialog, core\output\local\dropdown\status, core\output\sticky_footer, core_courseformat\output\local\content\cm\title, mod_quiz\output\list_of_attempts, and qbank_viewquestionname\output\questionname.

Member Data Documentation

◆ $summarydata

array [] array mod_quiz\output\attempt_summary_information::$summarydata = []
protected

The rows of summary data.

{

See also
add_item()} should make the structure clear.

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