diff --git a/Classes/Domain/Model/Location.php b/Classes/Domain/Model/Location.php
index c5256841..d845ff99 100644
--- a/Classes/Domain/Model/Location.php
+++ b/Classes/Domain/Model/Location.php
@@ -256,4 +256,26 @@ public function setLatitude($latitude)
{
$this->latitude = $latitude;
}
+
+ /**
+ * Special getter to return the full address of the location
+ *
+ * @param string $separator
+ * @return string
+ */
+ public function getFullAddress(string $separator = '
'): string
+ {
+ $locationData = [];
+ $locationData[] = $this->getTitle();
+ $locationData[] = $this->getAddress();
+ $locationData[] = trim($this->getZip() . ' ' . $this->getCity());
+ $locationData[] = $this->getCountry();
+ $locationData = array_filter(
+ $locationData,
+ function ($value) {
+ return str_replace(' ', '', $value) !== '';
+ }
+ );
+ return implode($separator, $locationData);
+ }
}
diff --git a/Classes/ViewHelpers/Uri/OnlineCalendarViewHelper.php b/Classes/ViewHelpers/Uri/OnlineCalendarViewHelper.php
new file mode 100755
index 00000000..995a3458
--- /dev/null
+++ b/Classes/ViewHelpers/Uri/OnlineCalendarViewHelper.php
@@ -0,0 +1,139 @@
+registerArgument('type', 'string', 'The type of online calender', true, 'google');
+ $this->registerArgument('event', 'DERHANSEN\SfEventMgt\Domain\Model\Event', 'The event');
+ }
+
+ /**
+ * @param array $arguments
+ * @param \Closure $renderChildrenClosure
+ * @param RenderingContextInterface $renderingContext
+ * @return string
+ */
+ public static function renderStatic(
+ array $arguments,
+ \Closure $renderChildrenClosure,
+ RenderingContextInterface $renderingContext
+ ) {
+ /** @var Event $event */
+ $event = $arguments['event'];
+ $type = strtolower($arguments['type']);
+
+ switch ($type) {
+ case 'google':
+ $link = self::getGoogleCalendarLink($event);
+ break;
+ case 'outlook':
+ $link = self::getMicrosoftCalendarLink($event, 'live');
+ break;
+ case 'office365':
+ $link = self::getMicrosoftCalendarLink($event, 'office');
+ break;
+ case 'yahoo':
+ $link = self::getYahooCalendarLink($event);
+ break;
+ default:
+ $link = '';
+ }
+
+ return $link;
+ }
+
+ private static function getGoogleCalendarLink(Event $event): string
+ {
+ $baseLink = 'https://www.google.com/calendar/render?';
+
+ $dateFormat = 'Ymd\\THi00\\ZO';
+ $arguments = [
+ 'action' => 'TEMPLATE',
+ 'text' => $event->getTitle(),
+ 'dates' => $event->getStartdate()->format($dateFormat) . '/' . $event->getEnddate()->format($dateFormat),
+ 'details' => strip_tags($event->getDescription()),
+ ];
+
+ if ($event->getLocation()) {
+ $arguments['location'] = $event->getLocation()->getFullAddress(', ');
+ }
+
+ return $baseLink . http_build_query($arguments, '', '&', PHP_QUERY_RFC3986);
+ }
+
+ private static function getMicrosoftCalendarLink(Event $event, string $product): string
+ {
+ $baseLink = 'https://outlook.' . $product . '.com/calendar/0/deeplink/compose?';
+
+ $dateFormat = 'Y-m-d\\TH:i:00O';
+ $arguments = [
+ 'subject' => $event->getTitle(),
+ 'startdt' => $event->getStartdate()->format($dateFormat),
+ 'enddt' => $event->getEnddate()->format($dateFormat),
+ 'body' => strip_tags($event->getDescription()),
+ 'path' => '/calendar/action/compose&rru=addevent',
+ ];
+
+ if ($event->getLocation()) {
+ $arguments['location'] = $event->getLocation()->getFullAddress(', ');
+ }
+
+ return $baseLink . http_build_query($arguments, '', '&', PHP_QUERY_RFC3986);
+ }
+
+ private static function getYahooCalendarLink(Event $event): string
+ {
+ $baseLink = 'https://calendar.yahoo.com/?';
+
+ $dateFormat = 'Ymd\\THi00\\ZO';
+ $arguments = [
+ 'title' => $event->getTitle(),
+ 'st' => $event->getStartdate()->format($dateFormat),
+ 'et' => $event->getEnddate()->format($dateFormat),
+ 'desc' => strip_tags($event->getDescription()),
+ 'v' => 60,
+ ];
+
+ if ($event->getLocation()) {
+ $arguments['in_loc'] = $event->getLocation()->getFullAddress(', ');
+ }
+
+ return $baseLink . http_build_query($arguments, '', '&', PHP_QUERY_RFC3986);
+ }
+}
diff --git a/Documentation/ForAdministrators/Templates/Viewhelpers/Index.rst b/Documentation/ForAdministrators/Templates/Viewhelpers/Index.rst
index 2e7fc20c..6b274d6a 100644
--- a/Documentation/ForAdministrators/Templates/Viewhelpers/Index.rst
+++ b/Documentation/ForAdministrators/Templates/Viewhelpers/Index.rst
@@ -80,6 +80,23 @@ given page in you TYPO3 website.