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.

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/criterion.php
 grade/grading/form/rubric/tests/generator/rubric.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.

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
return: gradingform_rubric_controller

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.

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

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.

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

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.

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

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.

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

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.

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