From e6beae5627730091637a633f1a10979430d4317a Mon Sep 17 00:00:00 2001 From: Nick Palmer Date: Sat, 15 Mar 2008 10:54:19 +0000 Subject: Make sure focus_date and view_mode get sent through with buildCalendar. Fix calculations for focus_date. The prior usage of getdate was wrong which is why we had to adjust by a day. --- Calendar.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Calendar.php b/Calendar.php index cef03d4..e3361de 100644 --- a/Calendar.php +++ b/Calendar.php @@ -1,6 +1,6 @@ mDate->getdate( $pDateHash['focus_date'], false, true ); + $focus = $this->mDate->_getdate( $pDateHash['focus_date'], false, true ); if( $pDateHash['view_mode'] == 'month' ) { $view_start = $this->mDate->gmmktime( 0, 0, 0, $focus['mon'], 1, $focus['year'] ); @@ -80,18 +80,13 @@ class Calendar extends LibertyContent { $wd -= 7; } - // for some very odd reason, which i can't work out, we need to add a day here - $view_start = $this->mDate->gmmktime( 0, 0, 0, $focus['mon'], $focus['mday'] - $wd + 1, $focus['year'] ); - $view_end = $this->mDate->gmmktime( 0, 0, 0, $focus['mon'], $focus['mday'] - $wd + 8, $focus['year'] ) - 1; + $view_start = $this->mDate->gmmktime( 0, 0, 0, $focus['mon'], $focus['mday'] - $wd, $focus['year'] ); + $view_end = $this->mDate->gmmktime( 0, 0, 0, $focus['mon'], $focus['mday'] - $wd + 7, $focus['year'] ) - 1; } else { $view_start = $this->mDate->gmmktime( 0, 0, 0, $focus['mon'], $focus['mday'] , $focus['year'] ); $view_end = $this->mDate->gmmktime( 0, 0, 0, $focus['mon'], $focus['mday'] + 1, $focus['year'] ) - 1; } - // this is where we adjust the start and stop times to user local time settings - // The range is adjusted backwards so that it covers the correct window -// $view_start = $view_start - $this->display_offset; -// $view_end = $view_end - $this->display_offset; $start_year = $this->mDate->date( 'Y', $view_start, true ); if ( $start_year < 1902 ) { $view_start_iso = $view_start = $this->mDate->date( 'Y-m-d', $view_start, true ); @@ -383,6 +378,12 @@ class Calendar extends LibertyContent { function buildCalendar(&$pListHash, &$pDateHash) { global $gBitSmarty, $gBitSystem; + if( isset($pDateHash['focus_date']) && !isset($pListHash['focus_date']) ) { + $pListHash['focus_date'] = $pDateHash['focus_date']; + } + if( isset($pDateHash['view_mode']) && !isset($pListHash['view_mode']) ) { + $pListHash['view_mode'] = $pDateHash['view_mode']; + } $bitEvents = $this->getEvents($pListHash); $gBitSmarty->assign( 'navigation', $this->buildCalendarNavigation( $pDateHash ) ); -- cgit v1.3