Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
Compontent definition of a gradeitem. More...
Public Member Functions | |
check_grade_validity (?float $grade) | |
Check whether the supplied grade is valid and throw an exception if not. | |
create_empty_grade (stdClass $gradeduser, stdClass $grader) | |
Create an empty row in the grade for the specified user and grader. | |
get_advanced_grading_instance (stdClass $grader, stdClass $grade, int $instanceid=null) | |
Get the advanced grading instance for the specified grade entry. | |
get_advanced_grading_method () | |
Get the name of the advanced grading method. | |
get_all_grades () | |
Get grades for all users for the specified gradeitem. | |
get_formatted_grade_for_user (stdClass $gradeduser, stdClass $grader) | |
Returns the grade that should be displayed to the user. | |
get_grade (int $gradeid) | |
Get the grade record for the specified grade id. | |
get_grade_for_user (stdClass $gradeduser, stdClass $grader) | |
Get the grade for the specified user. | |
get_grade_instance_id () | |
Get the grade item instance id. | |
get_grade_item () | |
Get the core grade item from the current component grade item. | |
get_grade_itemid () | |
Get the itemid for the current gradeitem. | |
get_grade_menu () | |
Get the list of available grade items. | |
get_grading_component_name () | |
Get the name of the component responsible for grading this gradeitem. | |
get_grading_component_subtype () | |
Get the name of the component subtype responsible for grading this gradeitem. | |
is_grading_enabled () | |
Whether grading is enabled for this item. | |
is_using_advanced_grading () | |
Whether this grade item is configured to use advanced grading. | |
is_using_direct_grading () | |
Whether this grade item is configured to use direct grading. | |
is_using_scale () | |
Check whether a scale is being used for this grade item. | |
require_user_can_grade (stdClass $gradeduser, stdClass $grader) | |
Require that the user can grade, throwing an exception if not. | |
send_student_notification (stdClass $gradeduser, stdClass $grader) | |
Sends a notification about the item being graded for the student. | |
store_grade_from_formdata (stdClass $gradeduser, stdClass $grader, stdClass $formdata) | |
Create or update the grade. | |
user_can_grade (stdClass $gradeduser, stdClass $grader) | |
Whether the grader can grade the gradee. | |
user_has_grade (stdClass $gradeduser) | |
Get the grade status for the specified user. | |
Static Public Member Functions | |
static | instance (string $component, context $context, string $itemname) |
Fetch an instance of a specific component_gradeitem. | |
static | load_from_context (context $context) |
Load an instance of the current component_gradeitem based on context. | |
Protected Member Functions | |
__construct (string $component, context $context, string $itemname) | |
component_gradeitem constructor. | |
allow_decimals () | |
Whether decimals are allowed. | |
get_advanced_grading_controller () | |
Get the advanced grading controller if advanced grading is enabled. | |
get_gradeitem_value () | |
Get the grade value for this instance. | |
get_grading_manager () | |
Get the grading manager for this advanced grading definition. | |
get_scale () | |
Get the scale if a scale is being used. | |
get_table_name () | |
The table name used for grading. | |
store_grade (stdClass $grade) | |
Create or update the grade. | |
Compontent definition of a gradeitem.
|
finalprotected |
component_gradeitem constructor.
string | $component | |
context | $context | |
string | $itemname |
coding_exception |
|
protected |
Whether decimals are allowed.
bool |
core_grades\component_gradeitem::check_grade_validity | ( | ?float | $grade | ) |
Check whether the supplied grade is valid and throw an exception if not.
float | $grade | The value being checked |
moodle_exception |
bool |
|
abstract |
Create an empty row in the grade for the specified user and grader.
stdClass | $gradeduser | The user being graded |
stdClass | $grader | The user who is grading |
stdClass | The newly created grade record |
Reimplemented in mod_forum\grades\forum_gradeitem.
|
protected |
Get the advanced grading controller if advanced grading is enabled.
gradingform_controller |
core_grades\component_gradeitem::get_advanced_grading_instance | ( | stdClass | $grader, |
stdClass | $grade, | ||
int | $instanceid = null ) |
Get the advanced grading instance for the specified grade entry.
stdClass | $grader | The user who is grading |
stdClass | $grade | The row from the grade table. |
int | $instanceid | The instanceid of the advanced grading form |
gradingform_instance |
core_grades\component_gradeitem::get_advanced_grading_method | ( | ) |
Get the name of the advanced grading method.
string |
|
abstract |
Get grades for all users for the specified gradeitem.
stdClass[] | The grades |
Reimplemented in mod_forum\grades\forum_gradeitem.
core_grades\component_gradeitem::get_formatted_grade_for_user | ( | stdClass | $gradeduser, |
stdClass | $grader ) |
Returns the grade that should be displayed to the user.
The grade does not necessarily return a float value, this method takes grade settings into considering so the correct value be shown, eg. a float vs a letter.
stdClass | $gradeduser | |
stdClass | $grader |
stdClass|null |
core_grades\component_gradeitem::get_grade | ( | int | $gradeid | ) |
Get the grade record for the specified grade id.
int | $gradeid |
stdClass |
dml_exception |
|
abstract |
Get the grade for the specified user.
stdClass | $gradeduser | The user being graded |
stdClass | $grader | The user who is grading |
stdClass | The grade value |
Reimplemented in mod_forum\grades\forum_gradeitem.
|
abstract |
Get the grade item instance id.
This is typically the cmid in the case of an activity, and relates to the iteminstance field in the grade_items table.
int |
Reimplemented in mod_forum\grades\forum_gradeitem.
core_grades\component_gradeitem::get_grade_item | ( | ) |
Get the core grade item from the current component grade item.
This is mainly used to access the max grade for a gradeitem
grade_item | The grade item |
core_grades\component_gradeitem::get_grade_itemid | ( | ) |
Get the itemid for the current gradeitem.
int |
core_grades\component_gradeitem::get_grade_menu | ( | ) |
Get the list of available grade items.
array |
|
abstractprotected |
Get the grade value for this instance.
The itemname is translated to the relevant grade field for the activity.
int |
Reimplemented in mod_forum\grades\forum_gradeitem.
core_grades\component_gradeitem::get_grading_component_name | ( | ) |
Get the name of the component responsible for grading this gradeitem.
string |
core_grades\component_gradeitem::get_grading_component_subtype | ( | ) |
Get the name of the component subtype responsible for grading this gradeitem.
string |
|
protected |
Get the grading manager for this advanced grading definition.
grading_manager |
|
protected |
Get the scale if a scale is being used.
stdClass |
|
abstractprotected |
The table name used for grading.
string |
Reimplemented in mod_forum\grades\forum_gradeitem.
|
static |
Fetch an instance of a specific component_gradeitem.
string | $component | |
context | $context | |
string | $itemname |
self |
|
abstract |
Whether grading is enabled for this item.
bool |
Reimplemented in mod_forum\grades\forum_gradeitem.
core_grades\component_gradeitem::is_using_advanced_grading | ( | ) |
Whether this grade item is configured to use advanced grading.
bool |
core_grades\component_gradeitem::is_using_direct_grading | ( | ) |
Whether this grade item is configured to use direct grading.
bool |
core_grades\component_gradeitem::is_using_scale | ( | ) |
Check whether a scale is being used for this grade item.
bool |
|
staticabstract |
Load an instance of the current component_gradeitem based on context.
context | $context |
self |
Reimplemented in mod_forum\grades\forum_gradeitem.
|
abstract |
Require that the user can grade, throwing an exception if not.
stdClass | $gradeduser | The user being graded |
stdClass | $grader | The user who is grading |
required_capability_exception |
Reimplemented in mod_forum\grades\forum_gradeitem.
core_grades\component_gradeitem::send_student_notification | ( | stdClass | $gradeduser, |
stdClass | $grader ) |
Sends a notification about the item being graded for the student.
stdClass | $gradeduser | The user being graded |
stdClass | $grader | The user who is grading |
|
abstractprotected |
Create or update the grade.
stdClass | $grade |
bool | Success |
Reimplemented in mod_forum\grades\forum_gradeitem.
core_grades\component_gradeitem::store_grade_from_formdata | ( | stdClass | $gradeduser, |
stdClass | $grader, | ||
stdClass | $formdata ) |
Create or update the grade.
stdClass | $gradeduser | The user being graded |
stdClass | $grader | The user who is grading |
stdClass | $formdata | The data submitted |
bool | Success |
|
abstract |
Whether the grader can grade the gradee.
stdClass | $gradeduser | The user being graded |
stdClass | $grader | The user who is grading |
bool |
Reimplemented in mod_forum\grades\forum_gradeitem.
|
abstract |
Get the grade status for the specified user.
If the user has a grade as defined by the implementor return true else return false.
stdClass | $gradeduser | The user being graded |
bool | The grade status |
Reimplemented in mod_forum\grades\forum_gradeitem.