aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-04-05 07:59:41 +0000
committerMario <mario@mariovavti.com>2020-04-05 07:59:41 +0000
commit805f8bf98377d17593dfe884eac5c69079b83eed (patch)
treebef8c6d1e5b1c6372648578191155be41fc5375f
parent67c9b5d04954012e062ee16619c1c8369582b670 (diff)
downloadvolse-hubzilla-805f8bf98377d17593dfe884eac5c69079b83eed.tar.gz
volse-hubzilla-805f8bf98377d17593dfe884eac5c69079b83eed.tar.bz2
volse-hubzilla-805f8bf98377d17593dfe884eac5c69079b83eed.zip
show event timezone if it differs from the channel default timezone
-rw-r--r--include/event.php15
-rwxr-xr-xview/tpl/event_item_header.tpl5
2 files changed, 18 insertions, 2 deletions
diff --git a/include/event.php b/include/event.php
index d39da227c..c8f9d2561 100644
--- a/include/event.php
+++ b/include/event.php
@@ -76,7 +76,17 @@ 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');
+ $event_tz = '';
+ if(is_array($object['asld']) && isset($object['asld']['attachment'])) {
+ foreach($object['asld']['attachment'] as $attachment) {
+ if($attachment['type'] === 'PropertyValue' && $attachment['name'] == 'zot.event.timezone' ) {
+ $event_tz = $attachment['value'];
+ break;
+ }
+ }
+
+ }
+
$allday = (($object['adjust']) ? false : true);
$dtstart = new DateTime($object['dtstart']);
@@ -104,7 +114,8 @@ function format_event_obj($jobject) {
'$dtend_title' => datetime_convert('UTC', date_default_timezone_get(), $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 ))),
'$allday' => $allday,
- '$oneday' => $oneday
+ '$oneday' => $oneday,
+ '$event_tz' => ['label' => t('Timezone'), 'value' => (($event_tz === date_default_timezone_get()) ? '' : $event_tz)]
));
$event['content'] = replace_macros(get_markup_template('event_item_content.tpl'),array(
diff --git a/view/tpl/event_item_header.tpl b/view/tpl/event_item_header.tpl
index ed46c304f..e81db48a1 100755
--- a/view/tpl/event_item_header.tpl
+++ b/view/tpl/event_item_header.tpl
@@ -15,3 +15,8 @@
</div>
{{/if}}
{{/if}}
+{{if $event_tz.value}}
+<div class="event-item-start">
+ <span class="event-item-label">{{$event_tz.label}}:</span>&nbsp;<span class="timezone" title="{{$event_tz.value}}">{{$event_tz.value}}</span>
+</div>
+{{/if}}