Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

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

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: 544 lines (27 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: moodleform $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