mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-18 11:58:24 +01:00
"- first step of using new recurrence field
- fixed some wrong idention"
This commit is contained in:
parent
062f02987b
commit
5aa62b71b9
@ -169,21 +169,21 @@ class calendar_ical extends calendar_boupdate
|
||||
function &exportVCal($events, $version='1.0', $method='PUBLISH', $recur_date=0)
|
||||
{
|
||||
$egwSupportedFields = array(
|
||||
'CLASS' => array('dbName' => 'public'),
|
||||
'SUMMARY' => array('dbName' => 'title'),
|
||||
'DESCRIPTION' => array('dbName' => 'description'),
|
||||
'LOCATION' => array('dbName' => 'location'),
|
||||
'DTSTART' => array('dbName' => 'start'),
|
||||
'DTEND' => array('dbName' => 'end'),
|
||||
'ORGANIZER' => array('dbName' => 'owner'),
|
||||
'ATTENDEE' => array('dbName' => 'participants'),
|
||||
'RRULE' => array('dbName' => 'recur_type'),
|
||||
'EXDATE' => array('dbName' => 'recur_exception'),
|
||||
'PRIORITY' => array('dbName' => 'priority'),
|
||||
'TRANSP' => array('dbName' => 'non_blocking'),
|
||||
'CATEGORIES' => array('dbName' => 'category'),
|
||||
'UID' => array('dbName' => 'uid'),
|
||||
'RECURRENCE-ID' => array('dbName' => 'reference'),
|
||||
'CLASS' => 'public',
|
||||
'SUMMARY' => 'title',
|
||||
'DESCRIPTION' => 'description',
|
||||
'LOCATION' => 'location',
|
||||
'DTSTART' => 'start',
|
||||
'DTEND' => 'end',
|
||||
'ORGANIZER' => 'owner',
|
||||
'ATTENDEE' => 'participants',
|
||||
'RRULE' => 'recur_type',
|
||||
'EXDATE' => 'recur_exception',
|
||||
'PRIORITY' => 'priority',
|
||||
'TRANSP' => 'non_blocking',
|
||||
'CATEGORIES' => 'category',
|
||||
'UID' => 'uid',
|
||||
'RECURRENCE-ID' => 'recurrence',
|
||||
);
|
||||
|
||||
if (!is_array($this->supportedFields)) $this->setSupportedFields();
|
||||
@ -209,7 +209,7 @@ class calendar_ical extends calendar_boupdate
|
||||
|
||||
if (!is_array($events)) $events = array($events);
|
||||
|
||||
while ($event = array_pop($events))
|
||||
while (($event = array_pop($events)))
|
||||
{
|
||||
if (!is_array($event)
|
||||
&& !($event = $this->read($event, $recur_date, false, $date_format)))
|
||||
@ -258,9 +258,7 @@ class calendar_ical extends calendar_boupdate
|
||||
}
|
||||
}
|
||||
|
||||
foreach($egwSupportedFields as $icalFieldName => $egwFieldInfo)
|
||||
{
|
||||
if ($this->supportedFields[$egwFieldInfo['dbName']])
|
||||
foreach($egwSupportedFields as $icalFieldName => $egwFieldName)
|
||||
{
|
||||
$values[$icalFieldName] = array();
|
||||
switch($icalFieldName)
|
||||
@ -580,24 +578,11 @@ class calendar_ical extends calendar_boupdate
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($event['reference'])
|
||||
elseif ($event['recurrence'] && $event['reference'])
|
||||
{
|
||||
// $event['reference'] is a calendar_id, not a timestamp
|
||||
if (!($revent = $this->read($event['reference']))) break; // referenced event does not exist
|
||||
|
||||
// find recur_exception closest to $event['start'],
|
||||
// as our db-model does NOT store for which recurrence the exception is
|
||||
$exception_start = $exception_diff = null;
|
||||
foreach($revent['recur_exception'] as $exception)
|
||||
{
|
||||
if (!isset($exception_start) || $exception_diff > abs($exception-$event['start']))
|
||||
{
|
||||
$exception_start = $exception;
|
||||
$exception_diff = abs($exception-$event['start']);
|
||||
}
|
||||
}
|
||||
if (!isset($exception_start)) break; // referenced event has no exception
|
||||
|
||||
if ($this->isWholeDay($revent))
|
||||
{
|
||||
$arr = $this->date2array($exception_start);
|
||||
@ -612,11 +597,11 @@ class calendar_ical extends calendar_boupdate
|
||||
{
|
||||
if ($servertime)
|
||||
{
|
||||
$attributes['RECURRENCE-ID'] = date('Ymd\THis', $exception_start);
|
||||
$attributes['RECURRENCE-ID'] = date('Ymd\THis', $event['recurrence']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$attributes['RECURRENCE-ID'] = $exception_start;
|
||||
$attributes['RECURRENCE-ID'] = $event['recurrence'];
|
||||
}
|
||||
}
|
||||
unset($revent);
|
||||
@ -633,7 +618,7 @@ class calendar_ical extends calendar_boupdate
|
||||
$size = -1;
|
||||
$noTruncate = false;
|
||||
}
|
||||
$value = $event[$egwFieldInfo['dbName']];
|
||||
$value = $event[$egwFieldName];
|
||||
$cursize = strlen($value);
|
||||
if (($size > 0) && $cursize > $size) {
|
||||
if ($noTruncate) {
|
||||
@ -652,7 +637,6 @@ class calendar_ical extends calendar_boupdate
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($this->productManufacturer == 'nokia') {
|
||||
if($event['special'] == '1') {
|
||||
@ -1557,9 +1541,11 @@ class calendar_ical extends calendar_boupdate
|
||||
$vcardData['end'] = $dtend_ts;
|
||||
break;
|
||||
case 'RECURRENCE-ID':
|
||||
// event['reference'] is a cal_id, not a date!
|
||||
// setting it to a date makes no sense, not setting it keeps an existing correct reference
|
||||
//$vcardData['reference'] = $attributes['value'];
|
||||
// ToDo or check:
|
||||
// - do we need to set reference (cal_id of orginal series)
|
||||
// - do we need to add that recurrence as recure exception to the original series
|
||||
// --> original series should be found by searching for a series with same UID (backend)
|
||||
$vcardData['recurrence'] = $attributes['value'];
|
||||
break;
|
||||
case 'LOCATION':
|
||||
$vcardData['location'] = $attributes['value'];
|
||||
@ -2131,5 +2117,4 @@ class calendar_ical extends calendar_boupdate
|
||||
$this->set_status($old_event, $userid, $status, $recur_date, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user