summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2007-02-26 20:58:26 +0000
committerLester Caine <lester@lsces.co.uk>2007-02-26 20:58:26 +0000
commit54eda65c27ddd0f5e3b9a35e855fce75f40b9a6a (patch)
treec4935d63f4c54488ca053c73edd73124f0f4ee18
parentaa8a363241c40180c060b0423db85641275a631f (diff)
downloadcalendar-54eda65c27ddd0f5e3b9a35e855fce75f40b9a6a.tar.gz
calendar-54eda65c27ddd0f5e3b9a35e855fce75f40b9a6a.tar.bz2
calendar-54eda65c27ddd0f5e3b9a35e855fce75f40b9a6a.zip
Switch active display of current date between UTC and Local. This will need further work to generate a valid UTC date under all conditions. This mode gets the module and main dates switching correctly.
-rw-r--r--Calendar.php12
-rw-r--r--templates/calendar_nav_inc.tpl2
2 files changed, 11 insertions, 3 deletions
diff --git a/Calendar.php b/Calendar.php
index fd7724d..3cfbb31 100644
--- a/Calendar.php
+++ b/Calendar.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_calendar/Calendar.php,v 1.33 2006/03/01 20:16:03 spiderr Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_calendar/Calendar.php,v 1.34 2007/02/26 20:58:26 lsces Exp $
* @package calendar
*/
@@ -165,8 +165,15 @@ class Calendar extends LibertyContent {
* is not available via this route!
**/
function buildCalendarNavigation( $pDateHash ) {
+ global $gBitUser, $gBitSystem;
$focus = $this->mDate->getdate( $pDateHash['focus_date'] );
- $today = $this->mDate->getdate( mktime() );
+ if ( $gBitUser->getPreference('site_display_timezone', "Local") != 'UTC' ) {
+ $today = $this->mDate->getdate( mktime() );
+ $flag = 'Local';
+ } else {
+ $today = $this->mDate->getdate( $this->mDate->getUTCFromServerDate( gmmktime() - mktime(0,0,0,1,2,1970,0) - gmmktime(0,0,0,1,2,1970,0) ) );
+ $flag = 'UTC';
+ }
$ret = array(
'before' => array(
@@ -185,6 +192,7 @@ class Calendar extends LibertyContent {
'focus_year' => $focus['year'],
'focus_date' => $focus[0],
'today' => $this->mDate->gmmktime( 0, 0, 0, $today['mon'], $today['mday'], $today['year'] ),
+ 'tz_flag' => $flag,
'display_focus_date' => $focus[0],
);
diff --git a/templates/calendar_nav_inc.tpl b/templates/calendar_nav_inc.tpl
index 36c1d3f..206d669 100644
--- a/templates/calendar_nav_inc.tpl
+++ b/templates/calendar_nav_inc.tpl
@@ -55,7 +55,7 @@
</td>
<td style="text-align:center;">
- <a href="{$smarty.const.CALENDAR_PKG_URL}index.php?todate={$smarty.now}&amp;{$url_string}" title="{$smarty.now|bit_long_date}">{tr}Today{/tr}: <strong>{$smarty.now|bit_long_date}</strong></a>
+ <a href="{$smarty.const.CALENDAR_PKG_URL}index.php?todate={$smarty.now}&amp;{$url_string}" title="{$navigation.today|bit_long_date}">{tr}Today{/tr}: <strong>{$navigation.today|bit_long_date} {$navigation.tz_flag}</strong></a>
</td>
<td rowspan="2" style="text-align:right;">