aboutsummaryrefslogtreecommitdiffstats
path: root/include/event.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2019-05-20 12:26:33 +0200
committerMario Vavti <mario@mariovavti.com>2019-05-20 12:26:33 +0200
commit34d1f797778c71357989d793a6356ed9f8aeefed (patch)
tree989446171dcd230aeac1f242323ec677a14ca53d /include/event.php
parentaa120e0478b8a7e0eabcbd7b8d7eefd515ff5347 (diff)
downloadvolse-hubzilla-34d1f797778c71357989d793a6356ed9f8aeefed.tar.gz
volse-hubzilla-34d1f797778c71357989d793a6356ed9f8aeefed.tar.bz2
volse-hubzilla-34d1f797778c71357989d793a6356ed9f8aeefed.zip
calendar merge: initial commit for timezone support
Diffstat (limited to 'include/event.php')
-rw-r--r--include/event.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/include/event.php b/include/event.php
index 471fb7afa..9bae69f5c 100644
--- a/include/event.php
+++ b/include/event.php
@@ -75,17 +75,19 @@ function format_event_obj($jobject) {
//ensure compatibility with older items - this check can be removed at a later point
if(array_key_exists('description', $object)) {
+ $tz = (($object['timezone']) ? $object['timezone'] : 'UTC');
+
$bd_format = t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8:01 AM
$event['header'] = replace_macros(get_markup_template('event_item_header.tpl'),array(
'$title' => zidify_links(smilies(bbcode($object['title']))),
'$dtstart_label' => t('Starts:'),
- '$dtstart_title' => datetime_convert('UTC', 'UTC', $object['dtstart'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
- '$dtstart_dt' => (($object['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['dtstart'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $object['dtstart'] , $bd_format))),
+ '$dtstart_title' => datetime_convert($tz, date_default_timezone_get(), $object['dtstart'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
+ '$dtstart_dt' => (($object['adjust']) ? day_translate(datetime_convert($tz, date_default_timezone_get(), $object['dtstart'] , $bd_format )) : day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['dtstart'] , $bd_format))),
'$finish' => (($object['nofinish']) ? false : true),
'$dtend_label' => t('Finishes:'),
- '$dtend_title' => datetime_convert('UTC','UTC',$object['dtend'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
- '$dtend_dt' => (($object['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['dtend'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $object['dtend'] , $bd_format )))
+ '$dtend_title' => datetime_convert($tz, date_default_timezone_get(), $object['dtend'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
+ '$dtend_dt' => (($object['adjust']) ? day_translate(datetime_convert($tz, date_default_timezone_get(), $object['dtend'] , $bd_format )) : day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['dtend'] , $bd_format )))
));
$event['content'] = replace_macros(get_markup_template('event_item_content.tpl'),array(
@@ -1042,6 +1044,7 @@ function event_store_item($arr, $event) {
'type' => ACTIVITY_OBJ_EVENT,
'id' => z_root() . '/event/' . $r[0]['resource_id'],
'title' => $arr['summary'],
+ 'timezone' => $arr['timezone'],
'dtstart' => $arr['dtstart'],
'dtend' => $arr['dtend'],
'nofinish' => $arr['nofinish'],
@@ -1107,6 +1110,8 @@ function event_store_item($arr, $event) {
}
$item_id = $r[0]['id'];
+ set_iconfig($item_id, 'event', 'timezone', $arr['timezone'], true);
+
/**
* @hooks event_updated
* Called when an event record is modified.
@@ -1197,6 +1202,7 @@ function event_store_item($arr, $event) {
'type' => ACTIVITY_OBJ_EVENT,
'id' => z_root() . '/event/' . $event['event_hash'],
'title' => $arr['summary'],
+ 'timezone' => $arr['timezone'],
'dtstart' => $arr['dtstart'],
'dtend' => $arr['dtend'],
'nofinish' => $arr['nofinish'],
@@ -1223,6 +1229,7 @@ function event_store_item($arr, $event) {
// activities refer to the item message_id as the parent.
set_iconfig($item_arr, 'system','event_id',$event['event_hash'],true);
+ set_iconfig($item_arr, 'event','timezone',$arr['timezone'],true);
$res = item_store($item_arr);