aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Cal.php36
-rw-r--r--include/event.php5
-rwxr-xr-xview/tpl/event_head.tpl1
3 files changed, 26 insertions, 16 deletions
diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php
index 70098a2a1..49489f912 100644
--- a/Zotlabs/Module/Cal.php
+++ b/Zotlabs/Module/Cal.php
@@ -84,6 +84,7 @@ class Cal extends \Zotlabs\Web\Controller {
'$module_url' => '/cal/' . $channel['channel_address'],
'$modparams' => 2,
'$lang' => \App::$language,
+ '$timezone' => date_default_timezone_get(),
'$first_day' => $first_day
));
@@ -215,8 +216,8 @@ class Cal extends \Zotlabs\Web\Controller {
$sql_extra .= " and etype != 'birthday' ";
if (x($_GET,'id')){
- $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan
- from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d $sql_extra limit 1",
+ $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id
+ from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d $sql_extra limit 1",
intval($channel['channel_id']),
intval($_GET['id'])
);
@@ -227,12 +228,12 @@ class Cal extends \Zotlabs\Web\Controller {
// Noting this for now - it will need to be fixed here and in Friendica.
// Ultimately the finish date shouldn't be involved in the query.
- $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan
- from event left join item on event_hash = resource_id
- where resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored
- AND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )
- OR ( adjust = 1 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )) $sql_extra ",
- intval($channel['channel_id']),
+ $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id
+ from event left join item on event.event_hash = item.resource_id
+ where item.resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored
+ AND (( event.adjust = 0 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' )
+ OR ( event.adjust = 1 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' )) ",
+ intval(local_channel()),
dbesc($start),
dbesc($finish),
dbesc($adjust_start),
@@ -266,16 +267,23 @@ class Cal extends \Zotlabs\Web\Controller {
if($r) {
foreach($r as $rr) {
-
- $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j'));
- $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], $fmt) : datetime_convert('UTC','UTC',$rr['dtstart'],$fmt));
+
+ $tz = get_iconfig($rr, 'event', 'timezone');
+
+ if(! $tz)
+ $tz = 'UTC';
+
+ $rr['timezone'] = $tz;
+
+ $j = (($rr['adjust']) ? datetime_convert($tz,date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j'));
+ $d = (($rr['adjust']) ? datetime_convert($tz,date_default_timezone_get(),$rr['dtstart'], $fmt) : datetime_convert('UTC','UTC',$rr['dtstart'],$fmt));
$d = day_translate($d);
- $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'c') : datetime_convert('UTC','UTC',$rr['dtstart'],'c'));
+ $start = (($rr['adjust']) ? datetime_convert($tz,date_default_timezone_get(),$rr['dtstart'], 'c') : datetime_convert('UTC','UTC',$rr['dtstart'],'c'));
if ($rr['nofinish']){
$end = null;
} else {
- $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtend'], 'c') : datetime_convert('UTC','UTC',$rr['dtend'],'c'));
+ $end = (($rr['adjust']) ? datetime_convert($tz,date_default_timezone_get(),$rr['dtend'], 'c') : datetime_convert('UTC','UTC',$rr['dtend'],'c'));
}
@@ -302,7 +310,7 @@ class Cal extends \Zotlabs\Web\Controller {
'start'=> $start,
'end' => $end,
'drop' => $drop,
- 'allDay' => false,
+ 'allDay' => (($rr['adjust']) ? 0 : 1),
'title' => $title,
'j' => $j,
diff --git a/include/event.php b/include/event.php
index ca08a67b5..de4e692b8 100644
--- a/include/event.php
+++ b/include/event.php
@@ -27,6 +27,7 @@ function format_event_html($ev) {
if(! ((is_array($ev)) && count($ev)))
return '';
+ $tz = (($ev['timezone']) ? $ev['timezone'] : 'UTC');
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8:01 AM
@@ -39,7 +40,7 @@ function format_event_html($ev) {
$o .= '<div class="event-start"><span class="event-label">' . t('Starts:') . '</span>&nbsp;<span class="dtstart" title="'
. datetime_convert('UTC', 'UTC', $ev['dtstart'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
. '" >'
- . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
+ . (($ev['adjust']) ? day_translate(datetime_convert($tz, date_default_timezone_get(),
$ev['dtstart'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC',
$ev['dtstart'] , $bd_format)))
@@ -49,7 +50,7 @@ function format_event_html($ev) {
$o .= '<div class="event-end" ><span class="event-label">' . t('Finishes:') . '</span>&nbsp;<span class="dtend" title="'
. datetime_convert('UTC','UTC',$ev['dtend'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
. '" >'
- . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
+ . (($ev['adjust']) ? day_translate(datetime_convert($tz, date_default_timezone_get(),
$ev['dtend'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC',
$ev['dtend'] , $bd_format )))
diff --git a/view/tpl/event_head.tpl b/view/tpl/event_head.tpl
index 0e6f7523c..9d56b7fe4 100755
--- a/view/tpl/event_head.tpl
+++ b/view/tpl/event_head.tpl
@@ -52,6 +52,7 @@
header: false,
eventTextColor: 'white',
lang: '{{$lang}}',
+ timeZone: '{{$timezone}}',
firstDay: {{$first_day}},
eventLimit: 3,