Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Public Member Functions | |
__construct ($elementname=null, $elementlabel=null, $options=array(), $attributes=null) | |
Constructor. More... | |
_createElements () | |
Create elements for this group. | |
accept (&$renderer, $required=false, $error=null) | |
Accepts a renderer. More... | |
createFormElement () | |
Creates an element to add to the group Expects the same arguments as MoodleQuickForm::createElement() | |
export_for_template (renderer_base $output) | |
Function to export the renderer data in a format that is suitable for a mustache template. More... | |
exportValue (&$submitvalues, $notused=false) | |
Calculate the output value for the element as a whole. More... | |
getElementTemplateType () | |
Returns element template, nodisplay/static/fieldset. More... | |
string | getHelpButton () |
template type, would cause problems with client side validation so will leave for now More... | |
MoodleQuickForm_group ($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName=true) | |
Old syntax of class constructor. More... | |
MoodleQuickForm_modgrade ($elementname=null, $elementlabel=null, $options=array(), $attributes=null) | |
Old syntax of class constructor. More... | |
onQuickFormEvent ($event, $arg, &$caller) | |
Called by HTML_QuickForm whenever form event is made on this element. More... | |
setElements ($elements) | |
Sets the grouped elements and hides label. More... | |
setMoodleForm ($mform) | |
Stores the form this element was added to This object is later used by MoodleQuickForm_group::createElement(). More... | |
validateSubmitValue ($values) | |
Calls the validateSubmitValue function for the containing elements and returns an error string as soon as it finds one. More... | |
Public Attributes | |
string | $_helpbutton ='' |
html for help button, if empty then no help | |
boolean | $canrescale = false |
$canrescale Does this activity support rescaling grades? | |
float | $currentgrade = false |
$currentgrade The current grademax for the grade_item | |
string | $currentgradetype = 'none' |
$currentgradetype The current gradetype - can either be 'none', 'scale', or 'point' | |
int | $currentscaleid = null |
$currentscaleid The current scale id | |
boolean | $hasgrades = false |
$hasgrades Has this grade_item got any real grades (with values) | |
boolean | $isupdate = false |
$isupdate Is this an add or an update ? | |
boolean | $useratings = false |
$useratings Set to true if the activity is using ratings, false otherwise | |
Protected Member Functions | |
generate_modgrade_subelement_id ($subname) | |
Generates the id attribute for the subelement of the modgrade group. More... | |
process_value ($type='none', $scale=null, $point=null, $rescalegrades=null) | |
Process the value for the group based on the selected grade type, and the input for the scale and point elements. More... | |
validate_point ($val) | |
Determines whether a given value is a valid point selection. More... | |
validate_scale ($val) | |
Determines whether a given value is a valid scale selection. More... | |
Protected Attributes | |
MoodleQuickForm | $_mform = null |
$_renderedfromtemplate = false | |
MoodleQuickForm_modgrade::__construct | ( | $elementname = null , |
|
$elementlabel = null , |
|||
$options = array() , |
|||
$attributes = null |
|||
) |
Constructor.
string | $elementname | Element's name |
mixed | $elementlabel | Label(s) for an element |
array | $options | Options to control the element's display. Required - must contain the following options: 'isupdate' - is this a new module or are we editing an existing one? 'currentgrade' - the current grademax in the database for this gradeitem 'hasgrades' - whether or not the grade_item has existing grade_grades 'canrescale' - whether or not the activity supports rescaling grades |
mixed | $attributes | Either a typical HTML attribute string or an associative array |
|
inherited |
Accepts a renderer.
object | An HTML_QuickForm_Renderer object |
bool | Whether a group is required |
string | An error message associated with a group |
void |
Reimplemented in MoodleQuickForm_filetypes, MoodleQuickForm_duration, MoodleQuickForm_defaultcustom, MoodleQuickForm_date_time_selector, and MoodleQuickForm_date_selector.
|
inherited |
Function to export the renderer data in a format that is suitable for a mustache template.
This means:
renderer_base | $output | Used to do a final render of any components that need to be rendered for export. |
stdClass|array |
Implements templatable.
Reimplemented in MoodleQuickForm_date_time_selector, and MoodleQuickForm_date_selector.
MoodleQuickForm_modgrade::exportValue | ( | & | $submitvalues, |
$notused = false |
|||
) |
Calculate the output value for the element as a whole.
array | $submitvalues | The incoming values from the form. |
bool | $notused | Not used. |
array | Return value for the element, formatted like field name => value. |
|
protected |
Generates the id attribute for the subelement of the modgrade group.
Uses algorithm similar to what HTML_QuickForm_element::_generateId() does but takes the name of the wrapping modgrade group into account.
string | $subname | the name of the HTML_QuickForm_element in this modgrade group |
string |
|
inherited |
Returns element template, nodisplay/static/fieldset.
string |
|
inherited |
template type, would cause problems with client side validation so will leave for now
set html for help button
|
inherited |
MoodleQuickForm_modgrade::MoodleQuickForm_modgrade | ( | $elementname = null , |
|
$elementlabel = null , |
|||
$options = array() , |
|||
$attributes = null |
|||
) |
MoodleQuickForm_modgrade::onQuickFormEvent | ( | $event, | |
$arg, | |||
& | $caller | ||
) |
Called by HTML_QuickForm whenever form event is made on this element.
string | $event | Name of event |
mixed | $arg | event arguments |
moodleform | $caller | calling object |
mixed |
Reimplemented from MoodleQuickForm_group.
|
protected |
Process the value for the group based on the selected grade type, and the input for the scale and point elements.
string | $type | The value of the grade type select box. Can be 'none', 'scale', or 'point' |
string | int | $scale | The value of the scale select box. |
string | int | $point | The value of the point grade textbox. |
string | $rescalegrades | The value of the rescalegrades select. |
int | The resulting value |
|
inherited |
Sets the grouped elements and hides label.
array | $elements |
|
inherited |
Stores the form this element was added to This object is later used by MoodleQuickForm_group::createElement().
null | MoodleQuickForm | $mform |
|
protected |
Determines whether a given value is a valid point selection.
string | int | $val | The value to test. |
bool | Valid or invalid |
|
protected |
Determines whether a given value is a valid scale selection.
string | int | $val | The value to test. |
bool | Valid or invalid |
|
inherited |
Calls the validateSubmitValue function for the containing elements and returns an error string as soon as it finds one.
array | $values | Values of the containing elements. |
string|null | Validation error message or null. |
Reimplemented in MoodleQuickForm_filetypes.