You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: developer_manual/digging_deeper/groupware/calendar.rst
-87Lines changed: 0 additions & 87 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,93 +104,6 @@ The returned objects implement ``\OCP\Calendar\ICalendar``. Study the interface
104
104
105
105
.. note:: All calendars are by default only readable, therefore ``ICalendar`` does not offer methods for mutation. Some of the calendars are mutable, however, and they may further extend the interface ``\OCP\Calendar\ICreateFromString``.
106
106
107
-
.. _calendar-providers:
108
-
109
-
Calendar providers
110
-
------------------
111
-
112
-
Nextcloud apps can register calendars in addition to the internal calendars of the Nextcloud CalDAV back end. Calendars are only loaded on demand, therefore a lazy provider mechanism is used.
113
-
114
-
To provide calendar(s) you have to write a class that implements the ``ICalendarProvider`` interface.
115
-
116
-
.. code-block:: php
117
-
118
-
<?php
119
-
120
-
use OCP\Calendar\ICalendarProvider;
121
-
122
-
class CalendarProvider implements ICalendarProvider {
123
-
124
-
public function getCalendars(string $principalUri, array $calendarUris = []): array {
125
-
$calendars = [];
126
-
// TODO: Run app specific logic to find calendars that belong to
127
-
// $principalUri and fill $calendars
128
-
129
-
// The provider can simple return an empty array if there is not
130
-
// a single calendar for the principal URI
131
-
if (empty($calendars)) {
132
-
return [];
133
-
}
134
-
135
-
// Return instances of \OCP\Calendar\ICalendar
136
-
return $calendars;
137
-
}
138
-
}
139
-
140
-
This ``CalendarProvider`` class is then registered in the :ref:`register method of your Application class<Bootstrapping>` with ``$context->registerCalendarProvider(CalendarProvider::class);``.
141
-
142
-
143
-
Write support
144
-
~~~~~~~~~~~~~
145
-
146
-
Calendars that only return `ICalendar` are implicitly read-only. If your app's calendars can be written to, you may implement the ``ICreateFromString``. It will allow other apps to write calendar objects to the calendar by passing the raw iCalendar data as string.
147
-
148
-
.. code-block:: php
149
-
150
-
<?php
151
-
152
-
use OCP\Calendar\ICreateFromString;
153
-
154
-
class CalendarReadWrite implements ICreateFromString {
155
-
156
-
// ... other methods from ICalendar still have to be implemented ...
157
-
158
-
public function createFromString(string $name, string $calendarData): void {
159
-
// Write data to your calendar representation
160
-
}
161
-
162
-
}
163
-
164
-
Handling iMIP data
165
-
~~~~~~~~~~~~~~~~~~
166
-
167
-
You may implement the ``IHandleIMipMessage`` interface to process iMIP data you receive in a client and want to pass on for processing to the backend.
168
-
169
-
Please be aware that there are some security considerations to take into account. You can find more infomation on these and the conditions that have to be fulfilled for iMIP data to be processed in the `RFC <https://www.rfc-editor.org/rfc/rfc6047>`_
170
-
171
-
.. code-block:: php
172
-
173
-
<?php
174
-
175
-
use OCP\Calendar\IHandleIMipMessage;
176
-
177
-
class HandleIMipMessage implements IHandleIMipMessage {
178
-
179
-
public function handleIMipMessage(string $name, string $calendarData): void {
180
-
// Validation and write to your calendar representation
181
-
}
182
-
183
-
}
184
-
185
-
Access through CalDAV
186
-
~~~~~~~~~~~~~~~~~~~~~
187
-
188
-
.. versionadded:: 27
189
-
190
-
As with the built-in calendars, calendars provided by ``ICalendarProvider`` can be accessed using CalDAV. Therefore, permissions of the ``ICalendar`` are automatically mapped to the DAV object.
191
-
Write support is also supported. Please note that deleting entities is currently implemented by setting the entity to the canceled state and passing it to the ``createFromString`` method.
0 commit comments