81 $stmt = $this->pdo->prepare(
"SELECT id, uri FROM simple_calendars WHERE principaluri = ? ORDER BY id ASC");
82 $stmt->execute([$principalUri]);
85 while (
$row =
$stmt->fetch(\PDO::FETCH_ASSOC)) {
90 'principaluri' => $principalUri,
112 $stmt = $this->pdo->prepare(
"INSERT INTO simple_calendars (principaluri, uri) VALUES (?, ?)");
113 $stmt->execute([$principalUri, $calendarUri]);
115 return $this->pdo->lastInsertId();
127 $stmt = $this->pdo->prepare(
'DELETE FROM simple_calendarobjects WHERE calendarid = ?');
128 $stmt->execute([$calendarId]);
130 $stmt = $this->pdo->prepare(
'DELETE FROM simple_calendars WHERE id = ?');
131 $stmt->execute([$calendarId]);
168 $stmt = $this->pdo->prepare(
'SELECT id, uri, calendardata FROM simple_calendarobjects WHERE calendarid = ?');
169 $stmt->execute([$calendarId]);
172 foreach (
$stmt->fetchAll(\PDO::FETCH_ASSOC) as
$row) {
175 'uri' =>
$row[
'uri'],
176 'etag' =>
'"' . md5(
$row[
'calendardata']) .
'"',
177 'calendarid' => $calendarId,
178 'size' => strlen(
$row[
'calendardata']),
179 'calendardata' =>
$row[
'calendardata'],
205 $stmt = $this->pdo->prepare(
'SELECT id, uri, calendardata FROM simple_calendarobjects WHERE calendarid = ? AND uri = ?');
206 $stmt->execute([$calendarId, $objectUri]);
209 if (!
$row)
return null;
213 'uri' =>
$row[
'uri'],
214 'etag' =>
'"' . md5(
$row[
'calendardata']) .
'"',
215 'calendarid' => $calendarId,
216 'size' => strlen(
$row[
'calendardata']),
217 'calendardata' =>
$row[
'calendardata'],
242 $stmt = $this->pdo->prepare(
'INSERT INTO simple_calendarobjects (calendarid, uri, calendardata) VALUES (?,?,?)');
249 return '"' . md5($calendarData) .
'"';
273 $stmt = $this->pdo->prepare(
'UPDATE simple_calendarobjects SET calendardata = ? WHERE calendarid = ? AND uri = ?');
274 $stmt->execute([$calendarData, $calendarId, $objectUri]);
276 return '"' . md5($calendarData) .
'"';
291 $stmt = $this->pdo->prepare(
'DELETE FROM simple_calendarobjects WHERE calendarid = ? AND uri = ?');
292 $stmt->execute([$calendarId, $objectUri]);
__construct(\PDO $pdo)
Creates the backend.
getCalendarObjects($calendarId)
Returns all calendar objects within a calendar.
createCalendarObject($calendarId, $objectUri, $calendarData)
Creates a new calendar object.
Simple PDO CalDAV backend.
createCalendar($principalUri, $calendarUri, array $properties)
Creates a new calendar for a principal.
deleteCalendar($calendarId)
Delete a calendar and all it's objects.
getCalendarObject($calendarId, $objectUri)
Returns information from a single calendar object, based on it's object uri.
getCalendarsForUser($principalUri)
Returns a list of calendars for a principal.
updateCalendarObject($calendarId, $objectUri, $calendarData)
Updates an existing calendarobject, based on it's uri.
deleteCalendarObject($calendarId, $objectUri)
Deletes an existing calendar object.
Abstract Calendaring backend.