Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400]

Helper class to fetch information about component grade items.

Copyright: Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 226 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes


Class: component_gradeitems  - X-Ref

Helper class to fetch information about component grade items.

get_component_classname(string $component)   X-Ref
Get the gradeitems classname for the specific component.

return: string The composed classname
param: string $component The component to fetch the classname for

get_itemname_mapping_for_component(string $component)   X-Ref
Get the grade itemnumber mapping for a component.

return: array
param: string $component The component that the grade item belongs to

Class: does  - X-Ref

is_valid_itemname(string $component, string $itemname)   X-Ref
Whether the named grading item exists.

return: bool
param: string $component
param: string $itemname

defines_advancedgrading_itemnames_for_component(string $component)   X-Ref
Check whether the component class defines the advanced grading items.

return: bool
param: string $component The component to check

get_advancedgrading_itemnames_for_component(string $component)   X-Ref
Get the list of advanced grading item names for the named component.

return: array
param: string $component

is_advancedgrading_itemname(string $component, string $itemname)   X-Ref
Whether the named grading item name supports advanced grading.

return: bool
param: string $component
param: string $itemname

get_field_name_for_itemnumber(string $component, int $itemnumber, string $fieldname)   X-Ref
Get the suffixed field name for an activity field mapped from its itemnumber.

For legacy reasons, the first itemnumber has no suffix on field names.

return: string The translated field name
param: string $component The component that the grade item belongs to
param: int $itemnumber The grade itemnumber
param: string $fieldname The name of the field to be rewritten

get_field_name_for_itemname(string $component, string $itemname, string $fieldname)   X-Ref
Get the suffixed field name for an activity field mapped from its itemnumber.

For legacy reasons, the first itemnumber has no suffix on field names.

return: string The translated field name
param: string $component The component that the grade item belongs to
param: string $itemname The grade itemname
param: string $fieldname The name of the field to be rewritten

get_itemname_from_itemnumber(string $component, int $itemnumber)   X-Ref
Get the itemname for an itemnumber.

For legacy compatability when the itemnumber is 0, the itemname will always be empty.

return: int The grade itemnumber of the itemname
param: string $component The component that the grade item belongs to
param: int $itemnumber The grade itemnumber

get_itemnumber_from_itemname(string $component, string $itemname)   X-Ref
Get the itemnumber for a item name.

For legacy compatability when the itemname is empty, the itemnumber will always be 0.

return: int The grade itemname of the itemnumber
param: string $component The component that the grade item belongs to
param: string $itemname The grade itemname

Class: does  - X-Ref

is_valid_itemname(string $component, string $itemname)   X-Ref
Whether the named grading item exists.

return: bool
param: string $component
param: string $itemname

defines_advancedgrading_itemnames_for_component(string $component)   X-Ref
Check whether the component class defines the advanced grading items.

return: bool
param: string $component The component to check

get_advancedgrading_itemnames_for_component(string $component)   X-Ref
Get the list of advanced grading item names for the named component.

return: array
param: string $component

is_advancedgrading_itemname(string $component, string $itemname)   X-Ref
Whether the named grading item name supports advanced grading.

return: bool
param: string $component
param: string $itemname

get_field_name_for_itemnumber(string $component, int $itemnumber, string $fieldname)   X-Ref
Get the suffixed field name for an activity field mapped from its itemnumber.

For legacy reasons, the first itemnumber has no suffix on field names.

return: string The translated field name
param: string $component The component that the grade item belongs to
param: int $itemnumber The grade itemnumber
param: string $fieldname The name of the field to be rewritten

get_field_name_for_itemname(string $component, string $itemname, string $fieldname)   X-Ref
Get the suffixed field name for an activity field mapped from its itemnumber.

For legacy reasons, the first itemnumber has no suffix on field names.

return: string The translated field name
param: string $component The component that the grade item belongs to
param: string $itemname The grade itemname
param: string $fieldname The name of the field to be rewritten

get_itemname_from_itemnumber(string $component, int $itemnumber)   X-Ref
Get the itemname for an itemnumber.

For legacy compatability when the itemnumber is 0, the itemname will always be empty.

return: int The grade itemnumber of the itemname
param: string $component The component that the grade item belongs to
param: int $itemnumber The grade itemnumber

get_itemnumber_from_itemname(string $component, string $itemname)   X-Ref
Get the itemnumber for a item name.

For legacy compatability when the itemname is empty, the itemnumber will always be 0.

return: int The grade itemname of the itemnumber
param: string $component The component that the grade item belongs to
param: string $itemname The grade itemname