Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
mod_quiz\output\grades\grade_out_of Class Reference
Inheritance diagram for mod_quiz\output\grades\grade_out_of:
renderable

Public Member Functions

 __construct (public stdClass readonly stdClass $quiz, public float float $grade, public float float $maxgrade, public string|null readonly ?string $name=null, public string readonly string $style=self::NORMAL,)
 Constructor.
 
 get_formatted_values ()
 Get the formatted values to be inserted into the {.
 
 get_string_key ()
 Get the lang string to use to display the grade in the requested style.
 
 style_formatted_values (stdClass $a)
 Apply the normal styling to the values returned by {.
 

Public Attributes

string const NORMAL = 'outof'
 Indicates we want the default rendering.
 
string const SHORT = 'outofshort'
 Indicates we want a short rendering.
 
string const WITH_PERCENT = 'outofpercent'
 like normal, but with the percent equivalent in brackets.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

mod_quiz\output\grades\grade_out_of::__construct ( public stdClass readonly stdClass $quiz,
public float float $grade,
public float float $maxgrade,
public string|null readonly ?string $name = null,
public string readonly string $style = self::NORMAL )

Constructor.

Parameters
stdClass$quizQuiz settings.
float$gradethe mark to show.
float$maxgradethe total to show it out of.
string | null$nameoptional, a name for what this grade is.
string$stylewhich format to use, grade_out_of\NORMAL (default), SHORT or WITH_PERCENT.
Parameters
$quizQuiz settings (so we can access the settings like decimal places).
$gradethe grade to show.
$maxgradethe total the grade is out of.
$nameoptional, a name for what this grade is. Must be output via format_string.
$styleThe display style, one of the consts above.

Member Function Documentation

◆ get_formatted_values()

mod_quiz\output\grades\grade_out_of::get_formatted_values ( )

Get the formatted values to be inserted into the {.

See also
get_string_key()} string placeholders.

Values are not styled. To apply the recommended styling, call {

See also
style_formatted_values()}
Return values
stdClassto be passed as the third argument to get_string().

◆ get_string_key()

mod_quiz\output\grades\grade_out_of::get_string_key ( )

Get the lang string to use to display the grade in the requested style.

Return values
stringlang string key from the mod_quiz lang pack.

◆ style_formatted_values()

mod_quiz\output\grades\grade_out_of::style_formatted_values ( stdClass $a)

Apply the normal styling to the values returned by {.

See also
get_formatted_values()}.
Parameters
stdClass$aformatted values, as returned by get_formatted_values.
Return values
stdClasssame structure, with some values wrapped in <b> tags.

Member Data Documentation

◆ NORMAL

string const mod_quiz\output\grades\grade_out_of::NORMAL = 'outof'

Indicates we want the default rendering.

Also the lang string used.

◆ SHORT

string const mod_quiz\output\grades\grade_out_of::SHORT = 'outofshort'

Indicates we want a short rendering.

Also the lang string used.

◆ WITH_PERCENT

string const mod_quiz\output\grades\grade_out_of::WITH_PERCENT = 'outofpercent'

like normal, but with the percent equivalent in brackets.

Also the lang string used


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