◆ __construct()
core_grades\penalty_container::__construct |
( |
private grade_item readonly grade_item | $gradeitem, |
|
|
private grade_grade readonly grade_grade | $gradegrade, |
|
|
private int readonly int | $submissiondate, |
|
|
private int readonly int | $duedate ) |
Constructor for the class.
- Parameters
-
grade_item | $gradeitem | The grade item object |
grade_grade | $gradegrade | The grade object |
int | $submissiondate | The date and time the submission was made |
int | $duedate | The date and time the activity is due |
- Parameters
-
$gradeitem | $gradeitem The grade item object |
$gradegrade | $gradegrade The grade object |
$submissiondate | $submissiondate The date and time the submission was made |
$duedate | $duedate The date and time the activity is due |
◆ aggregate_penalty()
core_grades\penalty_container::aggregate_penalty |
( |
float | $penalty | ) |
|
Aggregate the number of points to deduct from the grade.
Each penalty plugin is expected to call this method from their calculate_penalty() method.
For example, if a grade item has a maximum grade of 200 and a penalty plugin wants to deduct 10% from the maximum grade, the penalty plugin should call this method with a penalty value of 20.
Percentages must not be passed to this method. Any percentage values must be converted to points before calling this method. Penalty values cannot be negative or an exception will be thrown. After all penalty plugins have been called, the core penalty system will apply the aggregated penalty to the grade, clamping the grade between the minimum and maximum grade for the grade item.
- Parameters
-
float | $penalty | The number of points to deduct from the grade |
- Exceptions
-
moodle_exception | Thrown if the penalty value is negative |
◆ get_due_date()
core_grades\penalty_container::get_due_date |
( |
| ) |
|
Get the due date.
- Return values
-
int | The date and time the activity is due |
◆ get_grade_after_penalties()
core_grades\penalty_container::get_grade_after_penalties |
( |
| ) |
|
Get the penalised grade.
The penalised grade is clamped between the minimum and maximum grade for the grade item.
- Return values
-
◆ get_grade_before_penalties()
core_grades\penalty_container::get_grade_before_penalties |
( |
| ) |
|
Get the grade before penalties are applied.
- Return values
-
float | The grade before penalties are applied |
◆ get_grade_grade()
core_grades\penalty_container::get_grade_grade |
( |
| ) |
|
Get the grade object.
This object should not be modified.
- Return values
-
◆ get_grade_item()
core_grades\penalty_container::get_grade_item |
( |
| ) |
|
Get the grade item object.
This object should not be modified.
- Return values
-
◆ get_max_grade()
core_grades\penalty_container::get_max_grade |
( |
| ) |
|
Get the maximum grade for the grade item.
- Return values
-
float | The maximum grade for the grade item |
◆ get_min_grade()
core_grades\penalty_container::get_min_grade |
( |
| ) |
|
Get the minimum grade for the grade item.
- Return values
-
float | The minimum grade for the grade item |
◆ get_penalty()
core_grades\penalty_container::get_penalty |
( |
| ) |
|
Get the current penalty value.
- Return values
-
float | The number of points to deduct from the grade |
◆ get_submission_date()
core_grades\penalty_container::get_submission_date |
( |
| ) |
|
Get the submission date.
- Return values
-
int | The date and time the submission was made |
◆ get_userid()
core_grades\penalty_container::get_userid |
( |
| ) |
|
Get the user id.
- Return values
-
The documentation for this class was generated from the following file:
- grade/classes/penalty_container.php