Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Static Public Member Functions | Static Protected Member Functions | List of all members
core_grades\component_gradeitems Class Reference

Helper class to fetch information about component grade items. More...

Static Public Member Functions

static defines_advancedgrading_itemnames_for_component (string $component)
 Check whether the component class defines the advanced grading items. More...
 
static get_advancedgrading_itemnames_for_component (string $component)
 Get the list of advanced grading item names for the named component. More...
 
static get_field_name_for_itemname (string $component, string $itemname, string $fieldname)
 Get the suffixed field name for an activity field mapped from its itemnumber. More...
 
static get_field_name_for_itemnumber (string $component, int $itemnumber, string $fieldname)
 Get the suffixed field name for an activity field mapped from its itemnumber. More...
 
static get_itemname_from_itemnumber (string $component, int $itemnumber)
 Get the itemname for an itemnumber. More...
 
static get_itemname_mapping_for_component (string $component)
 Get the grade itemnumber mapping for a component. More...
 
static get_itemnumber_from_itemname (string $component, string $itemname)
 Get the itemnumber for a item name. More...
 
static is_advancedgrading_itemname (string $component, string $itemname)
 Whether the named grading item name supports advanced grading. More...
 
static is_valid_itemname (string $component, string $itemname)
 Whether the named grading item exists. More...
 

Static Protected Member Functions

static get_component_classname (string $component)
 Get the gradeitems classname for the specific component. More...
 

Detailed Description

Helper class to fetch information about component grade items.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ defines_advancedgrading_itemnames_for_component()

static core_grades\component_gradeitems::defines_advancedgrading_itemnames_for_component ( string  $component)
static

Check whether the component class defines the advanced grading items.

Parameters
string$componentThe component to check
Return values
bool

◆ get_advancedgrading_itemnames_for_component()

static core_grades\component_gradeitems::get_advancedgrading_itemnames_for_component ( string  $component)
static

Get the list of advanced grading item names for the named component.

Parameters
string$component
Return values
array

◆ get_component_classname()

static core_grades\component_gradeitems::get_component_classname ( string  $component)
staticprotected

Get the gradeitems classname for the specific component.

Parameters
string$componentThe component to fetch the classname for
Return values
stringThe composed classname

◆ get_field_name_for_itemname()

static core_grades\component_gradeitems::get_field_name_for_itemname ( string  $component,
string  $itemname,
string  $fieldname 
)
static

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.

Parameters
string$componentThe component that the grade item belongs to
string$itemnameThe grade itemname
string$fieldnameThe name of the field to be rewritten
Return values
stringThe translated field name

◆ get_field_name_for_itemnumber()

static core_grades\component_gradeitems::get_field_name_for_itemnumber ( string  $component,
int  $itemnumber,
string  $fieldname 
)
static

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.

Parameters
string$componentThe component that the grade item belongs to
int$itemnumberThe grade itemnumber
string$fieldnameThe name of the field to be rewritten
Return values
stringThe translated field name

◆ get_itemname_from_itemnumber()

static core_grades\component_gradeitems::get_itemname_from_itemnumber ( string  $component,
int  $itemnumber 
)
static

Get the itemname for an itemnumber.

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

Parameters
string$componentThe component that the grade item belongs to
int$itemnumberThe grade itemnumber
Return values
intThe grade itemnumber of the itemname

◆ get_itemname_mapping_for_component()

static core_grades\component_gradeitems::get_itemname_mapping_for_component ( string  $component)
static

Get the grade itemnumber mapping for a component.

Parameters
string$componentThe component that the grade item belongs to
Return values
array

◆ get_itemnumber_from_itemname()

static core_grades\component_gradeitems::get_itemnumber_from_itemname ( string  $component,
string  $itemname 
)
static

Get the itemnumber for a item name.

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

Parameters
string$componentThe component that the grade item belongs to
string$itemnameThe grade itemname
Return values
intThe grade itemname of the itemnumber

◆ is_advancedgrading_itemname()

static core_grades\component_gradeitems::is_advancedgrading_itemname ( string  $component,
string  $itemname 
)
static

Whether the named grading item name supports advanced grading.

Parameters
string$component
string$itemname
Return values
bool

◆ is_valid_itemname()

static core_grades\component_gradeitems::is_valid_itemname ( string  $component,
string  $itemname 
)
static

Whether the named grading item exists.

Parameters
string$component
string$itemname
Return values
bool

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