timepicker_old.php 759 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. $time_format = elgg_get_plugin_setting('timeformat', 'event_calendar');
  3. if (!$time_format) {
  4. $time_format = 24;
  5. }
  6. $value = $vars['value'];
  7. if (is_numeric($value)) {
  8. $hour = floor($value/60);
  9. $minute = ($value -60*$hour);
  10. // add 1 to avoid pulldown 0 bug
  11. $hour++;
  12. $minute++;
  13. } else {
  14. $hour = '-';
  15. $minute = '-';
  16. }
  17. $hours = array();
  18. $hours['-'] = '-';
  19. for($i=0;$i<$time_format;$i++) {
  20. $hours[$i+1] = $i;
  21. }
  22. $minutes = array();
  23. $minutes['-'] = '-';
  24. for($i=0;$i<60;$i=$i+15) {
  25. $minutes[$i+1] = sprintf("%02d",$i);
  26. }
  27. echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_h','value'=>$hour,'options_values'=>$hours));
  28. echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_m','value'=>$minute,'options_values'=>$minutes));
  29. ?>