mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-27 02:14:45 +01:00
* Calendar: Add customizable link title in calendar preferences, in order to append extra fields to calendar's link title.
This commit is contained in:
parent
aa2eaf512e
commit
cf7017a281
@ -1828,6 +1828,26 @@ 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, 'account_fullname');
|
||||
}
|
||||
break;
|
||||
case 'modifier':
|
||||
case 'creator':
|
||||
case 'owner':
|
||||
$extra_fields [$val] = accounts::id2name($event[$val], 'account_fullname');
|
||||
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'];
|
||||
}
|
||||
|
||||
|
@ -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'),
|
||||
|
Loading…
Reference in New Issue
Block a user