Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402]
Duration form element Contains class to create length of time for element.
Copyright: | 2009 Tim Hunt |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 303 lines (12 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
MoodleQuickForm_duration:: (2 methods):
__construct()
MoodleQuickForm_duration()
name:: (8 methods):
get_units()
get_units_used()
seconds_to_unit()
_createElements()
onQuickFormEvent()
toHtml()
accept()
exportValue()
Class: MoodleQuickForm_duration - X-Ref
Duration element__construct($elementName = null, $elementLabel = null,$options = [], $attributes = null) 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. Recognised values are param: mixed $attributes Either a typical HTML attribute string or an associative array |
MoodleQuickForm_duration($elementName = null, $elementLabel = null,$options = [], $attributes = null) X-Ref |
Old syntax of class constructor. Deprecated in PHP7. |
get_units() X-Ref |
Returns time associative array of unit length. return: array unit length in seconds => string unit name. |
get_units_used() X-Ref |
Get the units to be used for this field. The ones specified in the options passed to the constructor, or all by default. return: array number of seconds => lang string. |
seconds_to_unit($seconds) X-Ref |
Converts seconds to the best possible time unit. for example 1800 -> [30, MINSECS] = 30 minutes. param: int $seconds an amout of time in seconds. return: array associative array ($number => $unit) |
_createElements() X-Ref |
Override of standard quickforms method to create this element. |
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: bool |
toHtml() X-Ref |
Returns HTML for advchecbox form element. return: string |
accept(&$renderer, $required = false, $error = null) X-Ref |
Accepts a renderer param: HTML_QuickForm_Renderer $renderer An HTML_QuickForm_Renderer object param: bool $required Whether a group is required param: ?string $error An error message associated with a group |
exportValue(&$submitValues, $assoc = false) X-Ref |
Output a timestamp. Give it the name of the group. Override of standard quickforms method. param: array $submitValues param: bool $assoc whether to return the value as associative array return: array field name => value. The value is the time interval in seconds. |