$this->getHighestCollectionId($username)+1, 'principaluri' => $username, 'uri' => $uri, 'displayname' => NULL, 'description' => NULL, 'timezone' => NULL, 'calendarorder' => NULL, 'calendarcolor' => NULL, 'components' => 'VEVENT,VTODO', 'synctoken' => 1, ]; $collection = array_merge($collection, $properties); return $collection; } public function newObject ($collectionId, $uri, $data, $extraData = NULL) { $object = [ 'id' => $this->getHighestObjectId($collectionId)+1, 'uri' => $uri, 'componenttype' => NULL, 'firstoccurence' => NULL, 'lastoccurence' => NULL, 'uid' => NULL, 'etag' => md5($data), 'lastmodified' => time(), 'size' => strlen($data), ]; if ($extraData !== NULL) { $object = array_merge($object, $extraData); } return $object; } public function newObjectUpdate ($collectionId, $uri, $data, $extraData = NULL) { $update = [ 'etag' => md5($data), 'size' => strlen($data), 'lastmodified' => time(), ]; if ($extraData !== NULL) { $update = array_merge($update, $extraData); } return $update; } public function getUriByUID($username, $uid) { $collections = $this->getCollections($username); foreach ($collections as $collection) { $objects = $this->getObjects($collection['id']); foreach ($objects as $object) { if ($object['uid'] == $uid) return $collection['uri'].'/'.$object['uri']; } } return null; } }