engelsystem/resources/views/api/ical.twig

29 lines
980 B
Twig
Raw Normal View History

2023-01-29 00:46:51 +01:00
{% set dateFormat = 'Ymd\\THis\\Z' %}
2023-06-04 23:10:56 +02:00
{% set replacement = {'\\': '\\\\', ';': '\\;', ',': '\\,', '\n': '\\n'} %}
2023-01-29 00:46:51 +01:00
BEGIN:VCALENDAR
VERSION:2.0
2023-06-04 23:10:56 +02:00
PRODID:-//-/{{ config('app_name') | replace(replacement) | raw }}//DE
2023-01-29 00:46:51 +01:00
CALSCALE:GREGORIAN
{% for entry in shiftEntries %}
BEGIN:VEVENT
UID:{{ uuidBy(entry.id, '54117') }}
DTSTAMP:{{ entry.shift.start.utc().format(dateFormat) }}
DTSTART:{{ entry.shift.start.utc().format(dateFormat) }}
DTEND:{{ entry.shift.end.utc().format(dateFormat) }}
STATUS:CONFIRMED
TRANSP:OPAQUE
2023-06-04 23:10:56 +02:00
SUMMARY:{{ (entry.shift.shiftType.name ~ ' (' ~ entry.shift.title ~ ')') | replace(replacement) | raw }}
2023-01-29 00:46:51 +01:00
LOCATION:{{ entry.shift.room.name | replace(replacement) | raw }}
DESCRIPTION:{{
2023-06-04 23:10:56 +02:00
(
entry.shift.shiftType.description
~ '\n' ~ entry.shift.description
~ '\n' ~ entry.user_comment
)
2023-01-29 00:46:51 +01:00
| replace(replacement) | raw
}}
URL:{{ url('/shifts', {'action': 'view', 'shift_id': entry.shift.id}) | raw }}
END:VEVENT
{% endfor %}
END:VCALENDAR