diff options
Diffstat (limited to 'views/default/input')
| -rw-r--r-- | views/default/input/datepicker_inline.php | 52 | ||||
| -rw-r--r-- | views/default/input/datepicker_popup.php | 30 | ||||
| -rw-r--r-- | views/default/input/timepicker.php | 38 | 
3 files changed, 120 insertions, 0 deletions
diff --git a/views/default/input/datepicker_inline.php b/views/default/input/datepicker_inline.php new file mode 100644 index 000000000..560074a2d --- /dev/null +++ b/views/default/input/datepicker_inline.php @@ -0,0 +1,52 @@ +<?php + +/** + * JQuery data picker(inline version) + *  + * @package event_calendar + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + *  + */ +?> + +<script language="javascript"> +$(document).ready(function(){ +var done_loading = false; +$("#<?php echo $vars['internalname']; ?>").datepicker({  +	onChangeMonthYear: function(year, month, inst) { + 		if(inst.onChangeToday){ + 			day=inst.selectedDay; + 		}else{ + 			day=1; + 		} +		if (done_loading) { +			// in this case the mode is forced to month +			document.location.href = "<?php echo $vars['url'].'mod/event_calendar/show_events.php?mode=month&group_guid='.$vars['group_guid'].'&start_date='; ?>" + year+'-'+month+'-1'; +		} +	}, +    onSelect: function(date) { +		// jump to the new page +        document.location.href = "<?php echo $vars['url'].'mod/event_calendar/show_events.php?mode='.$vars['mode'].'&group_guid='.$vars['group_guid'].'&start_date='; ?>" + date.substring(0,10); +    }, +    dateFormat: "yy-mm-dd", +    <?php echo $vars['range_bit']; ?> +    hideIfNoPrevNext: true, +    defaultDate: "<?php echo $vars['start_date'] .' - '.$vars['end_date']; ?>", +    <?php if ($vars['mode'] == 'week') echo 'highlightWeek: true,'; ?> +    rangeSelect: true +}); +var start_date = $.datepicker.parseDate("yy-mm-dd", "<?php echo $vars['start_date']; ?>"); +var end_date = $.datepicker.parseDate("yy-mm-dd", "<?php echo $vars['end_date']; ?>"); +// not sure why this is necessary, but it seems to be +if ("<?php echo $vars['mode'] ?>" == "month") { +	end_date += 1; +} +$("#<?php echo $vars['internalname']; ?>").datepicker("setDate", start_date, end_date); +var done_loading = true; +}); +</script> +<div id="<?php echo $vars['internalname']; ?>" ></div> +<p style="clear: both;"><!-- See day-by-day example for highlighting days code --></p>
\ No newline at end of file diff --git a/views/default/input/datepicker_popup.php b/views/default/input/datepicker_popup.php new file mode 100644 index 000000000..8e1120ce7 --- /dev/null +++ b/views/default/input/datepicker_popup.php @@ -0,0 +1,30 @@ +<?php + +/** + * JQuery data picker + *  + * @package event_calendar + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + *  + */ +if ($vars['dateformat']) { +	$date_format = $vars['dateformat']; +} else { +	$date_format = "DD, MM d, yy"; +} +?> + +<script language="javascript"> +$(document).ready(function(){ +$("#<?php echo $vars['internalname']; ?>").datepicker({  +    dateFormat: "<?php echo $date_format; ?>",  +    showOn: "both",  +    buttonImage: "<?php echo $vars['url']; ?>mod/event_calendar/images/calendar.gif",  +    buttonImageOnly: true  +}) +}); +</script> +<input type="text" size="30" value="<?php echo $vars['value']; ?>" name="<?php echo $vars['internalname']; ?>" id="<?php echo $vars['internalname']; ?>"/>
\ No newline at end of file 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  | 
