engelsystem/resources/views/api/ical.twig

29 lines
980 B
Twig

{% set dateFormat = 'Ymd\\THis\\Z' %}
{% set replacement = {'\\': '\\\\', ';': '\\;', ',': '\\,', '\n': '\\n'} %}
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//-/{{ config('app_name') | replace(replacement) | raw }}//DE
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
SUMMARY:{{ (entry.shift.shiftType.name ~ ' (' ~ entry.shift.title ~ ')') | replace(replacement) | raw }}
LOCATION:{{ entry.shift.room.name | replace(replacement) | raw }}
DESCRIPTION:{{
(
entry.shift.shiftType.description
~ '\n' ~ entry.shift.description
~ '\n' ~ entry.user_comment
)
| replace(replacement) | raw
}}
URL:{{ url('/shifts', {'action': 'view', 'shift_id': entry.shift.id}) | raw }}
END:VEVENT
{% endfor %}
END:VCALENDAR