mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-19756 Added a shortcut method to moodle_select for getting multiple time selectors at once: moodle_select::make_time_selectors()
This commit is contained in:
parent
7816f7b837
commit
01ee7142c1
1 changed files with 16 additions and 0 deletions
|
@ -4022,6 +4022,22 @@ class moodle_select extends moodle_html_component {
|
||||||
return $timerselector;
|
return $timerselector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given an associative array of type => fieldname and an optional timestamp,
|
||||||
|
* returns an array of moodle_select components representing date/time selectors.
|
||||||
|
* @param array $selectors Arrays of type => fieldname. Selectors will be returned in the order of the types given
|
||||||
|
* @param int $currenttime A UNIX timestamp
|
||||||
|
* @param int $step minute spacing
|
||||||
|
* @return array Instantiated date/time selectors
|
||||||
|
*/
|
||||||
|
public function make_time_selectors($selectors, $currenttime=0, $step=5) {
|
||||||
|
$selects = array();
|
||||||
|
foreach ($selectors as $type => $name) {
|
||||||
|
$selects[] = moodle_select::make_time_selector($type, $name, $currenttime, $step);
|
||||||
|
}
|
||||||
|
return $selects;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a shortcut for making a select popup form.
|
* This is a shortcut for making a select popup form.
|
||||||
* @param string $baseurl The target URL up to the point of the variable that changes
|
* @param string $baseurl The target URL up to the point of the variable that changes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue