/** * Render the supplied DateTime object as a formatted date. * * @param Tx_WoehrlSeminare_Domain_Model_Event $event * @return int * @author Alexander Fuchs <*****@*****.**> * @api */ public function render($event) { // set editcode-dummy for Spam/Form-double-sent protection $editCodeDummy = hash('sha256', rand() . $event->getTitle() . time() . 'dummy'); $this->setSessionData('editcode', $editCodeDummy); return $editCodeDummy; }
/** * Calculate the free places for a given event. * * @param Tx_WoehrlSeminare_Domain_Model_Event $event * @return int * @author Alexander Fuchs <*****@*****.**> * @api */ public function render(Tx_WoehrlSeminare_Domain_Model_Event $event = NULL) { if ($event != NULL) { $free = $event->getMaxSubscriber() - $this->subscriberRepository->countAllByEvent($event); } else { $free = 0; } return $free > 0 ? $free : 0; }
/** * @test */ public function removeSubscriberFromObjectStorageHoldingSubscribers() { $subscriber = new Tx_WoehrlSeminare_Domain_Model_Subscriber(); $localObjectStorage = new Tx_Extbase_Persistence_ObjectStorage(); $localObjectStorage->attach($subscriber); $localObjectStorage->detach($subscriber); $this->fixture->addSubscriber($subscriber); $this->fixture->removeSubscriber($subscriber); $this->assertEquals($localObjectStorage, $this->fixture->getSubscribers()); }
/** * Renders a record list as known from the TYPO3 list module * Note: This feature is experimental! * * @param icon string * @param event Tx_WoehrlSeminare_Domain_Model_Event * @return string the rendered record list */ public function render($icon = 'edit', Tx_WoehrlSeminare_Domain_Model_Event $event = NULL) { if ($event !== NULL) { $row['uid'] = $event->getUid(); $row['title'] = $event->getTitle(); $row['hidden'] = $event->getHidden(); } $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $row['storagePid'] = $frameworkConfiguration['persistence']['storagePid']; switch ($icon) { case 'new': $content = $this->getNewIcon('tx_woehrlseminare_domain_model_event', $row); break; case 'edit': $content = $this->getEditIcon('tx_woehrlseminare_domain_model_event', $row); break; case 'hide': $content = $this->getHideIcon('tx_woehrlseminare_domain_model_event', $row); break; case 'geniusbar': $content = $this->getGeniusBarIcon($event); break; case 'icsinvitation': $content = $this->getIcsInvitationIcon($event); break; case 'onlineSurvey': $content = $this->getOnlineSurveyIcon($event); break; case 'datepicker': $content = $this->getDatePickerIcon(); break; } return $content; }
/** * 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); }
/** * action show * * @param Tx_WoehrlSeminare_Domain_Model_Event $event * @ignorevalidation $event * @return void */ public function showAction(Tx_WoehrlSeminare_Domain_Model_Event $event = NULL) { if ($event !== NULL) { // fill registers to be used in ts $cObj = t3lib_div::makeInstance('tslib_cObj'); $cObj->LOAD_REGISTER(array('eventPageTitle' => Tx_Extbase_Utility_Localization::translate('tx_woehrlseminare_domain_model_event', 'woehrl_seminare') . ': "' . $event->getTitle() . '" - ' . strftime('%a, %x %H:%M', $event->getStartDateTime()->getTimeStamp())), 'LOAD_REGISTER'); } $this->view->assign('event', $event); }