Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * @test
  * @return void
  */
 public function setLanguageSetsGivenLanguage()
 {
     $this->subject->setLanguage('de');
     $this->assertEquals('de', $this->subject->getLanguage());
 }