/** * action beOnlineSurveyAction * * --> see ics template in Resources/Private/Backend/Templates/Email/ * * @param Tx_WoehrlSeminare_Domain_Model_Event $event * @param integer $step * @ignorevalidation $event * @return void */ public function beOnlineSurveyAction(Tx_WoehrlSeminare_Domain_Model_Event $event, $step = 0) { // get the onlineSurveyLink and potential timestamp of last sent $onlineSurveyLink = t3lib_div::trimExplode('|', $event->getOnlinesurvey(), TRUE); // set the link to the current object to get access inside the email $event->setOnlinesurvey($onlineSurveyLink[0]); if ($step == 0) { if (t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) < '6000000') { // TYPO3 4.7 $emailViewHTML = $this->objectManager->create('Tx_Fluid_View_StandaloneView'); } else { // TYPO3 6.x /** @var \TYPO3\CMS\Fluid\View\StandaloneView $emailViewHTML */ $emailViewHTML = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView'); } $emailViewHTML->getRequest()->setControllerExtensionName($this->extensionName); $emailViewHTML->setFormat('html'); //~ $emailText->assignMultiple($variables); $emailViewHTML->assign('onlineSurveyLink', $onlineSurveyLink[0]); $emailViewHTML->assign('event', $event); $emailViewHTML->assign('subscriber', array('name' => '###Name wird automatisch ausgefüllt###')); $extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $templateRootPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($extbaseFrameworkConfiguration['view']['templateRootPath']); $partialRootPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($extbaseFrameworkConfiguration['view']['partialRootPath']); $emailViewHTML->setTemplatePathAndFilename($templateRootPath . 'Email/' . 'OnlineSurvey.html'); $emailViewHTML->setPartialRootPath($partialRootPath); $emailTextHTML = $emailViewHTML->render(); } if ($step == 1) { $helper['now'] = time(); $helper['description'] = $this->foldline($this->html2rest($event->getDescription())); // location may be empty... if (is_object($event->getLocation())) { $helper['location'] = $event->getLocation()->getName(); $helper['locationics'] = $this->foldline($event->getLocation()->getName()); } $allSubscribers = $event->getSubscribers(); foreach ($allSubscribers as $uid => $subscriber) { //~ $helper['nameto'] = strtolower(str_replace(array(',', ' '), array('', '-'), $event->getContact()->getName())); $this->sendTemplateEmail(array($subscriber->getEmail() => $subscriber->getName()), array($event->getContact()->getEmail() => $event->getContact()->getName()), 'Online-Umfrage zu ' . $event->getTitle(), 'OnlineSurvey', array('event' => $event, 'subscriber' => $subscriber, 'attachSubscriberAsCsv' => FALSE, 'helper' => $helper, 'settings' => $this->settings, 'attachIcsInvitation' => FALSE)); } // change the onlineSurvey link to see, that we sent it already $event->setOnlinesurvey($onlineSurveyLink[0] . '|' . time()); // we changed the event inside the repository and have to // update the repo manually as of TYPO3 6.1 $this->eventRepository->update($event); } $this->view->assign('event', $event); if (isset($onlineSurveyLink[1])) { $this->view->assign('onlineSurveyLastSent', $onlineSurveyLink[1]); } $this->view->assign('subscribers', $event->getSubscribers()); $this->view->assign('step', $step); $this->view->assign('emailText', $emailTextHTML); }