|
| 1 | +<?php if($field->title){ ?><label for="<?php echo $field->id; ?>"><?php echo $field->title; ?></label><?php } ?> |
| 2 | + |
| 3 | +<?php echo html_datepicker($field->data['fname_date'], $field->data['date'], array('id'=>$field->id), array('minDate'=>date('d.m.Y', 86400))); ?> |
| 4 | + |
| 5 | +<?php if($field->data['show_time']){ ?> |
| 6 | + <?php echo html_select_range($field->data['fname_hours'], 0, 23, 1, true, $field->data['hours']); ?> : |
| 7 | + <?php echo html_select_range($field->data['fname_mins'], 0, 59, 1, true, $field->data['mins']); ?> |
| 8 | +<?php } ?> |
| 9 | + |
| 10 | + <a class="ajaxlink" onclick="return parser_current_time_<?php echo $field->id; ?>(this);" href="#"><?php echo LANG_PARSER_CURRENT_TIME; ?></a> |
| 11 | +<script type="text/javascript"> |
| 12 | + function parser_current_time_<?php echo $field->id; ?>(a){ |
| 13 | + var now = new Date(); |
| 14 | + var p = $(a).parent(); |
| 15 | + p.find('input:eq(0)').val((now.getDate()+'.'+(now.getMonth()+1)+'.'+now.getFullYear()).replace(/(\b\d\b)/g, '0$1')); |
| 16 | + <?php if($field->data['show_time']){ ?> |
| 17 | + p.find('select:eq(0) > option:selected').attr('selected', false); |
| 18 | + p.find('select:eq(0) > option[value='+(now.getHours()+'').replace(/(\b\d\b)/g, '0$1')+']').prop('selected', true); |
| 19 | + p.find('select:eq(1) > option:selected').attr('selected', false); |
| 20 | + var mins = now.getMinutes(), last = p.find('select:eq(1) > option[value=00]'); |
| 21 | + p.find('select:eq(1) > option').each(function(){ |
| 22 | + if($(this).val()*1 > mins){ |
| 23 | + last.prop('selected', true); |
| 24 | + return; |
| 25 | + } |
| 26 | + last = $(this); |
| 27 | + }); |
| 28 | + if(last.not(':selected')){ |
| 29 | + last.prop('selected', true); |
| 30 | + } |
| 31 | + <?php } ?> |
| 32 | + return false; |
| 33 | + } |
| 34 | +</script> |
0 commit comments