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.

Generator for the gradingforum_rubric plugin.

Copyright: 2019 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 240 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 2 files
 grade/grading/form/rubric/tests/generator/rubric.php
 grade/grading/form/rubric/tests/generator/criterion.php

Defines 1 class

gradingform_rubric_generator:: (7 methods):
  create_instance()
  get_rubric()
  get_criterion()
  get_level_and_criterion_for_values()
  get_submitted_form_data()
  get_test_rubric()
  get_test_form_data()


Class: gradingform_rubric_generator  - X-Ref

Generator for the gradingforum_rubric plugintype.

create_instance(context $context,string $component,string $area,string $name,string $description,array $criteria)   X-Ref
Create an instance of a rubric.

return: gradingform_rubric_controller
param: context $context
param: string $component
param: string $area
param: string $name
param: string $description
param: array $criteria The list of criteria to add to the generated rubric

get_rubric(string $name, string $description)   X-Ref
Get a new rubric for use with the rubric controller.

Note: This is just a helper class used to build a new definition. It does not persist the data.

return: rubric
param: string $name
param: string $description

get_criterion(string $description, array $levels = [])   X-Ref
Get a new rubric for use with a gradingform_rubric_generator_rubric.

Note: This is just a helper class used to build a new definition. It does not persist the data.

return: gradingform_rubric_generator_criterion
param: string $description
param: array $levels Set of levels in the form definition => score

get_level_and_criterion_for_values(gradingform_controller $controller,string $description,float $score)   X-Ref
Given a controller instance, fetch the level and criterion information for the specified values.

return: array
param: gradingform_controller $controller
param: string $description The description to match the criterion on
param: float $score The value to match the level on

get_submitted_form_data(gradingform_rubric_controller $controller, int $itemid, array $values)   X-Ref
Get submitted form data for the supplied controller, itemid, and values.
The returned data is in the format used by rubric when handling form submission.

param: gradingform_rubric_controller $controller
param: int $itemid
param: array $values A set of array values where the array key is the name of the criterion, and the value is an

get_test_rubric(context $context, string $component, string $area)   X-Ref
Generate a rubric controller with sample data required for testing of this class.

return: gradingform_rubric_controller
param: context $context
param: string $component
param: string $area

get_test_form_data(gradingform_rubric_controller $controller,int $itemid,float $spellingscore,string $spellingremark,float $picturescore,string $pictureremark)   X-Ref
Fetch a set of sample data.

return: array
param: gradingform_rubric_controller $controller
param: int $itemid
param: float $spellingscore
param: string $spellingremark
param: float $picturescore
param: string $pictureremark