Hi Mark
In the MoodleQuickForm_duration class (lib/form/duration.php) I can see the following function which provides the different values for the dropdown menu (in seconds):
public function get_units() {
if (is_null($this->_units)) {
$this->_units = array(
604800 => get_string('weeks'),
86400 => get_string('days'),
3600 => get_string('hours'),
60 => get_string('minutes'),
1 => get_string('seconds'),
);
}
return $this->_units;
}
For my plugin, I need to do add another value for years ie 31536000 => get_string('years') but I'm trying to avoid hacking core Moodle. I wondered if there is an easy was to define this or is there a set_units function or similar that I could use (I couldn't find one).
My attempt at extending the duration class with my own duration_ext class threw an error:
QuickForm Error: unregistered element Element 'duration_ext' does not exist in HTML_QuickForm::_loadElement()
I'm guessing this probably the wrong path to go down because the form element 'types' are already defined within Moodle and it's not easy to extend these or add new ones.
Cheers
Paul