aboutsummaryrefslogtreecommitdiff
path: root/views/default/input/timepicker.php
blob: 35fa5ac98a4db022981d1ddcb752fe8f2c73735a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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));

?>