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 () | |
Override of standard quickforms method to create this element. | |
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, $assoc=false) | |
Output a timestamp. More... | |
get_units () | |
Returns time associative array of unit length. 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_duration ($elementName=null, $elementLabel=null, $options=array(), $attributes=null) | |
Old syntax of class constructor. More... | |
MoodleQuickForm_group ($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName=true) | |
Old syntax of class constructor. More... | |
onQuickFormEvent ($event, $arg, &$caller) | |
Called by HTML_QuickForm whenever form event is made on this element. More... | |
seconds_to_unit ($seconds) | |
Converts seconds to the best possible time unit. 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... | |
toHtml () | |
Returns HTML for advchecbox form element. 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 | |
Protected Attributes | |
MoodleQuickForm | $_mform = null |
array | $_options = array('optional' => false, 'defaultunit' => 60) |
Control the fieldnames for form elements optional => if true, show a checkbox beside the element to turn it on (or off) | |
$_renderedfromtemplate = false | |
MoodleQuickForm_duration::__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. Recognised values are 'optional' => true/false - whether to display an 'enabled' checkbox next to the element. 'defaultunit' => 1|60|3600|86400|604800 - the default unit to display when the time is blank. If not specified, minutes is used. |
mixed | $attributes | Either a typical HTML attribute string or an associative array |
MoodleQuickForm_duration::accept | ( | & | $renderer, |
$required = false , |
|||
$error = null |
|||
) |
Accepts a renderer.
HTML_QuickForm_Renderer | $renderer | An HTML_QuickForm_Renderer object |
bool | $required | Whether a group is required |
string | $error | An error message associated with a group |
Reimplemented from MoodleQuickForm_group.
|
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_duration::exportValue | ( | & | $submitValues, |
$assoc = false |
|||
) |
Output a timestamp.
Give it the name of the group. Override of standard quickforms method.
array | $submitValues | |
bool | $assoc | whether to return the value as associative array |
array | field name => value. The value is the time interval in seconds. |
MoodleQuickForm_duration::get_units | ( | ) |
Returns time associative array of unit length.
array | unit length in seconds => string unit name. |
|
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
MoodleQuickForm_duration::MoodleQuickForm_duration | ( | $elementName = null , |
|
$elementLabel = null , |
|||
$options = array() , |
|||
$attributes = null |
|||
) |
|
inherited |
MoodleQuickForm_duration::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 |
object | $caller | calling object |
bool |
Reimplemented from MoodleQuickForm_group.
MoodleQuickForm_duration::seconds_to_unit | ( | $seconds | ) |
Converts seconds to the best possible time unit.
for example 1800 -> array(30, 60) = 30 minutes.
int | $seconds | an amout of time in seconds. |
array | associative array ($number => $unit) |
|
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 |
MoodleQuickForm_duration::toHtml | ( | ) |
Returns HTML for advchecbox form element.
string |
|
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.