Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

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.

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

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

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

Class: does  - X-Ref

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

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

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

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

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

param: string $component
return: array

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

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

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.

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
return: string The translated field name

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.

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
return: string The translated field name

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.

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

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.

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

Class: does  - X-Ref

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

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

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

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

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

param: string $component
return: array

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

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

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.

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
return: string The translated field name

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.

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
return: string The translated field name

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.

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

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.

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