Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
MoodleQuickForm_grading Class Reference

Advance grading form element. More...

Inheritance diagram for MoodleQuickForm_grading:
templatable

Public Member Functions

 __construct ($elementName=null, $elementLabel=null, $attributes=null)
 Class constructor.
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template.
 
 get_gradinginstance ()
 Helper function to retrieve gradingform_instance passed in element attributes.
 
 getElementTemplateType ()
 The renderer of gradingform_instance will take care itself about different display in normal and frozen states.
 
 getHelpButton ()
 get html for help button
 
 MoodleQuickForm_grading ($elementName=null, $elementLabel=null, $attributes=null)
 Old syntax of class constructor.
 
 onQuickFormEvent ($event, $arg, &$caller)
 Called by HTML_QuickForm whenever form event is made on this element.
 
 toHtml ()
 Returns the input field in HTML.
 

Static Public Member Functions

static _validate ($elementvalue, $attributes=null)
 Function registered as rule for this element and is called when this element is being validated.
 

Public Attributes

string $_helpbutton =''
 html for help button, if empty then no help
 

Detailed Description

Advance grading form element.

HTML class for a grading element. This is a wrapper for advanced grading plugins. When adding the 'grading' element to the form, developer must pass an object of class gradingform_instance as $attributes['gradinginstance']. Otherwise an exception will be thrown. This object is responsible for implementing functions to render element html and validate it

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

Constructor & Destructor Documentation

◆ __construct()

MoodleQuickForm_grading::__construct ( $elementName = null,
$elementLabel = null,
$attributes = null )

Class constructor.

Parameters
string$elementNameInput field name attribute
mixed$elementLabelLabel(s) for the input field
mixed$attributesEither a typical HTML attribute string or an associative array

Member Function Documentation

◆ _validate()

static MoodleQuickForm_grading::_validate ( $elementvalue,
$attributes = null )
static

Function registered as rule for this element and is called when this element is being validated.

This is a wrapper to pass the validation to the method gradingform_instance\validate_grading_element

Parameters
mixed$elementvaluevalue of element to be validated
array$attributeselement attributes
Return values
MoodleQuickForm_grading

◆ export_for_template()

MoodleQuickForm_grading::export_for_template ( renderer_base $output)

Function to export the renderer data in a format that is suitable for a mustache template.

This means:

  1. No complex types - only stdClass, array, int, string, float, bool
  2. Any additional info that is required for the template is pre-calculated (e.g. capability checks).
Parameters
renderer_base$outputUsed to do a final render of any components that need to be rendered for export.
Return values
stdClass|array

Implements templatable.

◆ get_gradinginstance()

MoodleQuickForm_grading::get_gradinginstance ( )

Helper function to retrieve gradingform_instance passed in element attributes.

Return values
gradingform_instance

◆ getElementTemplateType()

MoodleQuickForm_grading::getElementTemplateType ( )

The renderer of gradingform_instance will take care itself about different display in normal and frozen states.

Return values
string

◆ getHelpButton()

MoodleQuickForm_grading::getHelpButton ( )

get html for help button

Return values
stringhtml for help button

◆ MoodleQuickForm_grading()

MoodleQuickForm_grading::MoodleQuickForm_grading ( $elementName = null,
$elementLabel = null,
$attributes = null )

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated
since Moodle 3.1

◆ onQuickFormEvent()

MoodleQuickForm_grading::onQuickFormEvent ( $event,
$arg,
& $caller )

Called by HTML_QuickForm whenever form event is made on this element.

Adds necessary rules to the element and checks that coorenct instance of gradingform_instance is passed in attributes

Parameters
string$eventName of event
mixed$argevent arguments
object$callercalling object
Return values
bool
Exceptions
moodle_exception

◆ toHtml()

MoodleQuickForm_grading::toHtml ( )

Returns the input field in HTML.

Return values
string

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