aboutsummaryrefslogtreecommitdiff
path: root/mod/event_calendar/views/default/input/timepicker.php
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2013-11-09 16:24:39 +0100
committerSem <sembrestels@riseup.net>2013-11-09 16:24:39 +0100
commita9ac4c861335e60373c1e99b61372e6e0d6ac9f4 (patch)
tree84e660ad22367aab1697a1f910125f520243b882 /mod/event_calendar/views/default/input/timepicker.php
parent1f40407cb2d2f0edfc4cc5346f332f5c6adab022 (diff)
parentb011a80767e1062a394b7bbbc3be3d2959a5f773 (diff)
downloadelgg-a9ac4c861335e60373c1e99b61372e6e0d6ac9f4.tar.gz
elgg-a9ac4c861335e60373c1e99b61372e6e0d6ac9f4.tar.bz2
Add 'mod/event_calendar/' from commit 'b011a80767e1062a394b7bbbc3be3d2959a5f773'
git-subtree-dir: mod/event_calendar git-subtree-mainline: 1f40407cb2d2f0edfc4cc5346f332f5c6adab022 git-subtree-split: b011a80767e1062a394b7bbbc3be3d2959a5f773
Diffstat (limited to 'mod/event_calendar/views/default/input/timepicker.php')
-rw-r--r--mod/event_calendar/views/default/input/timepicker.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/mod/event_calendar/views/default/input/timepicker.php b/mod/event_calendar/views/default/input/timepicker.php
new file mode 100644
index 000000000..2cc95ced7
--- /dev/null
+++ b/mod/event_calendar/views/default/input/timepicker.php
@@ -0,0 +1,51 @@
+<?php
+$time_format = elgg_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);
+} else {
+ $hour = 0;
+ $minute = 0;
+}
+
+$hours = array();
+$minutes = array();
+
+if ($time_format == '12') {
+ $meridians = array('am'=>'am','pm'=>'pm');
+ if ($hour == 0) {
+ $hour = 12;
+ $meridian = 'am';
+ } else if ($hour == 12) {
+ $meridian = 'pm';
+ } else if ($hour < 12) {
+ $meridian = 'am';
+ } else {
+ $hour -= 12;
+ $meridian = 'pm';
+ }
+ for($h=1;$h<=12;$h++) {
+ $hours[$h] = $h;
+ }
+} else {
+ for($h=0;$h<=23;$h++) {
+ $hours[$h] = $h;
+ }
+}
+
+for($m=0;$m<60;$m=$m+5) {
+ $mt = sprintf("%02d",$m);
+ $minutes[$m] = $mt;
+}
+
+echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_hour','value'=>$hour,'options_values'=>$hours));
+echo " <b>:</b> ";
+echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_minute','value'=>$minute,'options_values'=>$minutes));
+if ($time_format == '12') {
+ echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_meridian','value'=>$meridian,'options_values'=>$meridians));
+}