$stmt=$this->pdo->prepare('SELECT id, uri, lastmodified, etag, calendarid, size, calendardata, componenttype FROM '.$this->calendarObjectTableName.' WHERE calendarid = ? AND uri = ?');
$stmt->execute([$calendarId,$objectUri]);
$row=$stmt->fetch(\PDO::FETCH_ASSOC);
if(!$row)returnnull;
return[
'id'=>$row['id'],
'uri'=>$row['uri'],
'lastmodified'=>$row['lastmodified'],
'etag'=>'"'.$row['etag'].'"',
'calendarid'=>$row['calendarid'],
'size'=>(int)$row['size'],
'calendardata'=>$row['calendardata'],
'component'=>strtolower($row['componenttype']),
];
}
/**
* Returns a list of calendar objects.
*
* This method should work identical to getCalendarObject, but instead
* return all the calendar objects in the list as an array.
*
* If the backend supports this, it may allow for some speed-ups.
$query='SELECT id, uri, lastmodified, etag, calendarid, size, calendardata, componenttype FROM '.$this->calendarObjectTableName.' WHERE calendarid = ? AND uri IN (';
$stmt=$this->pdo->prepare('INSERT INTO '.$this->calendarChangesTableName.' (uri, synctoken, calendarid, operation) SELECT ?, synctoken, ?, ? FROM '.$this->calendarTableName.' WHERE id = ?');
$stmt->execute([
$objectUri,
$calendarId,
$operation,
$calendarId
]);
$stmt=$this->pdo->prepare('UPDATE '.$this->calendarTableName.' SET synctoken = synctoken + 1 WHERE id = ?');
$stmt->execute([
$calendarId
]);
}
/**
* Returns a list of subscriptions for a principal.
*
* Every subscription is an array with the following keys:
* * id, a unique id that will be used by other functions to modify the
* subscription. This can be the same as the uri or a database key.
* * uri. This is just the 'base uri' or 'filename' of the subscription.
* * principaluri. The owner of the subscription. Almost always the same as
* principalUri passed to this method.
* * source. Url to the actual feed
*
* Furthermore, all the subscription info must be returned too:
*
* 1. {DAV:}displayname
* 2. {http://apple.com/ns/ical/}refreshrate
* 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos
* should not be stripped).
* 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms
* should not be stripped).
* 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if
$stmt=$this->pdo->prepare('SELECT uri, calendardata, lastmodified, etag, size FROM '.$this->schedulingObjectTableName.' WHERE principaluri = ? AND uri = ?');
$stmt->execute([$principalUri,$objectUri]);
$row=$stmt->fetch(\PDO::FETCH_ASSOC);
if(!$row)returnnull;
return[
'uri'=>$row['uri'],
'calendardata'=>$row['calendardata'],
'lastmodified'=>$row['lastmodified'],
'etag'=>'"'.$row['etag'].'"',
'size'=>(int)$row['size'],
];
}
/**
* Returns all scheduling objects for the inbox collection.
*
* These objects should be returned as an array. Every item in the array
* should follow the same structure as returned from getSchedulingObject.
*
* The main difference is that 'calendardata' is optional.
*
* @param string $principalUri
* @return array
*/
functiongetSchedulingObjects($principalUri){
$stmt=$this->pdo->prepare('SELECT id, calendardata, uri, lastmodified, etag, size FROM '.$this->schedulingObjectTableName.' WHERE principaluri = ?');