1
0
mirror of https://github.com/moodle/moodle.git synced 2025-05-05 15:57:04 +02:00

MDL-34853 code style fixes

This commit is contained in:
Eloy Lafuente (stronk7) 2012-08-22 03:08:40 +02:00
parent ef2737a4df
commit 444af7c65f
2 changed files with 14 additions and 9 deletions

@ -2828,11 +2828,16 @@ class admin_setting_configduration extends admin_setting {
}
$data = self::parse_seconds($seconds);
switch ($data['u']) {
case (60*60*24*7) : return get_string('numweeks', '', $data['v']);
case (60*60*24) : return get_string('numdays', '', $data['v']);
case (60*60) : return get_string('numhours', '', $data['v']);
case (60) : return get_string('numminutes', '', $data['v']);
default: return get_string('numseconds', '', $data['v']*$data['u']);
case (60*60*24*7):
return get_string('numweeks', '', $data['v']);
case (60*60*24):
return get_string('numdays', '', $data['v']);
case (60*60):
return get_string('numhours', '', $data['v']);
case (60):
return get_string('numminutes', '', $data['v']);
default:
return get_string('numseconds', '', $data['v']*$data['u']);
}
}
@ -2843,7 +2848,7 @@ class admin_setting_configduration extends admin_setting {
* @return array
*/
protected static function parse_seconds($seconds) {
foreach (self::get_units() as $unit=>$unused) {
foreach (self::get_units() as $unit => $unused) {
if ($seconds % $unit === 0) {
return array('v'=>(int)($seconds/$unit), 'u'=>$unit);
}
@ -2908,7 +2913,7 @@ class admin_setting_configduration extends admin_setting {
$return = '<div class="form-duration defaultsnext">';
$return .= '<input type="text" size="5" id="'.$this->get_id().'v" name="'.$this->get_full_name().'[v]" value="'.s($data['v']).'" />';
$return .= '<select id="'.$this->get_id().'u" name="'.$this->get_full_name().'[u]">';
foreach ($units as $val=>$text) {
foreach ($units as $val => $text) {
$selected = '';
if ($data['v'] == 0) {
if ($val == $this->defaultunit) {

@ -58,8 +58,8 @@ class MoodleQuickForm_duration extends MoodleQuickForm_group {
* @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
'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.
* '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.
* @param mixed $attributes Either a typical HTML attribute string or an associative array
*/