Permalink
Browse files

MDL-34853 code style fixes

  • Loading branch information...
1 parent ef2737a commit 444af7c65fe40401e0757fc7d5d516c444ff980d @stronk7 stronk7 committed Aug 22, 2012
Showing with 14 additions and 9 deletions.
  1. +12 −7 lib/adminlib.php
  2. +2 −2 lib/form/duration.php
View
@@ -2828,11 +2828,16 @@ protected static function get_duration_text($seconds) {
}
$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 @@ protected static function get_duration_text($seconds) {
* @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 @@ public function output_html($data, $query='') {
$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) {
View
@@ -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
*/

0 comments on commit 444af7c

Please sign in to comment.