Save and restore iCal STATUS properties
This commit is contained in:
parent
b1e797adf1
commit
1ce6d461a6
5 changed files with 18 additions and 0 deletions
|
@ -412,6 +412,8 @@ class libvcalendar implements Iterator
|
||||||
$event['cancelled'] = true;
|
$event['cancelled'] = true;
|
||||||
else if ($prop->value == 'COMPLETED')
|
else if ($prop->value == 'COMPLETED')
|
||||||
$event['complete'] = 100;
|
$event['complete'] = 100;
|
||||||
|
else
|
||||||
|
$event['status'] = strval($prop->value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'PRIORITY':
|
case 'PRIORITY':
|
||||||
|
@ -939,6 +941,8 @@ class libvcalendar implements Iterator
|
||||||
$ve->add('STATUS', 'TENTATIVE');
|
$ve->add('STATUS', 'TENTATIVE');
|
||||||
else if ($event['complete'] == 100)
|
else if ($event['complete'] == 100)
|
||||||
$ve->add('STATUS', 'COMPLETED');
|
$ve->add('STATUS', 'COMPLETED');
|
||||||
|
else if (!empty($event['status']))
|
||||||
|
$ve->add('STATUS', $event['status']);
|
||||||
|
|
||||||
if (!empty($event['sensitivity']))
|
if (!empty($event['sensitivity']))
|
||||||
$ve->add('CLASS', strtoupper($event['sensitivity']));
|
$ve->add('CLASS', strtoupper($event['sensitivity']));
|
||||||
|
|
|
@ -287,6 +287,7 @@ class libvcalendar_test extends PHPUnit_Framework_TestCase
|
||||||
$this->assertInstanceOf('DateTime', $task['start'], "'start' property is DateTime object");
|
$this->assertInstanceOf('DateTime', $task['start'], "'start' property is DateTime object");
|
||||||
$this->assertInstanceOf('DateTime', $task['due'], "'due' property is DateTime object");
|
$this->assertInstanceOf('DateTime', $task['due'], "'due' property is DateTime object");
|
||||||
$this->assertEquals('-1D:DISPLAY', $task['alarms'], "Taks alarm value");
|
$this->assertEquals('-1D:DISPLAY', $task['alarms'], "Taks alarm value");
|
||||||
|
$this->assertEquals('IN-PROCESS', $task['status'], "Task status property");
|
||||||
$this->assertEquals(1, count($task['x-custom']), "Custom properties");
|
$this->assertEquals(1, count($task['x-custom']), "Custom properties");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,8 @@ class kolab_format_event extends kolab_format_xcal
|
||||||
$status = kolabformat::StatusTentative;
|
$status = kolabformat::StatusTentative;
|
||||||
if ($object['cancelled'])
|
if ($object['cancelled'])
|
||||||
$status = kolabformat::StatusCancelled;
|
$status = kolabformat::StatusCancelled;
|
||||||
|
else if ($object['status'] && array_key_exists($object['status'], $this->status_map))
|
||||||
|
$status = $this->status_map[$object['status']];
|
||||||
$this->obj->setStatus($status);
|
$this->obj->setStatus($status);
|
||||||
|
|
||||||
// save recurrence exceptions
|
// save recurrence exceptions
|
||||||
|
|
|
@ -43,6 +43,13 @@ class kolab_format_task extends kolab_format_xcal
|
||||||
|
|
||||||
$this->obj->setPercentComplete(intval($object['complete']));
|
$this->obj->setPercentComplete(intval($object['complete']));
|
||||||
|
|
||||||
|
$status = kolabformat::StatusUndefined;
|
||||||
|
if ($object['complete'] == 100)
|
||||||
|
$status = kolabformat::StatusCompleted;
|
||||||
|
else if ($object['status'] && array_key_exists($object['status'], $this->status_map))
|
||||||
|
$status = $this->status_map[$object['status']];
|
||||||
|
$this->obj->setStatus($status);
|
||||||
|
|
||||||
if (isset($object['start']))
|
if (isset($object['start']))
|
||||||
$this->obj->setStart(self::get_datetime($object['start'], null, $object['start']->_dateonly));
|
$this->obj->setStart(self::get_datetime($object['start'], null, $object['start']->_dateonly));
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,10 @@ abstract class kolab_format_xcal extends kolab_format
|
||||||
'IN-PROCESS' => kolabformat::StatusInProcess,
|
'IN-PROCESS' => kolabformat::StatusInProcess,
|
||||||
'COMPLETED' => kolabformat::StatusCompleted,
|
'COMPLETED' => kolabformat::StatusCompleted,
|
||||||
'CANCELLED' => kolabformat::StatusCancelled,
|
'CANCELLED' => kolabformat::StatusCancelled,
|
||||||
|
'TENTATIVE' => kolabformat::StatusTentative,
|
||||||
|
'CONFIRMED' => kolabformat::StatusConfirmed,
|
||||||
|
'DRAFT' => kolabformat::StatusDraft,
|
||||||
|
'FINAL' => kolabformat::StatusFinal,
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $part_status_map = array(
|
protected $part_status_map = array(
|
||||||
|
|
Loading…
Add table
Reference in a new issue