From 0f3805fa95b0ebb0165845cdb2c8e5f6e845fd18 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 16 May 2023 11:28:08 -0600 Subject: [PATCH] Calendar: Fix import/export timezone preference had no options --- calendar/inc/class.calendar_hooks.inc.php | 24 ++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/calendar/inc/class.calendar_hooks.inc.php b/calendar/inc/class.calendar_hooks.inc.php index 9f7d15cfb0..1286f39740 100644 --- a/calendar/inc/class.calendar_hooks.inc.php +++ b/calendar/inc/class.calendar_hooks.inc.php @@ -247,14 +247,32 @@ class calendar_hooks { $options[$group['account_id']] = Api\Accounts::username($group['account_id']); } - $freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'],$GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']); - $freebusy_url = ''.$freebusy_url.''; + $freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'], $GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']); + $freebusy_url = '' . $freebusy_url . ''; $freebusy_help = lang('Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is'); $freebusy_help .= ' ' . $freebusy_url; // Timezone for file exports $export_tzs = array(['value' => '0', 'label' => lang('Use Event TZ')]); - $export_tzs += Api\DateTime::getTimezones(); + $tz_list = Api\DateTime::getTimezones(); + + // Format for select + $format = function ($key, $value) use (&$format, &$tzs) + { + if(is_array($value)) + { + $value = [ + 'label' => $key, + 'value' => array_map($format, array_keys($value), array_values($value)) + ]; + } + else + { + $value = ['label' => $value, 'value' => $key]; + } + return $value; + }; + $export_tzs = array_merge($export_tzs, array_map($format, array_keys($tz_list), array_values($tz_list))); } $link_title_options = calendar_bo::get_link_options(); $settings = array(