diff options
author | Cash Costello <cash.costello@gmail.com> | 2011-06-28 18:12:41 -0400 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2011-06-28 18:12:41 -0400 |
commit | 29792a9858484266952a53268e4fd0dd29b2f4a5 (patch) | |
tree | bad977e423a6d1193d362295611fe4472c2373af /views/default/input/timepicker.php | |
parent | 1dd01c7ff9685995b4bc9de0ceeb7856086c3f40 (diff) | |
download | elgg-29792a9858484266952a53268e4fd0dd29b2f4a5.tar.gz elgg-29792a9858484266952a53268e4fd0dd29b2f4a5.tar.bz2 |
moved the code into the base directory so that it is easier to work with
Diffstat (limited to 'views/default/input/timepicker.php')
-rw-r--r-- | views/default/input/timepicker.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/views/default/input/timepicker.php b/views/default/input/timepicker.php new file mode 100644 index 000000000..35fa5ac98 --- /dev/null +++ b/views/default/input/timepicker.php @@ -0,0 +1,38 @@ +<?php + +$time_format = get_plugin_setting('timeformat', 'event_calendar'); +if (!$time_format) { + $time_format = 24; +} + +$value = $vars['value']; +if (is_numeric($value)) { + $hour = floor($value/60); + $minute = ($value -60*$hour); + + // add 1 to avoid pulldown 0 bug + $hour++; + $minute++; +} else { + $hour = '-'; + $minute = '-'; +} + +$hours = array(); +$hours['-'] = '-'; + +for($i=0;$i<$time_format;$i++) { + $hours[$i+1] = $i; +} + +$minutes = array(); +$minutes['-'] = '-'; + +for($i=0;$i<60;$i=$i+5) { + $minutes[$i+1] = sprintf("%02d",$i); +} + +echo elgg_view('input/pulldown',array('internalname'=>$vars['internalname'].'_h','value'=>$hour,'options_values'=>$hours)); +echo elgg_view('input/pulldown',array('internalname'=>$vars['internalname'].'_m','value'=>$minute,'options_values'=>$minutes)); + +?>
\ No newline at end of file |