Moodle PHP Documentation 5.0
Moodle 5.0.1+ (Build: 20250711) (61af040cd5f)
core_grades\penalty_manager Class Reference

Static Public Member Functions

static apply_grade_penalty_to_user (int $userid, grade_item $gradeitem, int $submissiondate, int $duedate, bool $previewonly=false)
 Apply grade penalties to a user.
 
static disable_module (string $module)
 Disable the grade penalty feature for a module.
 
static disable_modules (array $modules)
 Disable the grade penalty feature for multiple modules.
 
static enable_module (string $module)
 Enable the grade penalty feature for a module.
 
static enable_modules (array $modules)
 Enable the grade penalty feature for multiple modules.
 
static extend_navigation_course (navigation_node $navigation, stdClass $course, context $coursecontext)
 Allow penalty plugin to extend course navigation.
 
static extend_navigation_module (settings_navigation $settings, navigation_node $navref)
 Allow penalty plugin to extend navigation module.
 
static get_enabled_modules ()
 List the modules that currently have the grade penalty feature enabled.
 
static get_supported_modules ()
 List the modules that support the grade penalty feature.
 
static is_penalty_enabled_for_module (string $module)
 Check if the module has the grade penalty feature enabled.
 
static recalculate_penalty (context $context, int $usermodified=0)
 Recalculate grade penalties.
 
static show_penalty_indicator (grade_grade $grade)
 Returns the penalty indicator HTML code if a penalty is applied to the grade.
 

Member Function Documentation

◆ apply_grade_penalty_to_user()

static core_grades\penalty_manager::apply_grade_penalty_to_user ( int $userid,
grade_item $gradeitem,
int $submissiondate,
int $duedate,
bool $previewonly = false )
static

Apply grade penalties to a user.

Grade penalties are determined by the enabled penalty plugin. This function should be called each time a module creates or updates a grade item for a user.

Parameters
int$useridThe user ID
grade_item$gradeitemgrade item
int$submissiondatesubmission date
int$duedatedue date
bool$previewonlydo not update the grade if true, only return the penalty
Return values
penalty_containerInformation about the applied penalty.

◆ disable_module()

static core_grades\penalty_manager::disable_module ( string $module)
static

Disable the grade penalty feature for a module.

Parameters
string$moduleThe module name (e.g. 'assign').

◆ disable_modules()

static core_grades\penalty_manager::disable_modules ( array $modules)
static

Disable the grade penalty feature for multiple modules.

Parameters
array$modulesList of module names.

◆ enable_module()

static core_grades\penalty_manager::enable_module ( string $module)
static

Enable the grade penalty feature for a module.

Parameters
string$moduleThe module name (e.g. 'assign').

◆ enable_modules()

static core_grades\penalty_manager::enable_modules ( array $modules)
static

Enable the grade penalty feature for multiple modules.

Parameters
array$modulesList of module names.

◆ extend_navigation_course()

static core_grades\penalty_manager::extend_navigation_course ( navigation_node $navigation,
stdClass $course,
context $coursecontext )
static

Allow penalty plugin to extend course navigation.

Parameters
navigation_node$navigationThe navigation node
stdClass$courseThe course object
context$coursecontextThe course context

◆ extend_navigation_module()

static core_grades\penalty_manager::extend_navigation_module ( settings_navigation $settings,
navigation_node $navref )
static

Allow penalty plugin to extend navigation module.

Parameters
settings_navigation$settingsThe settings navigation object
navigation_node$navrefThe navigation node
Return values
void

◆ get_enabled_modules()

static core_grades\penalty_manager::get_enabled_modules ( )
static

List the modules that currently have the grade penalty feature enabled.

Return values
arrayList of enabled modules.

◆ get_supported_modules()

static core_grades\penalty_manager::get_supported_modules ( )
static

List the modules that support the grade penalty feature.

Return values
arraylist of supported modules.

◆ is_penalty_enabled_for_module()

static core_grades\penalty_manager::is_penalty_enabled_for_module ( string $module)
static

Check if the module has the grade penalty feature enabled.

Parameters
string$moduleThe module name (e.g. 'assign').
Return values
boolWhether grade penalties are enabled for the module.

◆ recalculate_penalty()

static core_grades\penalty_manager::recalculate_penalty ( context $context,
int $usermodified = 0 )
static

Recalculate grade penalties.

Parameters
context$contextThe context
int$usermodifiedThe user who triggered the recalculation return void

◆ show_penalty_indicator()

static core_grades\penalty_manager::show_penalty_indicator ( grade_grade $grade)
static

Returns the penalty indicator HTML code if a penalty is applied to the grade.

Otherwise, returns an empty string.

Parameters
grade_grade$gradeGrade object
Return values
stringHTML code for penalty indicator

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