Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Advance grading form element Element-container for advanced grading custom input

Copyright: 2011 Marina Glancy
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 173 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 lib/form/templatable_form_element.php

Defines 2 classes

MoodleQuickForm_grading:: (2 methods):
  __construct()
  MoodleQuickForm_grading()

name:: (7 methods):
  get_gradinginstance()
  toHtml()
  getHelpButton()
  getElementTemplateType()
  onQuickFormEvent()
  _validate()
  export_for_template()


Class: MoodleQuickForm_grading  - X-Ref

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

__construct($elementName=null, $elementLabel=null, $attributes=null)   X-Ref
Class constructor

param: string $elementName Input field name attribute
param: mixed $elementLabel Label(s) for the input field
param: mixed $attributes Either a typical HTML attribute string or an associative array

MoodleQuickForm_grading($elementName=null, $elementLabel=null, $attributes=null)   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


Class: name  - X-Ref

get_gradinginstance()   X-Ref
Helper function to retrieve gradingform_instance passed in element attributes

return: gradingform_instance

toHtml()   X-Ref
Returns the input field in HTML

return: string

getHelpButton()   X-Ref
get html for help button

return: string html for help button

getElementTemplateType()   X-Ref
The renderer of gradingform_instance will take care itself about different display
in normal and frozen states

return: string

onQuickFormEvent($event, $arg, &$caller)   X-Ref
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

param: string $event Name of event
param: mixed $arg event arguments
param: object $caller calling object
return: bool

_validate($elementvalue, $attributes = null)   X-Ref
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

param: mixed $elementvalue value of element to be validated
param: array $attributes element attributes
return: MoodleQuickForm_grading

export_for_template(renderer_base $output)   X-Ref
No description