Read, update and cache sequence attributes of xCal objects

This commit is contained in:
Thomas Bruederli 2012-10-18 19:39:43 +02:00
parent e059785d00
commit 78690dfed4

View file

@ -99,6 +99,7 @@ abstract class kolab_format_xcal extends kolab_format
'uid' => $this->obj->uid(), 'uid' => $this->obj->uid(),
'created' => self::php_datetime($this->obj->created()), 'created' => self::php_datetime($this->obj->created()),
'changed' => self::php_datetime($this->obj->lastModified()), 'changed' => self::php_datetime($this->obj->lastModified()),
'sequence' => intval($this->obj->sequence()),
'title' => $this->obj->summary(), 'title' => $this->obj->summary(),
'location' => $this->obj->location(), 'location' => $this->obj->location(),
'description' => $this->obj->description(), 'description' => $this->obj->description(),
@ -220,14 +221,17 @@ abstract class kolab_format_xcal extends kolab_format
$this->obj->setCreated(self::get_datetime($object['created'])); $this->obj->setCreated(self::get_datetime($object['created']));
} }
if (!empty($object['uid'])) if (!empty($object['uid'])) {
$this->obj->setUid($object['uid']); $this->obj->setUid($object['uid']);
$object['sequence'] = -1;
}
$object['changed'] = new DateTime('now', self::$timezone); $object['changed'] = new DateTime('now', self::$timezone);
$this->obj->setLastModified(self::get_datetime($object['changed'], new DateTimeZone('UTC'))); $this->obj->setLastModified(self::get_datetime($object['changed'], new DateTimeZone('UTC')));
// increment sequence // increment sequence
$this->obj->setSequence($this->obj->sequence()+1); $object['sequence'] = $this->obj->sequence()+1;
$this->obj->setSequence($object['sequence']);
$this->obj->setSummary($object['title']); $this->obj->setSummary($object['title']);
$this->obj->setLocation($object['location']); $this->obj->setLocation($object['location']);