General class providing access to common grading features.
More...
|
static | available_areas ($component) |
| Returns the list of gradable areas provided by the given component.
|
|
static | available_methods ($includenone=true) |
| Returns the list of installed grading plugins together, optionally extended with a simple direct grading.
|
|
static | delete_all_for_context ($contextid) |
| Removes all data associated with the given context.
|
|
static | tokenize ($needle) |
| Helper method to tokenize the given string.
|
|
|
string | $area |
| the name of the gradable area
|
|
string | $component |
| the frankenstyle name of the component
|
|
stdClass | $context |
| the context
|
|
General class providing access to common grading features.
Grading manager provides access to the particular grading method controller in that area.
Fully initialized instance of the grading manager operates over a single gradable area. It is possible to work with a partially initialized manager that knows just context and component without known area, for example. It is also possible to change context, component and area of an existing manager. Such pattern is used when copying form definitions, for example.
- Copyright
- 2011 David Mudrak david.nosp@m.@moo.nosp@m.dle.c.nosp@m.om
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ 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 | $component | normalized component name |
- Return values
-
array | of (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 | $includenone | should the 'Simple direct grading' be included |
- Return values
-
array | of 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 | $method | the name of the plugin we create the area for |
- Return values
-
◆ delete_all_for_context()
static grading_manager::delete_all_for_context |
( |
| $contextid | ) |
|
|
static |
◆ extend_navigation()
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
-
◆ extend_settings_navigation()
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
-
◆ 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|null | the 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
-
string | grading manager area name |
◆ get_area_title()
grading_manager::get_area_title |
( |
| ) |
|
Returns the localized title of the currently set area.
- Return values
-
◆ 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
-
array | of (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 | $includenone | should the 'Simple direct grading' be included |
- Return values
-
array | of the (string)name => (string)localized title of the method |
◆ get_component()
grading_manager::get_component |
( |
| ) |
|
Returns grading manager component.
- Return values
-
string | grading 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
-
◆ get_context()
grading_manager::get_context |
( |
| ) |
|
Returns grading manager context.
- Return values
-
stdClass | grading manager context |
◆ get_controller()
grading_manager::get_controller |
( |
| $method | ) |
|
Returns the given method's controller in the gradable area.
- Parameters
-
string | $method | the method name, eg 'rubric' (must be available) |
- Return values
-
◆ get_management_url()
grading_manager::get_management_url |
( |
moodle_url | $returnurl = null | ) |
|
Returns the URL of the grading area management page.
- Parameters
-
moodle_url | $returnurl | optional URL of the page where the user should be sent back to |
- Return values
-
◆ load()
grading_manager::load |
( |
| $areaid | ) |
|
Loads the gradable area info from the database.
- Parameters
-
◆ set_active_method()
grading_manager::set_active_method |
( |
| $method | ) |
|
Sets the currently active grading method in the gradable area.
- Parameters
-
string | $method | the method name, eg 'rubric' (must be available) |
- Return values
-
bool | true 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 | $area | the name of the gradable area |
◆ set_component()
grading_manager::set_component |
( |
| $component | ) |
|
Sets the component the manager operates on.
- Parameters
-
string | $component | the frankenstyle name of the component |
◆ set_context()
grading_manager::set_context |
( |
stdClass | $context | ) |
|
Sets the context the manager operates on.
- Parameters
-
◆ 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
-
- Return values
-
The documentation for this class was generated from the following file: