aboutsummaryrefslogtreecommitdiff
path: root/views/default/input/datepicker_inline.php
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/input/datepicker_inline.php')
-rw-r--r--views/default/input/datepicker_inline.php44
1 files changed, 35 insertions, 9 deletions
diff --git a/views/default/input/datepicker_inline.php b/views/default/input/datepicker_inline.php
index 560074a2d..69520b9ef 100644
--- a/views/default/input/datepicker_inline.php
+++ b/views/default/input/datepicker_inline.php
@@ -6,16 +6,43 @@
* @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
+ * @copyright Radagast Solutions 2008 -2011
* @link http://radagast.biz/
*
*/
+if ($vars['group_guid']) {
+ $link_bit = $vars['url']."event_calendar/group/{$vars['group_guid']}/%s/{$vars['mode']}";
+} else {
+ $link_bit = $vars['url']."event_calendar/list/%s/{$vars['mode']}/{$vars['filter']}";
+}
+
+if ($vars['mode'] == 'week') {
+ $selected_week = date('W',strtotime($vars['start_date']))+1;
+} else {
+ $selected_week = '';
+}
+// TODO - figure out how to move this JavaScript
?>
<script language="javascript">
+var selectedWeek = "<?php echo $selected_week; ?>";
+highlightWeek = function(d) {
+ if (!selectedWeek) { return [true,''];}
+ //var date = $(this).datepicker('getDate');
+ var dayOfWeek = d.getUTCDay();
+ var weekNumber = $.datepicker.iso8601Week(d);
+ if (dayOfWeek == 6) {
+ weekNumber += 1;
+ }
+
+ if (selectedWeek == weekNumber) {
+ return [true,'week-highlight'];
+ }
+ return [true,''];
+}
$(document).ready(function(){
var done_loading = false;
-$("#<?php echo $vars['internalname']; ?>").datepicker({
+$("#<?php echo $vars['name']; ?>").datepicker({
onChangeMonthYear: function(year, month, inst) {
if(inst.onChangeToday){
day=inst.selectedDay;
@@ -24,19 +51,17 @@ $("#<?php echo $vars['internalname']; ?>").datepicker({
}
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';
+ document.location.href = "<?php echo $link_bit; ?>".replace('%s', 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);
+ document.location.href = "<?php echo $link_bit; ?>".replace('%s', 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
+ beforeShowDay: highlightWeek
});
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']; ?>");
@@ -44,9 +69,10 @@ var end_date = $.datepicker.parseDate("yy-mm-dd", "<?php echo $vars['end_date'];
if ("<?php echo $vars['mode'] ?>" == "month") {
end_date += 1;
}
-$("#<?php echo $vars['internalname']; ?>").datepicker("setDate", start_date, end_date);
+$("#<?php echo $vars['name']; ?>").datepicker("setDate", start_date, end_date);
var done_loading = true;
});
+
</script>
-<div id="<?php echo $vars['internalname']; ?>" ></div>
+<div style="position:relative;" id="<?php echo $vars['name']; ?>" ></div>
<p style="clear: both;"><!-- See day-by-day example for highlighting days code --></p> \ No newline at end of file