engelsystem/resources/views/api/ical.twig

27 lines
889 B
Twig
Raw Normal View History

2023-01-29 00:46:51 +01:00
{% set dateFormat = 'Ymd\\THis\\Z' %}
{% set replacement = {'\n': '\\n'} %}
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//-/{{ config('app_name') }}//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