/**
  * Returns the rendered iCalendar entry for the given event
  * according to RFC 2445
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event The event
  *
  * @return string
  */
 public function getiCalendarContent(\DERHANSEN\SfEventMgt\Domain\Model\Event $event)
 {
     /** @var \TYPO3\CMS\Fluid\View\StandaloneView $icalView */
     $icalView = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     $icalView->setFormat('txt');
     $layoutRootPaths = $this->fluidStandaloneService->getTemplateFolders('layout');
     $partialRootPaths = $this->fluidStandaloneService->getTemplateFolders('partial');
     $icalView->setLayoutRootPaths($layoutRootPaths);
     $icalView->setPartialRootPaths($partialRootPaths);
     $icalView->setTemplatePathAndFilename($this->fluidStandaloneService->getTemplatePath('Event/ICalendar.txt'));
     $icalView->assignMultiple(['event' => $event, 'typo3Host' => GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY')]);
     // Render view and remove empty lines
     $icalContent = preg_replace('/^\\h*\\v+/m', '', $icalView->render());
     // Finally replace new lines with CRLF
     $icalContent = str_replace(chr(10), chr(13) . chr(10), $icalContent);
     return $icalContent;
 }
 /**
  * Returns the rendered HTML for the given template
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event Event
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration
  * @param string $template Template
  * @param array $settings Settings
  *
  * @return string
  */
 protected function getNotificationBody($event, $registration, $template, $settings)
 {
     /** @var \TYPO3\CMS\Fluid\View\StandaloneView $emailView */
     $emailView = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     $emailView->setFormat('html');
     $layoutRootPaths = $this->fluidStandaloneService->getTemplateFolders('layout');
     $partialRootPaths = $this->fluidStandaloneService->getTemplateFolders('partial');
     if (TYPO3_MODE === 'BE' && $registration->getLanguage() !== '') {
         // Temporary set Language of current BE user to given language
         $GLOBALS['BE_USER']->uc['lang'] = $registration->getLanguage();
         $emailView->getRequest()->setControllerExtensionName('SfEventMgt');
     }
     $emailView->setLayoutRootPaths($layoutRootPaths);
     $emailView->setPartialRootPaths($partialRootPaths);
     $emailView->setTemplatePathAndFilename($this->fluidStandaloneService->getTemplatePath($template));
     $emailView->assignMultiple(['event' => $event, 'registration' => $registration, 'settings' => $settings, 'hmac' => $this->hashService->generateHmac('reg-' . $registration->getUid()), 'reghmac' => $this->hashService->appendHmac((string) $registration->getUid())]);
     $emailBody = $emailView->render();
     return $emailBody;
 }