xref: /plugin/davcal/calendarBackendDokuwiki.php (revision c42afaeb1888e1c5eab2cc232f72177eca9cb25d)
1a1a3b679SAndreas Boehler<?php
2a1a3b679SAndreas Boehler
3a1a3b679SAndreas Boehleruse \Sabre\VObject;
4a1a3b679SAndreas Boehleruse \Sabre\CalDAV;
5a1a3b679SAndreas Boehleruse \Sabre\DAV;
6a1a3b679SAndreas Boehleruse \Sabre\DAV\Exception\Forbidden;
7a1a3b679SAndreas Boehler/**
8a1a3b679SAndreas Boehler * PDO CalDAV backend for DokuWiki - based on Sabre's CalDAV backend
9a1a3b679SAndreas Boehler *
10a1a3b679SAndreas Boehler * This backend is used to store calendar-data in a PDO database, such as
11a1a3b679SAndreas Boehler * sqlite or MySQL
12a1a3b679SAndreas Boehler *
13a1a3b679SAndreas Boehler * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
14a1a3b679SAndreas Boehler * @author Evert Pot (http://evertpot.com/)
15a1a3b679SAndreas Boehler * @license http://sabre.io/license/ Modified BSD License
16a1a3b679SAndreas Boehler */
17d5703f5aSAndreas Boehlerclass DokuWikiSabreCalendarBackend extends \Sabre\CalDAV\Backend\AbstractBackend
18d5703f5aSAndreas Boehler{
19a1a3b679SAndreas Boehler
20a1a3b679SAndreas Boehler
21a1a3b679SAndreas Boehler    /**
22a1a3b679SAndreas Boehler     * DokuWiki PlugIn Helper
23a1a3b679SAndreas Boehler     */
24a1a3b679SAndreas Boehler    protected $hlp = null;
25a1a3b679SAndreas Boehler    /**
26a1a3b679SAndreas Boehler
27a1a3b679SAndreas Boehler    /**
28a1a3b679SAndreas Boehler     * List of CalDAV properties, and how they map to database fieldnames
29a1a3b679SAndreas Boehler     * Add your own properties by simply adding on to this array.
30a1a3b679SAndreas Boehler     *
31a1a3b679SAndreas Boehler     * Note that only string-based properties are supported here.
32a1a3b679SAndreas Boehler     *
33a1a3b679SAndreas Boehler     * @var array
34a1a3b679SAndreas Boehler     */
35d5703f5aSAndreas Boehler    public $propertyMap = array(
36a1a3b679SAndreas Boehler        '{DAV:}displayname'                                   => 'displayname',
37a1a3b679SAndreas Boehler        '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description',
38a1a3b679SAndreas Boehler        '{urn:ietf:params:xml:ns:caldav}calendar-timezone'    => 'timezone',
39d5703f5aSAndreas Boehler        //'{http://apple.com/ns/ical/}calendar-order'           => 'calendarorder',
40d5703f5aSAndreas Boehler        //'{http://apple.com/ns/ical/}calendar-color'           => 'calendarcolor',
41d5703f5aSAndreas Boehler    );
42a1a3b679SAndreas Boehler
43a1a3b679SAndreas Boehler    /**
44a1a3b679SAndreas Boehler     * Creates the backend
45a1a3b679SAndreas Boehler     *
46a1a3b679SAndreas Boehler     * @param \PDO $pdo
47a1a3b679SAndreas Boehler     */
48d5703f5aSAndreas Boehler    function __construct(&$hlp)
49d5703f5aSAndreas Boehler    {
50a1a3b679SAndreas Boehler
51d5703f5aSAndreas Boehler        $this->hlp = $hlp;
52a1a3b679SAndreas Boehler
53a1a3b679SAndreas Boehler    }
54a1a3b679SAndreas Boehler
55a1a3b679SAndreas Boehler    /**
56a1a3b679SAndreas Boehler     * Returns a list of calendars for a principal.
57a1a3b679SAndreas Boehler     *
58a1a3b679SAndreas Boehler     * Every project is an array with the following keys:
59a1a3b679SAndreas Boehler     *  * id, a unique id that will be used by other functions to modify the
60a1a3b679SAndreas Boehler     *    calendar. This can be the same as the uri or a database key.
61a1a3b679SAndreas Boehler     *  * uri. This is just the 'base uri' or 'filename' of the calendar.
62a1a3b679SAndreas Boehler     *  * principaluri. The owner of the calendar. Almost always the same as
63a1a3b679SAndreas Boehler     *    principalUri passed to this method.
64a1a3b679SAndreas Boehler     *
65a1a3b679SAndreas Boehler     * Furthermore it can contain webdav properties in clark notation. A very
66a1a3b679SAndreas Boehler     * common one is '{DAV:}displayname'.
67a1a3b679SAndreas Boehler     *
68a1a3b679SAndreas Boehler     * Many clients also require:
69a1a3b679SAndreas Boehler     * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
70a1a3b679SAndreas Boehler     * For this property, you can just return an instance of
71a1a3b679SAndreas Boehler     * Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet.
72a1a3b679SAndreas Boehler     *
73a1a3b679SAndreas Boehler     * If you return {http://sabredav.org/ns}read-only and set the value to 1,
74a1a3b679SAndreas Boehler     * ACL will automatically be put in read-only mode.
75a1a3b679SAndreas Boehler     *
76a1a3b679SAndreas Boehler     * @param string $principalUri
77a1a3b679SAndreas Boehler     * @return array
78a1a3b679SAndreas Boehler     */
79d5703f5aSAndreas Boehler    function getCalendarsForUser($principalUri)
80d5703f5aSAndreas Boehler    {
81*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'getCalendarsForUser called for: '.$principalUri, __FILE__, __LINE__);
82a1a3b679SAndreas Boehler        $fields = array_values($this->propertyMap);
83a1a3b679SAndreas Boehler        $fields[] = 'id';
84a1a3b679SAndreas Boehler        $fields[] = 'uri';
85a1a3b679SAndreas Boehler        $fields[] = 'synctoken';
86a1a3b679SAndreas Boehler        $fields[] = 'components';
87a1a3b679SAndreas Boehler        $fields[] = 'principaluri';
88a1a3b679SAndreas Boehler        $fields[] = 'transparent';
89a1a3b679SAndreas Boehler
90a1a3b679SAndreas Boehler        $idInfo = $this->hlp->getCalendarIdsForUser($principalUri);
91d5703f5aSAndreas Boehler        $calendars = array();
92d5703f5aSAndreas Boehler        foreach($idInfo as $id => $data)
93d5703f5aSAndreas Boehler        {
94d5703f5aSAndreas Boehler            $row = $this->hlp->getCalendarSettings($id);
95d5703f5aSAndreas Boehler            $components = array();
96d5703f5aSAndreas Boehler            if ($row['components'])
97d5703f5aSAndreas Boehler            {
98a1a3b679SAndreas Boehler                $components = explode(',', $row['components']);
99a1a3b679SAndreas Boehler            }
100a1a3b679SAndreas Boehler
101d5703f5aSAndreas Boehler            $calendar = array(
102a1a3b679SAndreas Boehler                'id'                                                                 => $row['id'],
103a1a3b679SAndreas Boehler                'uri'                                                                => $row['uri'],
104d5703f5aSAndreas Boehler                'principaluri'                                                       => $principalUri,//Overwrite principaluri from database, we actually don't need it.
105a1a3b679SAndreas Boehler                '{' . CalDAV\Plugin::NS_CALENDARSERVER . '}getctag'                  => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ? $row['synctoken'] : '0'),
106a1a3b679SAndreas Boehler                '{http://sabredav.org/ns}sync-token'                                 => $row['synctoken'] ? $row['synctoken'] : '0',
107a1a3b679SAndreas Boehler                '{' . CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet($components),
108d5703f5aSAndreas Boehler                //'{' . CalDAV\Plugin::NS_CALDAV . '}schedule-calendar-transp'         => new CalDAV\Xml\Property\ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
109d5703f5aSAndreas Boehler            );
110a1a3b679SAndreas Boehler            if($idInfo[$row['id']]['readonly'] === true)
111a1a3b679SAndreas Boehler                $calendar['{http://sabredav.org/ns}read-only'] = '1';
112a1a3b679SAndreas Boehler
113a1a3b679SAndreas Boehler
114d5703f5aSAndreas Boehler            foreach ($this->propertyMap as $xmlName => $dbName)
115d5703f5aSAndreas Boehler            {
116a1a3b679SAndreas Boehler                $calendar[$xmlName] = $row[$dbName];
117a1a3b679SAndreas Boehler            }
118a1a3b679SAndreas Boehler
119a1a3b679SAndreas Boehler            $calendars[] = $calendar;
120a1a3b679SAndreas Boehler
121a1a3b679SAndreas Boehler        }
122*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'Calendars returned: '.count($calendars), __FILE__, __LINE__);
123a1a3b679SAndreas Boehler        return $calendars;
124a1a3b679SAndreas Boehler
125a1a3b679SAndreas Boehler    }
126a1a3b679SAndreas Boehler
127a1a3b679SAndreas Boehler    /**
128a1a3b679SAndreas Boehler     * Creates a new calendar for a principal.
129a1a3b679SAndreas Boehler     *
130a1a3b679SAndreas Boehler     * If the creation was a success, an id must be returned that can be used
131a1a3b679SAndreas Boehler     * to reference this calendar in other methods, such as updateCalendar.
132a1a3b679SAndreas Boehler     *
133a1a3b679SAndreas Boehler     * @param string $principalUri
134a1a3b679SAndreas Boehler     * @param string $calendarUri
135a1a3b679SAndreas Boehler     * @param array $properties
136a1a3b679SAndreas Boehler     * @return string
137a1a3b679SAndreas Boehler     */
138d5703f5aSAndreas Boehler    function createCalendar($principalUri, $calendarUri, array $properties)
139d5703f5aSAndreas Boehler    {
140*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'createCalendar called, returning false', __FILE__, __LINE__);
141a1a3b679SAndreas Boehler        return false;
142a1a3b679SAndreas Boehler    }
143a1a3b679SAndreas Boehler
144a1a3b679SAndreas Boehler    /**
145a1a3b679SAndreas Boehler     * Updates properties for a calendar.
146a1a3b679SAndreas Boehler     *
147a1a3b679SAndreas Boehler     * The list of mutations is stored in a Sabre\DAV\PropPatch object.
148a1a3b679SAndreas Boehler     * To do the actual updates, you must tell this object which properties
149a1a3b679SAndreas Boehler     * you're going to process with the handle() method.
150a1a3b679SAndreas Boehler     *
151a1a3b679SAndreas Boehler     * Calling the handle method is like telling the PropPatch object "I
152a1a3b679SAndreas Boehler     * promise I can handle updating this property".
153a1a3b679SAndreas Boehler     *
154a1a3b679SAndreas Boehler     * Read the PropPatch documenation for more info and examples.
155a1a3b679SAndreas Boehler     *
156a1a3b679SAndreas Boehler     * @param string $calendarId
157a1a3b679SAndreas Boehler     * @param \Sabre\DAV\PropPatch $propPatch
158a1a3b679SAndreas Boehler     * @return void
159a1a3b679SAndreas Boehler     */
160d5703f5aSAndreas Boehler    function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch)
161d5703f5aSAndreas Boehler    {
162*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'updateCalendar for calendarId '.$calendarId, __FILE__, __LINE__);
163a1a3b679SAndreas Boehler        $supportedProperties = array_keys($this->propertyMap);
164a1a3b679SAndreas Boehler
165d5703f5aSAndreas Boehler        $propPatch->handle($supportedProperties, function($mutations) use ($calendarId)
166d5703f5aSAndreas Boehler        {
167d5703f5aSAndreas Boehler            foreach ($mutations as $propertyName => $propertyValue)
168d5703f5aSAndreas Boehler            {
169a1a3b679SAndreas Boehler
170d5703f5aSAndreas Boehler                switch ($propertyName)
171d5703f5aSAndreas Boehler                {
172d5703f5aSAndreas Boehler                    case '{DAV:}displayname' :
173*c42afaebSscottleechua                        \dokuwiki\Logger::debug('DAVCAL', 'updateCalendarName', __FILE__, __LINE__);
174d5703f5aSAndreas Boehler                        $this->hlp->updateCalendarName($calendarId, $propertyValue);
175d5703f5aSAndreas Boehler                        break;
176d5703f5aSAndreas Boehler                    case '{urn:ietf:params:xml:ns:caldav}calendar-description':
177*c42afaebSscottleechua                        \dokuwiki\Logger::debug('DAVCAL', 'updateCalendarDescription', __FILE__, __LINE__);
178d5703f5aSAndreas Boehler                        $this->hlp->updateCalendarDescription($calendarId, $propertyValue);
179d5703f5aSAndreas Boehler                        break;
180d5703f5aSAndreas Boehler                    case '{urn:ietf:params:xml:ns:caldav}calendar-timezone':
181*c42afaebSscottleechua                        \dokuwiki\Logger::debug('DAVCAL', 'updateCalendarTimezone', __FILE__, __LINE__);
182d5703f5aSAndreas Boehler                        $this->hlp->updateCalendarTimezone($calendarId, $propertyValue);
183a1a3b679SAndreas Boehler                        break;
184a1a3b679SAndreas Boehler                    default :
185a1a3b679SAndreas Boehler                        break;
186a1a3b679SAndreas Boehler                }
187a1a3b679SAndreas Boehler
188a1a3b679SAndreas Boehler            }
189a1a3b679SAndreas Boehler            return true;
190a1a3b679SAndreas Boehler
191a1a3b679SAndreas Boehler        });
192a1a3b679SAndreas Boehler
193a1a3b679SAndreas Boehler    }
194a1a3b679SAndreas Boehler
195a1a3b679SAndreas Boehler    /**
196a1a3b679SAndreas Boehler     * Delete a calendar and all it's objects
197a1a3b679SAndreas Boehler     *
198a1a3b679SAndreas Boehler     * @param string $calendarId
199a1a3b679SAndreas Boehler     * @return void
200a1a3b679SAndreas Boehler     */
201d5703f5aSAndreas Boehler    function deleteCalendar($calendarId)
202d5703f5aSAndreas Boehler    {
203*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'deleteCalendar called, returning false', __FILE__, __LINE__);
204d5703f5aSAndreas Boehler        return;
205a1a3b679SAndreas Boehler    }
206a1a3b679SAndreas Boehler
207a1a3b679SAndreas Boehler    /**
208a1a3b679SAndreas Boehler     * Returns all calendar objects within a calendar.
209a1a3b679SAndreas Boehler     *
210a1a3b679SAndreas Boehler     * Every item contains an array with the following keys:
211a1a3b679SAndreas Boehler     *   * calendardata - The iCalendar-compatible calendar data
212a1a3b679SAndreas Boehler     *   * uri - a unique key which will be used to construct the uri. This can
213a1a3b679SAndreas Boehler     *     be any arbitrary string, but making sure it ends with '.ics' is a
214a1a3b679SAndreas Boehler     *     good idea. This is only the basename, or filename, not the full
215a1a3b679SAndreas Boehler     *     path.
216a1a3b679SAndreas Boehler     *   * lastmodified - a timestamp of the last modification time
217a1a3b679SAndreas Boehler     *   * etag - An arbitrary string, surrounded by double-quotes. (e.g.:
218a1a3b679SAndreas Boehler     *   '  "abcdef"')
219a1a3b679SAndreas Boehler     *   * size - The size of the calendar objects, in bytes.
220a1a3b679SAndreas Boehler     *   * component - optional, a string containing the type of object, such
221a1a3b679SAndreas Boehler     *     as 'vevent' or 'vtodo'. If specified, this will be used to populate
222a1a3b679SAndreas Boehler     *     the Content-Type header.
223a1a3b679SAndreas Boehler     *
224a1a3b679SAndreas Boehler     * Note that the etag is optional, but it's highly encouraged to return for
225a1a3b679SAndreas Boehler     * speed reasons.
226a1a3b679SAndreas Boehler     *
227a1a3b679SAndreas Boehler     * The calendardata is also optional. If it's not returned
228a1a3b679SAndreas Boehler     * 'getCalendarObject' will be called later, which *is* expected to return
229a1a3b679SAndreas Boehler     * calendardata.
230a1a3b679SAndreas Boehler     *
231a1a3b679SAndreas Boehler     * If neither etag or size are specified, the calendardata will be
232a1a3b679SAndreas Boehler     * used/fetched to determine these numbers. If both are specified the
233a1a3b679SAndreas Boehler     * amount of times this is needed is reduced by a great degree.
234a1a3b679SAndreas Boehler     *
235a1a3b679SAndreas Boehler     * @param string $calendarId
236a1a3b679SAndreas Boehler     * @return array
237a1a3b679SAndreas Boehler     */
238d5703f5aSAndreas Boehler    function getCalendarObjects($calendarId)
239d5703f5aSAndreas Boehler    {
240*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'getCalendarObjects for calendarId '.$calendarId, __FILE__, __LINE__);
241d5703f5aSAndreas Boehler        $arr = $this->hlp->getCalendarObjects($calendarId);
242d5703f5aSAndreas Boehler        $result = array();
243d5703f5aSAndreas Boehler        foreach ($arr as $row)
244d5703f5aSAndreas Boehler        {
245d5703f5aSAndreas Boehler            $result[] = array(
246a1a3b679SAndreas Boehler                'id'           => $row['id'],
247a1a3b679SAndreas Boehler                'uri'          => $row['uri'],
248a1a3b679SAndreas Boehler                'lastmodified' => $row['lastmodified'],
249a1a3b679SAndreas Boehler                'etag'         => '"' . $row['etag'] . '"',
250a1a3b679SAndreas Boehler                'calendarid'   => $row['calendarid'],
251a1a3b679SAndreas Boehler                'size'         => (int)$row['size'],
252a1a3b679SAndreas Boehler                'component'    => strtolower($row['componenttype']),
253d5703f5aSAndreas Boehler            );
254a1a3b679SAndreas Boehler        }
255*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'Calendar objects returned: '.count($result), __FILE__, __LINE__);
256a1a3b679SAndreas Boehler        return $result;
257a1a3b679SAndreas Boehler
258a1a3b679SAndreas Boehler    }
259a1a3b679SAndreas Boehler
260a1a3b679SAndreas Boehler    /**
261a1a3b679SAndreas Boehler     * Returns information from a single calendar object, based on it's object
262a1a3b679SAndreas Boehler     * uri.
263a1a3b679SAndreas Boehler     *
264a1a3b679SAndreas Boehler     * The object uri is only the basename, or filename and not a full path.
265a1a3b679SAndreas Boehler     *
266a1a3b679SAndreas Boehler     * The returned array must have the same keys as getCalendarObjects. The
267a1a3b679SAndreas Boehler     * 'calendardata' object is required here though, while it's not required
268a1a3b679SAndreas Boehler     * for getCalendarObjects.
269a1a3b679SAndreas Boehler     *
270a1a3b679SAndreas Boehler     * This method must return null if the object did not exist.
271a1a3b679SAndreas Boehler     *
272a1a3b679SAndreas Boehler     * @param string $calendarId
273a1a3b679SAndreas Boehler     * @param string $objectUri
274a1a3b679SAndreas Boehler     * @return array|null
275a1a3b679SAndreas Boehler     */
276d5703f5aSAndreas Boehler    function getCalendarObject($calendarId, $objectUri)
277d5703f5aSAndreas Boehler    {
278*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'getCalendarObject for calendarId '.$calendarId.' and objectUri '.$objectUri, __FILE__, __LINE__);
279d5703f5aSAndreas Boehler        $row = $this->hlp->getCalendarObjectByUri($calendarId, $objectUri);
280*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'Calendar object row: '.($row ? 'found' : 'not found'), __FILE__, __LINE__);
281d5703f5aSAndreas Boehler        if (!$row)
282d5703f5aSAndreas Boehler            return null;
283a1a3b679SAndreas Boehler
284d5703f5aSAndreas Boehler        return array(
285a1a3b679SAndreas Boehler            'id'            => $row['id'],
286a1a3b679SAndreas Boehler            'uri'           => $row['uri'],
287a1a3b679SAndreas Boehler            'lastmodified'  => $row['lastmodified'],
288a1a3b679SAndreas Boehler            'etag'          => '"' . $row['etag'] . '"',
289a1a3b679SAndreas Boehler            'calendarid'    => $row['calendarid'],
290a1a3b679SAndreas Boehler            'size'          => (int)$row['size'],
291a1a3b679SAndreas Boehler            'calendardata'  => $row['calendardata'],
292a1a3b679SAndreas Boehler            'component'     => strtolower($row['componenttype']),
293d5703f5aSAndreas Boehler         );
294a1a3b679SAndreas Boehler
295a1a3b679SAndreas Boehler    }
296a1a3b679SAndreas Boehler
297a1a3b679SAndreas Boehler    /**
298a1a3b679SAndreas Boehler     * Returns a list of calendar objects.
299a1a3b679SAndreas Boehler     *
300a1a3b679SAndreas Boehler     * This method should work identical to getCalendarObject, but instead
301a1a3b679SAndreas Boehler     * return all the calendar objects in the list as an array.
302a1a3b679SAndreas Boehler     *
303a1a3b679SAndreas Boehler     * If the backend supports this, it may allow for some speed-ups.
304a1a3b679SAndreas Boehler     *
305a1a3b679SAndreas Boehler     * @param mixed $calendarId
306a1a3b679SAndreas Boehler     * @param array $uris
307a1a3b679SAndreas Boehler     * @return array
308a1a3b679SAndreas Boehler     */
309d5703f5aSAndreas Boehler    function getMultipleCalendarObjects($calendarId, array $uris)
310d5703f5aSAndreas Boehler    {
311*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'getMultipleCalendarObjects for calendarId '.$calendarId, __FILE__, __LINE__);
312*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'URIs requested: '.count($uris), __FILE__, __LINE__);
313d5703f5aSAndreas Boehler        $arr = $this->hlp->getMultipleCalendarObjectsByUri($calendarId, $uris);
314a1a3b679SAndreas Boehler
315d5703f5aSAndreas Boehler        $result = array();
316d5703f5aSAndreas Boehler        foreach($arr as $row)
317d5703f5aSAndreas Boehler        {
318a1a3b679SAndreas Boehler
319d5703f5aSAndreas Boehler            $result[] = array(
320a1a3b679SAndreas Boehler                'id'           => $row['id'],
321a1a3b679SAndreas Boehler                'uri'          => $row['uri'],
322a1a3b679SAndreas Boehler                'lastmodified' => $row['lastmodified'],
323a1a3b679SAndreas Boehler                'etag'         => '"' . $row['etag'] . '"',
324a1a3b679SAndreas Boehler                'calendarid'   => $row['calendarid'],
325a1a3b679SAndreas Boehler                'size'         => (int)$row['size'],
326a1a3b679SAndreas Boehler                'calendardata' => $row['calendardata'],
327a1a3b679SAndreas Boehler                'component'    => strtolower($row['componenttype']),
328d5703f5aSAndreas Boehler            );
329a1a3b679SAndreas Boehler
330a1a3b679SAndreas Boehler        }
331*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'Multiple calendar objects returned: '.count($result), __FILE__, __LINE__);
332a1a3b679SAndreas Boehler        return $result;
333a1a3b679SAndreas Boehler
334a1a3b679SAndreas Boehler    }
335a1a3b679SAndreas Boehler
336a1a3b679SAndreas Boehler
337a1a3b679SAndreas Boehler    /**
338a1a3b679SAndreas Boehler     * Creates a new calendar object.
339a1a3b679SAndreas Boehler     *
340a1a3b679SAndreas Boehler     * The object uri is only the basename, or filename and not a full path.
341a1a3b679SAndreas Boehler     *
342a1a3b679SAndreas Boehler     * It is possible return an etag from this function, which will be used in
343a1a3b679SAndreas Boehler     * the response to this PUT request. Note that the ETag must be surrounded
344a1a3b679SAndreas Boehler     * by double-quotes.
345a1a3b679SAndreas Boehler     *
346a1a3b679SAndreas Boehler     * However, you should only really return this ETag if you don't mangle the
347a1a3b679SAndreas Boehler     * calendar-data. If the result of a subsequent GET to this object is not
348a1a3b679SAndreas Boehler     * the exact same as this request body, you should omit the ETag.
349a1a3b679SAndreas Boehler     *
350a1a3b679SAndreas Boehler     * @param mixed $calendarId
351a1a3b679SAndreas Boehler     * @param string $objectUri
352a1a3b679SAndreas Boehler     * @param string $calendarData
353a1a3b679SAndreas Boehler     * @return string|null
354a1a3b679SAndreas Boehler     */
355d5703f5aSAndreas Boehler    function createCalendarObject($calendarId, $objectUri, $calendarData)
356d5703f5aSAndreas Boehler    {
357*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'createCalendarObject for calendarId '.$calendarId.' and objectUri '.$objectUri, __FILE__, __LINE__);
358*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'Calendar data length: '.strlen($calendarData), __FILE__, __LINE__);
359d5703f5aSAndreas Boehler        $etag = $this->hlp->addCalendarEntryToCalendarByICS($calendarId, $objectUri, $calendarData);
360*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'ETag generated: '.$etag, __FILE__, __LINE__);
361a1a3b679SAndreas Boehler
362d5703f5aSAndreas Boehler        return '"' . $etag . '"';
363a1a3b679SAndreas Boehler    }
364a1a3b679SAndreas Boehler
365a1a3b679SAndreas Boehler    /**
366a1a3b679SAndreas Boehler     * Updates an existing calendarobject, based on it's uri.
367a1a3b679SAndreas Boehler     *
368a1a3b679SAndreas Boehler     * The object uri is only the basename, or filename and not a full path.
369a1a3b679SAndreas Boehler     *
370a1a3b679SAndreas Boehler     * It is possible return an etag from this function, which will be used in
371a1a3b679SAndreas Boehler     * the response to this PUT request. Note that the ETag must be surrounded
372a1a3b679SAndreas Boehler     * by double-quotes.
373a1a3b679SAndreas Boehler     *
374a1a3b679SAndreas Boehler     * However, you should only really return this ETag if you don't mangle the
375a1a3b679SAndreas Boehler     * calendar-data. If the result of a subsequent GET to this object is not
376a1a3b679SAndreas Boehler     * the exact same as this request body, you should omit the ETag.
377a1a3b679SAndreas Boehler     *
378a1a3b679SAndreas Boehler     * @param mixed $calendarId
379a1a3b679SAndreas Boehler     * @param string $objectUri
380a1a3b679SAndreas Boehler     * @param string $calendarData
381a1a3b679SAndreas Boehler     * @return string|null
382a1a3b679SAndreas Boehler     */
383d5703f5aSAndreas Boehler    function updateCalendarObject($calendarId, $objectUri, $calendarData)
384d5703f5aSAndreas Boehler    {
385*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'updateCalendarObject for calendarId '.$calendarId.' and objectUri '.$objectUri, __FILE__, __LINE__);
386*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'Calendar data length: '.strlen($calendarData), __FILE__, __LINE__);
387d5703f5aSAndreas Boehler        $etag = $this->hlp->editCalendarEntryToCalendarByICS($calendarId, $objectUri, $calendarData);
388*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'ETag generated: '.$etag, __FILE__, __LINE__);
389d5703f5aSAndreas Boehler        return '"' . $etag. '"';
390a1a3b679SAndreas Boehler
391a1a3b679SAndreas Boehler    }
392a1a3b679SAndreas Boehler
393a1a3b679SAndreas Boehler
394a1a3b679SAndreas Boehler
395a1a3b679SAndreas Boehler    /**
396a1a3b679SAndreas Boehler     * Deletes an existing calendar object.
397a1a3b679SAndreas Boehler     *
398a1a3b679SAndreas Boehler     * The object uri is only the basename, or filename and not a full path.
399a1a3b679SAndreas Boehler     *
400a1a3b679SAndreas Boehler     * @param string $calendarId
401a1a3b679SAndreas Boehler     * @param string $objectUri
402a1a3b679SAndreas Boehler     * @return void
403a1a3b679SAndreas Boehler     */
404d5703f5aSAndreas Boehler    function deleteCalendarObject($calendarId, $objectUri)
405d5703f5aSAndreas Boehler    {
406*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'deleteCalendarObject for calendarId '.$calendarId.' and objectUri '.$objectUri, __FILE__, __LINE__);
407d5703f5aSAndreas Boehler        $this->hlp->deleteCalendarEntryForCalendarByUri($calendarId, $objectUri);
408a1a3b679SAndreas Boehler
409a1a3b679SAndreas Boehler    }
410a1a3b679SAndreas Boehler
411a1a3b679SAndreas Boehler    /**
412a1a3b679SAndreas Boehler     * Performs a calendar-query on the contents of this calendar.
413a1a3b679SAndreas Boehler     *
414a1a3b679SAndreas Boehler     * The calendar-query is defined in RFC4791 : CalDAV. Using the
415a1a3b679SAndreas Boehler     * calendar-query it is possible for a client to request a specific set of
416a1a3b679SAndreas Boehler     * object, based on contents of iCalendar properties, date-ranges and
417a1a3b679SAndreas Boehler     * iCalendar component types (VTODO, VEVENT).
418a1a3b679SAndreas Boehler     *
419a1a3b679SAndreas Boehler     * This method should just return a list of (relative) urls that match this
420a1a3b679SAndreas Boehler     * query.
421a1a3b679SAndreas Boehler     *
422a1a3b679SAndreas Boehler     * The list of filters are specified as an array. The exact array is
423a1a3b679SAndreas Boehler     * documented by \Sabre\CalDAV\CalendarQueryParser.
424a1a3b679SAndreas Boehler     *
425a1a3b679SAndreas Boehler     * Note that it is extremely likely that getCalendarObject for every path
426a1a3b679SAndreas Boehler     * returned from this method will be called almost immediately after. You
427a1a3b679SAndreas Boehler     * may want to anticipate this to speed up these requests.
428a1a3b679SAndreas Boehler     *
429a1a3b679SAndreas Boehler     * This method provides a default implementation, which parses *all* the
430a1a3b679SAndreas Boehler     * iCalendar objects in the specified calendar.
431a1a3b679SAndreas Boehler     *
432a1a3b679SAndreas Boehler     * This default may well be good enough for personal use, and calendars
433a1a3b679SAndreas Boehler     * that aren't very large. But if you anticipate high usage, big calendars
434a1a3b679SAndreas Boehler     * or high loads, you are strongly adviced to optimize certain paths.
435a1a3b679SAndreas Boehler     *
436a1a3b679SAndreas Boehler     * The best way to do so is override this method and to optimize
437a1a3b679SAndreas Boehler     * specifically for 'common filters'.
438a1a3b679SAndreas Boehler     *
439a1a3b679SAndreas Boehler     * Requests that are extremely common are:
440a1a3b679SAndreas Boehler     *   * requests for just VEVENTS
441a1a3b679SAndreas Boehler     *   * requests for just VTODO
442a1a3b679SAndreas Boehler     *   * requests with a time-range-filter on a VEVENT.
443a1a3b679SAndreas Boehler     *
444a1a3b679SAndreas Boehler     * ..and combinations of these requests. It may not be worth it to try to
445a1a3b679SAndreas Boehler     * handle every possible situation and just rely on the (relatively
446a1a3b679SAndreas Boehler     * easy to use) CalendarQueryValidator to handle the rest.
447a1a3b679SAndreas Boehler     *
448a1a3b679SAndreas Boehler     * Note that especially time-range-filters may be difficult to parse. A
449a1a3b679SAndreas Boehler     * time-range filter specified on a VEVENT must for instance also handle
450a1a3b679SAndreas Boehler     * recurrence rules correctly.
451a1a3b679SAndreas Boehler     * A good example of how to interprete all these filters can also simply
452a1a3b679SAndreas Boehler     * be found in \Sabre\CalDAV\CalendarQueryFilter. This class is as correct
453a1a3b679SAndreas Boehler     * as possible, so it gives you a good idea on what type of stuff you need
454a1a3b679SAndreas Boehler     * to think of.
455a1a3b679SAndreas Boehler     *
456a1a3b679SAndreas Boehler     * This specific implementation (for the PDO) backend optimizes filters on
457a1a3b679SAndreas Boehler     * specific components, and VEVENT time-ranges.
458a1a3b679SAndreas Boehler     *
459a1a3b679SAndreas Boehler     * @param string $calendarId
460a1a3b679SAndreas Boehler     * @param array $filters
461a1a3b679SAndreas Boehler     * @return array
462a1a3b679SAndreas Boehler     */
463d5703f5aSAndreas Boehler    function calendarQuery($calendarId, array $filters)
464d5703f5aSAndreas Boehler    {
465*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'calendarQuery for calendarId '.$calendarId, __FILE__, __LINE__);
466*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'Filters count: '.count($filters), __FILE__, __LINE__);
467d5703f5aSAndreas Boehler        $result = $this->hlp->calendarQuery($calendarId, $filters);
468*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'Query results: '.count($result), __FILE__, __LINE__);
469a1a3b679SAndreas Boehler        return $result;
470a1a3b679SAndreas Boehler    }
471a1a3b679SAndreas Boehler
472a1a3b679SAndreas Boehler    /**
473a1a3b679SAndreas Boehler     * Searches through all of a users calendars and calendar objects to find
474a1a3b679SAndreas Boehler     * an object with a specific UID.
475a1a3b679SAndreas Boehler     *
476a1a3b679SAndreas Boehler     * This method should return the path to this object, relative to the
477a1a3b679SAndreas Boehler     * calendar home, so this path usually only contains two parts:
478a1a3b679SAndreas Boehler     *
479a1a3b679SAndreas Boehler     * calendarpath/objectpath.ics
480a1a3b679SAndreas Boehler     *
481a1a3b679SAndreas Boehler     * If the uid is not found, return null.
482a1a3b679SAndreas Boehler     *
483a1a3b679SAndreas Boehler     * This method should only consider * objects that the principal owns, so
484a1a3b679SAndreas Boehler     * any calendars owned by other principals that also appear in this
485a1a3b679SAndreas Boehler     * collection should be ignored.
486a1a3b679SAndreas Boehler     *
487a1a3b679SAndreas Boehler     * @param string $principalUri
488a1a3b679SAndreas Boehler     * @param string $uid
489a1a3b679SAndreas Boehler     * @return string|null
490a1a3b679SAndreas Boehler     */
491d5703f5aSAndreas Boehler    function getCalendarObjectByUID($principalUri, $uid)
492d5703f5aSAndreas Boehler    {
493*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'getCalendarObjectByUID for principalUri '.$principalUri.' and uid '.$uid, __FILE__, __LINE__);
494d5703f5aSAndreas Boehler        $calids = array_keys($this->hlp->getCalendarIsForUser($principalUri));
495d5703f5aSAndreas Boehler        $event = $this->hlp->getEventWithUid($uid);
496a1a3b679SAndreas Boehler
497d5703f5aSAndreas Boehler        if(in_array($event['calendarid'], $calids))
498d5703f5aSAndreas Boehler        {
499d5703f5aSAndreas Boehler            $settings = $this->hlp->getCalendarSettings($event['calendarid']);
500d5703f5aSAndreas Boehler            return $settings['uri'] . '/' . $event['uri'];
501a1a3b679SAndreas Boehler        }
502d5703f5aSAndreas Boehler        return null;
503a1a3b679SAndreas Boehler    }
504a1a3b679SAndreas Boehler
505a1a3b679SAndreas Boehler    /**
506a1a3b679SAndreas Boehler     * The getChanges method returns all the changes that have happened, since
507a1a3b679SAndreas Boehler     * the specified syncToken in the specified calendar.
508a1a3b679SAndreas Boehler     *
509a1a3b679SAndreas Boehler     * This function should return an array, such as the following:
510a1a3b679SAndreas Boehler     *
511a1a3b679SAndreas Boehler     * [
512a1a3b679SAndreas Boehler     *   'syncToken' => 'The current synctoken',
513a1a3b679SAndreas Boehler     *   'added'   => [
514a1a3b679SAndreas Boehler     *      'new.txt',
515a1a3b679SAndreas Boehler     *   ],
516a1a3b679SAndreas Boehler     *   'modified'   => [
517a1a3b679SAndreas Boehler     *      'modified.txt',
518a1a3b679SAndreas Boehler     *   ],
519a1a3b679SAndreas Boehler     *   'deleted' => [
520a1a3b679SAndreas Boehler     *      'foo.php.bak',
521a1a3b679SAndreas Boehler     *      'old.txt'
522a1a3b679SAndreas Boehler     *   ]
523a1a3b679SAndreas Boehler     * ];
524a1a3b679SAndreas Boehler     *
525a1a3b679SAndreas Boehler     * The returned syncToken property should reflect the *current* syncToken
526a1a3b679SAndreas Boehler     * of the calendar, as reported in the {http://sabredav.org/ns}sync-token
527a1a3b679SAndreas Boehler     * property this is needed here too, to ensure the operation is atomic.
528a1a3b679SAndreas Boehler     *
529a1a3b679SAndreas Boehler     * If the $syncToken argument is specified as null, this is an initial
530a1a3b679SAndreas Boehler     * sync, and all members should be reported.
531a1a3b679SAndreas Boehler     *
532a1a3b679SAndreas Boehler     * The modified property is an array of nodenames that have changed since
533a1a3b679SAndreas Boehler     * the last token.
534a1a3b679SAndreas Boehler     *
535a1a3b679SAndreas Boehler     * The deleted property is an array with nodenames, that have been deleted
536a1a3b679SAndreas Boehler     * from collection.
537a1a3b679SAndreas Boehler     *
538a1a3b679SAndreas Boehler     * The $syncLevel argument is basically the 'depth' of the report. If it's
539a1a3b679SAndreas Boehler     * 1, you only have to report changes that happened only directly in
540a1a3b679SAndreas Boehler     * immediate descendants. If it's 2, it should also include changes from
541a1a3b679SAndreas Boehler     * the nodes below the child collections. (grandchildren)
542a1a3b679SAndreas Boehler     *
543a1a3b679SAndreas Boehler     * The $limit argument allows a client to specify how many results should
544a1a3b679SAndreas Boehler     * be returned at most. If the limit is not specified, it should be treated
545a1a3b679SAndreas Boehler     * as infinite.
546a1a3b679SAndreas Boehler     *
547a1a3b679SAndreas Boehler     * If the limit (infinite or not) is higher than you're willing to return,
548a1a3b679SAndreas Boehler     * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception.
549a1a3b679SAndreas Boehler     *
550a1a3b679SAndreas Boehler     * If the syncToken is expired (due to data cleanup) or unknown, you must
551a1a3b679SAndreas Boehler     * return null.
552a1a3b679SAndreas Boehler     *
553a1a3b679SAndreas Boehler     * The limit is 'suggestive'. You are free to ignore it.
554a1a3b679SAndreas Boehler     *
555a1a3b679SAndreas Boehler     * @param string $calendarId
556a1a3b679SAndreas Boehler     * @param string $syncToken
557a1a3b679SAndreas Boehler     * @param int $syncLevel
558a1a3b679SAndreas Boehler     * @param int $limit
559a1a3b679SAndreas Boehler     * @return array
560a1a3b679SAndreas Boehler     */
561d5703f5aSAndreas Boehler    function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null)
562d5703f5aSAndreas Boehler    {
563*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'getChangesForCalendar for calendarId '.$calendarId.' and syncToken '.$syncToken.' and syncLevel '.$syncLevel, __FILE__, __LINE__);
564d5703f5aSAndreas Boehler        $result = $this->hlp->getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit);
565*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'Changes result: '.($result ? 'found' : 'not found'), __FILE__, __LINE__);
566a1a3b679SAndreas Boehler        return $result;
567a1a3b679SAndreas Boehler    }
568a1a3b679SAndreas Boehler
569a1a3b679SAndreas Boehler    /**
570a1a3b679SAndreas Boehler     * Returns a list of subscriptions for a principal.
571a1a3b679SAndreas Boehler     *
572a1a3b679SAndreas Boehler     * Every subscription is an array with the following keys:
573a1a3b679SAndreas Boehler     *  * id, a unique id that will be used by other functions to modify the
574a1a3b679SAndreas Boehler     *    subscription. This can be the same as the uri or a database key.
575a1a3b679SAndreas Boehler     *  * uri. This is just the 'base uri' or 'filename' of the subscription.
576a1a3b679SAndreas Boehler     *  * principaluri. The owner of the subscription. Almost always the same as
577a1a3b679SAndreas Boehler     *    principalUri passed to this method.
578a1a3b679SAndreas Boehler     *  * source. Url to the actual feed
579a1a3b679SAndreas Boehler     *
580a1a3b679SAndreas Boehler     * Furthermore, all the subscription info must be returned too:
581a1a3b679SAndreas Boehler     *
582a1a3b679SAndreas Boehler     * 1. {DAV:}displayname
583a1a3b679SAndreas Boehler     * 2. {http://apple.com/ns/ical/}refreshrate
584a1a3b679SAndreas Boehler     * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos
585a1a3b679SAndreas Boehler     *    should not be stripped).
586a1a3b679SAndreas Boehler     * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms
587a1a3b679SAndreas Boehler     *    should not be stripped).
588a1a3b679SAndreas Boehler     * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if
589a1a3b679SAndreas Boehler     *    attachments should not be stripped).
590a1a3b679SAndreas Boehler     * 7. {http://apple.com/ns/ical/}calendar-color
591a1a3b679SAndreas Boehler     * 8. {http://apple.com/ns/ical/}calendar-order
592a1a3b679SAndreas Boehler     * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
593a1a3b679SAndreas Boehler     *    (should just be an instance of
594a1a3b679SAndreas Boehler     *    Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of
595a1a3b679SAndreas Boehler     *    default components).
596a1a3b679SAndreas Boehler     *
597a1a3b679SAndreas Boehler     * @param string $principalUri
598a1a3b679SAndreas Boehler     * @return array
599a1a3b679SAndreas Boehler     */
600d5703f5aSAndreas Boehler    function getSubscriptionsForUser($principalUri)
601d5703f5aSAndreas Boehler    {
602*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'getSubscriptionsForUser with principalUri '.$principalUri.', returning empty array()', __FILE__, __LINE__);
603d5703f5aSAndreas Boehler        return array();
604a1a3b679SAndreas Boehler
605a1a3b679SAndreas Boehler    }
606a1a3b679SAndreas Boehler
607a1a3b679SAndreas Boehler    /**
608a1a3b679SAndreas Boehler     * Creates a new subscription for a principal.
609a1a3b679SAndreas Boehler     *
610a1a3b679SAndreas Boehler     * If the creation was a success, an id must be returned that can be used to reference
611a1a3b679SAndreas Boehler     * this subscription in other methods, such as updateSubscription.
612a1a3b679SAndreas Boehler     *
613a1a3b679SAndreas Boehler     * @param string $principalUri
614a1a3b679SAndreas Boehler     * @param string $uri
615a1a3b679SAndreas Boehler     * @param array $properties
616a1a3b679SAndreas Boehler     * @return mixed
617a1a3b679SAndreas Boehler     */
618d5703f5aSAndreas Boehler    function createSubscription($principalUri, $uri, array $properties)
619d5703f5aSAndreas Boehler    {
620*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'createSubscription for principalUri '.$principalUri.' and uri '.$uri.', returning null', __FILE__, __LINE__);
621d5703f5aSAndreas Boehler        return null;
622a1a3b679SAndreas Boehler
623a1a3b679SAndreas Boehler    }
624a1a3b679SAndreas Boehler
625a1a3b679SAndreas Boehler    /**
626a1a3b679SAndreas Boehler     * Updates a subscription
627a1a3b679SAndreas Boehler     *
628a1a3b679SAndreas Boehler     * The list of mutations is stored in a Sabre\DAV\PropPatch object.
629a1a3b679SAndreas Boehler     * To do the actual updates, you must tell this object which properties
630a1a3b679SAndreas Boehler     * you're going to process with the handle() method.
631a1a3b679SAndreas Boehler     *
632a1a3b679SAndreas Boehler     * Calling the handle method is like telling the PropPatch object "I
633a1a3b679SAndreas Boehler     * promise I can handle updating this property".
634a1a3b679SAndreas Boehler     *
635a1a3b679SAndreas Boehler     * Read the PropPatch documenation for more info and examples.
636a1a3b679SAndreas Boehler     *
637a1a3b679SAndreas Boehler     * @param mixed $subscriptionId
638a1a3b679SAndreas Boehler     * @param \Sabre\DAV\PropPatch $propPatch
639a1a3b679SAndreas Boehler     * @return void
640a1a3b679SAndreas Boehler     */
641d5703f5aSAndreas Boehler    function updateSubscription($subscriptionId, DAV\PropPatch $propPatch)
642d5703f5aSAndreas Boehler    {
643*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'updateSubscription with subscriptionId '.$subscriptionId.', returning false', __FILE__, __LINE__);
644d5703f5aSAndreas Boehler        return;
645a1a3b679SAndreas Boehler    }
646a1a3b679SAndreas Boehler
647a1a3b679SAndreas Boehler    /**
648a1a3b679SAndreas Boehler     * Deletes a subscription
649a1a3b679SAndreas Boehler     *
650a1a3b679SAndreas Boehler     * @param mixed $subscriptionId
651a1a3b679SAndreas Boehler     * @return void
652a1a3b679SAndreas Boehler     */
653d5703f5aSAndreas Boehler    function deleteSubscription($subscriptionId)
654d5703f5aSAndreas Boehler    {
655*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'deleteSubscription with subscriptionId '.$subscriptionId.', returning', __FILE__, __LINE__);
656d5703f5aSAndreas Boehler        return;
657a1a3b679SAndreas Boehler
658a1a3b679SAndreas Boehler    }
659a1a3b679SAndreas Boehler
660a1a3b679SAndreas Boehler    /**
661a1a3b679SAndreas Boehler     * Returns a single scheduling object.
662a1a3b679SAndreas Boehler     *
663a1a3b679SAndreas Boehler     * The returned array should contain the following elements:
664a1a3b679SAndreas Boehler     *   * uri - A unique basename for the object. This will be used to
665a1a3b679SAndreas Boehler     *           construct a full uri.
666a1a3b679SAndreas Boehler     *   * calendardata - The iCalendar object
667a1a3b679SAndreas Boehler     *   * lastmodified - The last modification date. Can be an int for a unix
668a1a3b679SAndreas Boehler     *                    timestamp, or a PHP DateTime object.
669a1a3b679SAndreas Boehler     *   * etag - A unique token that must change if the object changed.
670a1a3b679SAndreas Boehler     *   * size - The size of the object, in bytes.
671a1a3b679SAndreas Boehler     *
672a1a3b679SAndreas Boehler     * @param string $principalUri
673a1a3b679SAndreas Boehler     * @param string $objectUri
674a1a3b679SAndreas Boehler     * @return array
675a1a3b679SAndreas Boehler     */
676d5703f5aSAndreas Boehler    function getSchedulingObject($principalUri, $objectUri)
677d5703f5aSAndreas Boehler    {
678*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'getSchedulingObject with principalUri '.$principalUri.' and objectUri '.$objectUri.', returning null', __FILE__, __LINE__);
679d5703f5aSAndreas Boehler        return null;
680a1a3b679SAndreas Boehler
681a1a3b679SAndreas Boehler    }
682a1a3b679SAndreas Boehler
683a1a3b679SAndreas Boehler    /**
684a1a3b679SAndreas Boehler     * Returns all scheduling objects for the inbox collection.
685a1a3b679SAndreas Boehler     *
686a1a3b679SAndreas Boehler     * These objects should be returned as an array. Every item in the array
687a1a3b679SAndreas Boehler     * should follow the same structure as returned from getSchedulingObject.
688a1a3b679SAndreas Boehler     *
689a1a3b679SAndreas Boehler     * The main difference is that 'calendardata' is optional.
690a1a3b679SAndreas Boehler     *
691a1a3b679SAndreas Boehler     * @param string $principalUri
692a1a3b679SAndreas Boehler     * @return array
693a1a3b679SAndreas Boehler     */
694d5703f5aSAndreas Boehler    function getSchedulingObjects($principalUri)
695d5703f5aSAndreas Boehler    {
696*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'getSchedulingObjects for principalUri '.$principalUri.', returning null', __FILE__, __LINE__);
697d5703f5aSAndreas Boehler        return null;
698a1a3b679SAndreas Boehler
699a1a3b679SAndreas Boehler    }
700a1a3b679SAndreas Boehler
701a1a3b679SAndreas Boehler    /**
702a1a3b679SAndreas Boehler     * Deletes a scheduling object
703a1a3b679SAndreas Boehler     *
704a1a3b679SAndreas Boehler     * @param string $principalUri
705a1a3b679SAndreas Boehler     * @param string $objectUri
706a1a3b679SAndreas Boehler     * @return void
707a1a3b679SAndreas Boehler     */
708d5703f5aSAndreas Boehler    function deleteSchedulingObject($principalUri, $objectUri)
709d5703f5aSAndreas Boehler    {
710*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'deleteSchedulingObject for principalUri '.$principalUri.' and objectUri '.$objectUri.', returning', __FILE__, __LINE__);
711d5703f5aSAndreas Boehler        return;
712a1a3b679SAndreas Boehler    }
713a1a3b679SAndreas Boehler
714a1a3b679SAndreas Boehler    /**
715a1a3b679SAndreas Boehler     * Creates a new scheduling object. This should land in a users' inbox.
716a1a3b679SAndreas Boehler     *
717a1a3b679SAndreas Boehler     * @param string $principalUri
718a1a3b679SAndreas Boehler     * @param string $objectUri
719a1a3b679SAndreas Boehler     * @param string $objectData
720a1a3b679SAndreas Boehler     * @return void
721a1a3b679SAndreas Boehler     */
722d5703f5aSAndreas Boehler    function createSchedulingObject($principalUri, $objectUri, $objectData)
723d5703f5aSAndreas Boehler    {
724*c42afaebSscottleechua        \dokuwiki\Logger::debug('DAVCAL', 'createSchedulingObject with principalUri '.$principalUri.' and objectUri '.$objectUri.', returning', __FILE__, __LINE__);
725d5703f5aSAndreas Boehler        return;
726a1a3b679SAndreas Boehler
727a1a3b679SAndreas Boehler    }
728a1a3b679SAndreas Boehler
729a1a3b679SAndreas Boehler}
730