diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index 770d3cde1e..057167318e 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -1827,7 +1827,27 @@ class calendar_bo } return $this->cached_holidays[$year]; } - + + /** + * Get translated calendar event fields, presenting as link title options + * + * @param type $event + * @return array array of selected calendar fields + */ + function get_link_options ($event) + { + $options = array ( + 'end' => lang('End date'), + 'id' => lang('ID'), + 'owner' => lang('Event owner'), + 'category' => lang('Category'), + 'location' => lang('Location'), + 'creator' => lang('Creator'), + 'participants' => lang('Participants') + ); + return $options; + } + /** * get title for an event identified by $event * @@ -1851,6 +1871,35 @@ class calendar_bo { return $event; } + $type = explode(',',$this->cal_prefs['link_title']); + if (is_array($type)) + { + foreach ($type as &$val) + { + switch ($val) + { + case 'end': + case 'modified': + $extra_fields [$val] = $this->format_date($event[$val]); + break; + case 'participants': + foreach ($event[$val] as $key => $value) + { + $extra_fields [$val] = accounts::id2name($key); + } + break; + case 'modifier': + case 'creator': + case 'owner': + $extra_fields [$val] = accounts::id2name($event[$val]); + break; + default: + $extra_fields [] = $event[$val]; + } + } + $str_fields = implode(', ',$extra_fields); + if (is_array($extra_fields)) return $this->format_date($event['start']) . ': ' . $event['title'] . ($str_fields? ', ' . $str_fields:''); + } return $this->format_date($event['start']) . ': ' . $event['title']; } diff --git a/calendar/inc/class.calendar_hooks.inc.php b/calendar/inc/class.calendar_hooks.inc.php index 724041f821..70532aca40 100644 --- a/calendar/inc/class.calendar_hooks.inc.php +++ b/calendar/inc/class.calendar_hooks.inc.php @@ -277,7 +277,7 @@ class calendar_hooks $export_tzs = array('0' => 'Use Event TZ'); $export_tzs += egw_time::getTimezones(); } - + $link_title_options = ExecMethod('calendar.calendar_bo.get_link_options'); $settings = array( '1.section' => array( 'type' => 'section', @@ -415,6 +415,16 @@ class calendar_hooks 'admin' => False, 'forced' => 'all', ), + 'link_title' => array( + 'type' => 'multiselect', + 'label' => 'Link title for events to show', + 'name' => 'link_title', + 'values' => $link_title_options, + 'help' => 'What should links to the calendar events display in other applications.', + 'xmlrpc' => True, + 'admin' => false, + 'default'=> '', + ), '2.section' => array( 'type' => 'section', 'title' => lang('appointment settings'),