Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
grading_manager Class Reference

Public Member Functions

 create_shared_area ($method)
 Creates a new shared area to hold a grading form template. More...
 
 extend_navigation (global_navigation $navigation, navigation_node $modulenode=null)
 Extends the module navigation with the advanced grading information. More...
 
 extend_settings_navigation (settings_navigation $settingsnav, navigation_node $modulenode=null)
 Extends the settings navigation with the grading settings. More...
 
 get_active_controller ()
 Returns the controller for the active method if it is available. More...
 
 get_active_method ()
 Returns the currently active grading method in the gradable area. More...
 
 get_area ()
 Returns grading manager area name. More...
 
 get_area_title ()
 Returns the localized title of the currently set area. More...
 
 get_available_areas ()
 Returns the list of gradable areas in the given context and component. More...
 
 get_available_methods ($includenone=true)
 Returns the list of available grading methods in the given context. More...
 
 get_component ()
 Returns grading manager component. More...
 
 get_component_title ()
 Returns a text describing the context and the component. More...
 
 get_context ()
 Returns grading manager context. More...
 
 get_controller ($method)
 Returns the given method's controller in the gradable area. More...
 
 get_management_url (moodle_url $returnurl=null)
 Returns the URL of the grading area management page. More...
 
 load ($areaid)
 Loads the gradable area info from the database. More...
 
 set_active_method ($method)
 Sets the currently active grading method in the gradable area. More...
 
 set_area ($area)
 Sets the area the manager operates on. More...
 
 set_component ($component)
 Sets the component the manager operates on. More...
 
 set_context (stdClass $context)
 Sets the context the manager operates on. More...
 

Static Public Member Functions

static available_areas ($component)
 Returns the list of gradable areas provided by the given component. More...
 
static available_methods ($includenone=true)
 Returns the list of installed grading plugins together, optionally extended with a simple direct grading. More...
 
static delete_all_for_context ($contextid)
 Removes all data associated with the given context. More...
 
static tokenize ($needle)
 Helper method to tokenize the given string. More...
 

Protected Attributes

string $area
 the name of the gradable area
 
string $component
 the frankenstyle name of the component
 
stdClass $context
 the context
 

Member Function Documentation

◆ available_areas()

static grading_manager::available_areas (   $component)
static

Returns the list of gradable areas provided by the given component.

This performs a callback to the library of the relevant plugin to obtain the list of supported areas.

Parameters
string$componentnormalized component name
Return values
arrayof (string)areacode => (string)localized title of the area

◆ available_methods()

static grading_manager::available_methods (   $includenone = true)
static

Returns the list of installed grading plugins together, optionally extended with a simple direct grading.

Parameters
bool$includenoneshould the 'Simple direct grading' be included
Return values
arrayof the (string)name => (string)localized title of the method

◆ create_shared_area()

grading_manager::create_shared_area (   $method)

Creates a new shared area to hold a grading form template.

Shared area are implemented as virtual gradable areas at the system level context with the component set to core_grading and unique random area name.

Parameters
string$methodthe name of the plugin we create the area for
Return values
intthe new area id

◆ delete_all_for_context()

static grading_manager::delete_all_for_context (   $contextid)
static

Removes all data associated with the given context.

This is called by context::delete_content()

Parameters
int$contextidcontext id

◆ extend_navigation()

grading_manager::extend_navigation ( global_navigation  $navigation,
navigation_node  $modulenode = null 
)

Extends the module navigation with the advanced grading information.

This function is called when the context for the page is an activity module with the FEATURE_ADVANCED_GRADING.

Parameters
global_navigation$navigation
navigation_node$modulenode

◆ extend_settings_navigation()

grading_manager::extend_settings_navigation ( settings_navigation  $settingsnav,
navigation_node  $modulenode = null 
)

Extends the settings navigation with the grading settings.

This function is called when the context for the page is an activity module with the FEATURE_ADVANCED_GRADING and the user has the permission moodle/grade:managegradingforms.

Parameters
settings_navigation$settingsnav} * navigation_node $modulenode navigation_node

◆ get_active_controller()

grading_manager::get_active_controller ( )

Returns the controller for the active method if it is available.

Return values
null|gradingform_controller

◆ get_active_method()

grading_manager::get_active_method ( )

Returns the currently active grading method in the gradable area.

Return values
string|nullthe name of the grading plugin of null if it has not been set

◆ get_area()

grading_manager::get_area ( )

Returns grading manager area name.

Return values
stringgrading manager area name

◆ get_area_title()

grading_manager::get_area_title ( )

Returns the localized title of the currently set area.

Return values
string

◆ get_available_areas()

grading_manager::get_available_areas ( )

Returns the list of gradable areas in the given context and component.

This performs a callback to the library of the relevant plugin to obtain the list of supported areas.

Return values
arrayof (string)areacode => (string)localized title of the area

◆ get_available_methods()

grading_manager::get_available_methods (   $includenone = true)

Returns the list of available grading methods in the given context.

Currently this is just a static list obtained from self::available_methods(). In the future, the list of available methods may be controlled per-context.

Requires the context property to be set in advance.

Parameters
bool$includenoneshould the 'Simple direct grading' be included
Return values
arrayof the (string)name => (string)localized title of the method

◆ get_component()

grading_manager::get_component ( )

Returns grading manager component.

Return values
stringgrading manager component

◆ get_component_title()

grading_manager::get_component_title ( )

Returns a text describing the context and the component.

At the moment this works for gradable areas in course modules. In the future, this method should be improved so it works for other contexts (blocks, gradebook items etc) or subplugins.

Return values
string

◆ get_context()

grading_manager::get_context ( )

Returns grading manager context.

Return values
stdClassgrading manager context

◆ get_controller()

grading_manager::get_controller (   $method)

Returns the given method's controller in the gradable area.

Parameters
string$methodthe method name, eg 'rubric' (must be available)
Return values
gradingform_controller

◆ get_management_url()

grading_manager::get_management_url ( moodle_url  $returnurl = null)

Returns the URL of the grading area management page.

Parameters
moodle_url$returnurloptional URL of the page where the user should be sent back to
Return values
moodle_url

◆ load()

grading_manager::load (   $areaid)

Loads the gradable area info from the database.

Parameters
int$areaid

◆ set_active_method()

grading_manager::set_active_method (   $method)

Sets the currently active grading method in the gradable area.

Parameters
string$methodthe method name, eg 'rubric' (must be available)
Return values
booltrue if the method changed or was just set, false otherwise

◆ set_area()

grading_manager::set_area (   $area)

Sets the area the manager operates on.

Parameters
string$areathe name of the gradable area

◆ set_component()

grading_manager::set_component (   $component)

Sets the component the manager operates on.

Parameters
string$componentthe frankenstyle name of the component

◆ set_context()

grading_manager::set_context ( stdClass  $context)

Sets the context the manager operates on.

Parameters
stdClass$context

◆ tokenize()

static grading_manager::tokenize (   $needle)
static

Helper method to tokenize the given string.

Splits the given string into smaller strings. This is a helper method for full text searching in grading forms. If the given string is surrounded with double quotes, the resulting array consists of a single item containing the quoted content.

Otherwise, string like 'grammar, english language' would be tokenized into the three tokens 'grammar', 'english', 'language'.

One-letter tokens like are dropped in non-phrase mode. Repeated tokens are returned just once.

Parameters
string$needle
Return values
array

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