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.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

Drop down form element to select the grade Contains HTML class for a drop down element to select the grade for an activity, used in mod update form

Copyright: 2006 Jamie Pratt <me@jamiep.org>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 551 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

MoodleQuickForm_modgrade:: (2 methods):
  __construct()
  MoodleQuickForm_modgrade()

name:: (7 methods):
  _createElements()
  exportValue()
  process_value()
  validate_scale()
  validate_point()
  onQuickFormEvent()
  generate_modgrade_subelement_id()


Class: MoodleQuickForm_modgrade  - X-Ref

Drop down form element to select the grade

HTML class for a drop down element to select the grade for an activity,
used in mod update form

__construct($elementname = null, $elementlabel = null, $options = array()   X-Ref
Constructor

param: string $elementname Element's name
param: mixed $elementlabel Label(s) for an element
param: array $options Options to control the element's display. Required - must contain the following options:
param: mixed $attributes Either a typical HTML attribute string or an associative array

MoodleQuickForm_modgrade($elementname = null, $elementlabel = null, $options = array()   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


Class: name  - X-Ref

_createElements()   X-Ref
Create elements for this group.


exportValue(&$submitvalues, $notused = false)   X-Ref
Calculate the output value for the element as a whole.

param: array $submitvalues The incoming values from the form.
param: bool $notused Not used.
return: array Return value for the element, formatted like field name => value.

process_value($type='none', $scale=null, $point=null, $rescalegrades=null)   X-Ref
Process the value for the group based on the selected grade type, and the input for the scale and point elements.

param: string $type The value of the grade type select box. Can be 'none', 'scale', or 'point'
param: string|int $scale The value of the scale select box.
param: string|int $point The value of the point grade textbox.
param: string $rescalegrades The value of the rescalegrades select.
return: int The resulting value

validate_scale($val)   X-Ref
Determines whether a given value is a valid scale selection.

param: string|int $val The value to test.
return: bool Valid or invalid

validate_point($val)   X-Ref
Determines whether a given value is a valid point selection.

param: string|int $val The value to test.
return: bool Valid or invalid

onQuickFormEvent($event, $arg, &$caller)   X-Ref
Called by HTML_QuickForm whenever form event is made on this element.

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

generate_modgrade_subelement_id($subname)   X-Ref
Generates the id attribute for the subelement of the modgrade group.

Uses algorithm similar to what {@link HTML_QuickForm_element::_generateId()}
does but takes the name of the wrapping modgrade group into account.

param: string $subname the name of the HTML_QuickForm_element in this modgrade group
return: string