Skip to content

Instantly share code, notes, and snippets.

@cedricziel
Forked from benjaminrau/EventController.php
Created August 28, 2013 15:57
Show Gist options
  • Save cedricziel/6367686 to your computer and use it in GitHub Desktop.
Save cedricziel/6367686 to your computer and use it in GitHub Desktop.
/**
* Init ICalendar Action
* Set Format to ICS
*/
public function initializeICalendarAction() {
$this->request->setFormat('ics');
}
/**
* action iCalendar
*
* @param \Codearts\Cevents\Domain\Model\Event $event
* @return void
*/
public function iCalendarAction(\Codearts\Cevents\Domain\Model\Event $event) {
$this->view->assign('event', $event);
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Codearts.' . $_EXTKEY,
'ICal',
array(
'Event' => 'iCalendar',
),
// non-cacheable actions
array(
'Event' => 'iCalendar',
)
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'ICal',
'CEvents'
);
{namespace v=Tx_Vhs_ViewHelpers}BEGIN:VCALENDAR
<v:format.trim>
VERSION:2.0
PRODID:-//Prisma//Event//EN
<f:render partial="Event/Item" arguments="{event:event}"/>
</v:format.trim>
{namespace v=Tx_Vhs_ViewHelpers}
BEGIN:VEVENT
SUMMARY:{event.title}
DESCRIPTION:<v:format.plaintext><f:format.stripTags>{event.preReport.description}</f:format.stripTags></v:format.plaintext>
DTSTAMP;TZID=Europe/Berlin:<f:format.date format="Ymd">{event.dtStart}</f:format.date>T<f:format.date format="His">{event.dtStart}</f:format.date>Z
<f:if condition="{event.dtEnd}">
DTSTART;TZID=Europe/Berlin:<f:format.date format="Ymd">{event.dtStart}</f:format.date>T<f:format.date format="His">{event.dtStart}</f:format.date>Z
DTEND;TZID=Europe/Berlin:<f:format.date format="Ymd">{event.dtEnd}</f:format.date>T<f:format.date format="His">{event.dtEnd}</f:format.date>Z
</f:if>
<f:if condition="{event.externalLocation}">
LOCATION:{event.externalLocation}
</f:if>
<f:if condition="{event.internalLocation}">
LOCATION:{event.internalLocation.title}
</f:if>
END:VEVENT
END:VCALENDAR
plugin.tx_cevents {
settings {
iCalendarViewPid = {$plugin.tx_cevents.settings.iCalendarViewPid}
}
[globalVar = TSFE:id = {$plugin.tx_cevents.settings.iCalendarViewPid}]
page >
page = PAGE
page.config {
no_cache = 1
disableAllHeaderCode = 1
xhtml_cleaning = none
admPanel = 0
disablePrefixComment = 1
metaCharset = utf-8
additionalHeaders = Content-Type:text/calendar;charset=utf-8
}
# render iCalendar for event
lib.icalendar = USER
lib.icalendar {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
pluginName = ICal
extensionName = Cevents
controller = Event
vendorName = Codearts
action = iCalendar
settings =< plugin.tx_cevents.settings
persistence =< plugin.tx_cevents.persistence
view =< plugin.tx_cevents.view
}
page.5 = COA
page.5 {
10 =< lib.icalendar
}
[global]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment