mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
* Calendar: iCal export of list-view contains event series and not recurrences, also fixes wrong timezone, if different between user and server
This commit is contained in:
parent
2d63cfb10d
commit
49bf055b33
@ -379,7 +379,7 @@ class calendar_uilist extends calendar_ui
|
|||||||
foreach((array) $this->bo->search($search_params) as $event)
|
foreach((array) $this->bo->search($search_params) as $event)
|
||||||
{
|
{
|
||||||
$this->to_client($event);
|
$this->to_client($event);
|
||||||
|
|
||||||
if ($params['csv_export'])
|
if ($params['csv_export'])
|
||||||
{
|
{
|
||||||
$event['participants'] = implode(",\n",$this->bo->participants($event,true));
|
$event['participants'] = implode(",\n",$this->bo->participants($event,true));
|
||||||
@ -453,7 +453,7 @@ class calendar_uilist extends calendar_ui
|
|||||||
|
|
||||||
// set id for grid
|
// set id for grid
|
||||||
$event['row_id'] = $event['id'].($event['recur_type'] ? ':'.$event['recur_date'] : '');
|
$event['row_id'] = $event['id'].($event['recur_type'] ? ':'.$event['recur_date'] : '');
|
||||||
|
|
||||||
// Format start and end with timezone
|
// Format start and end with timezone
|
||||||
foreach(array('start','end') as $time)
|
foreach(array('start','end') as $time)
|
||||||
{
|
{
|
||||||
@ -508,7 +508,7 @@ class calendar_uilist extends calendar_ui
|
|||||||
*/
|
*/
|
||||||
function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg,$skip_notification=false)
|
function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg,$skip_notification=false)
|
||||||
{
|
{
|
||||||
//echo '<p>' . __METHOD__ . "('$action',".print_r($checked,true).','.(int)$use_all.",...)</p>\n";
|
//error_log(__METHOD__."('$action', ".array2string($checked).', all='.(int)$use_all.", ...)");
|
||||||
$success = $failed = 0;
|
$success = $failed = 0;
|
||||||
$msg = null;
|
$msg = null;
|
||||||
|
|
||||||
@ -542,7 +542,7 @@ class calendar_uilist extends calendar_ui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for calendar integration we have to fetch all rows and unset the not selected ones, as we can not filter by id
|
// for calendar integration we have to fetch all rows and unset the not selected ones, as we can not filter by id
|
||||||
elseif(in_array($action,array('ical','document')))
|
elseif($action == 'document')
|
||||||
{
|
{
|
||||||
$query = is_array($session_name) ? $session_name : egw_session::appsession($session_name,'calendar');
|
$query = is_array($session_name) ? $session_name : egw_session::appsession($session_name,'calendar');
|
||||||
@set_time_limit(0); // switch off the execution time limit, as for big selections it's too small
|
@set_time_limit(0); // switch off the execution time limit, as for big selections it's too small
|
||||||
@ -558,12 +558,23 @@ class calendar_uilist extends calendar_ui
|
|||||||
switch($action)
|
switch($action)
|
||||||
{
|
{
|
||||||
case 'ical':
|
case 'ical':
|
||||||
|
// compile list of unique cal_id's, as iCal should contain whole series, not recurrences
|
||||||
|
// calendar_ical->exportVCal needs to read events again, to get them in server-time
|
||||||
|
$ids = array();
|
||||||
|
foreach($checked as $id)
|
||||||
|
{
|
||||||
|
if (is_array($id)) $id = $id['id'];
|
||||||
|
// get rid of recurrences, doublicate series and calendar-integration events
|
||||||
|
if (($id = (int)$id))
|
||||||
|
{
|
||||||
|
$ids[$id] = $id;
|
||||||
|
}
|
||||||
|
}
|
||||||
$boical = new calendar_ical();
|
$boical = new calendar_ical();
|
||||||
$ical =& $boical->exportVCal($checked,'2.0','PUBLISH',false);
|
$ical =& $boical->exportVCal($ids, '2.0', 'PUBLISH');
|
||||||
html::content_header($content['file'] ? $content['file'] : 'event.ics','text/calendar',bytes($ical));
|
html::content_header('event.ics', 'text/calendar', bytes($ical));
|
||||||
echo $ical;
|
echo $ical;
|
||||||
common::egw_exit();
|
common::egw_exit();
|
||||||
break;
|
|
||||||
|
|
||||||
case 'document':
|
case 'document':
|
||||||
if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['calendar']['default_document'];
|
if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['calendar']['default_document'];
|
||||||
|
Loading…
Reference in New Issue
Block a user