/**
  * Clears the cache of configured pages in TypoScript
  *
  * @param array $settings The settings
  *
  * @return void
  */
 public function clearCacheForConfiguredUids($settings)
 {
     $pidList = $this->settingsService->getClearCacheUids($settings);
     if (count($pidList) > 0) {
         $this->cacheService->clearPageCache($pidList);
     }
 }
 /**
  * Notify action
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event Event
  * @param string $customNotification CustomNotification
  *
  * @return void
  */
 public function notifyAction(Event $event, $customNotification)
 {
     $customNotifications = $this->settingsService->getCustomNotifications($this->settings);
     $result = $this->notificationService->sendCustomNotification($event, $customNotification, $this->settings);
     $this->notificationService->createCustomNotificationLogentry($event, $customNotifications[$customNotification], $result);
     $this->redirect('list', 'Administration', 'SfEventMgt', array('demand' => NULL, 'messageId' => 2));
 }
 /**
  * @test
  * @dataProvider customNotificationsSettingsDataProvider
  */
 public function getCustomNotificationsTest($settings, $expected)
 {
     $result = $this->subject->getCustomNotifications($settings);
     $this->assertEquals($expected, $result);
 }
 /**
  * Saves the registration
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event Event
  * @validate $registration \DERHANSEN\SfEventMgt\Validation\Validator\RegistrationValidator
  *
  * @return void
  */
 public function saveRegistrationAction(Registration $registration, Event $event)
 {
     $autoConfirmation = (bool) $this->settings['registration']['autoConfirmation'];
     $result = RegistrationResult::REGISTRATION_SUCCESSFUL;
     $success = $this->checkRegistrationSuccess($event, $registration, $result);
     // Save registration if no errors
     if ($success) {
         $linkValidity = (int) $this->settings['confirmation']['linkValidity'];
         if ($linkValidity === 0) {
             // Use 3600 seconds as default value if not set
             $linkValidity = 3600;
         }
         $confirmationUntil = new \DateTime();
         $confirmationUntil->add(new \DateInterval('PT' . $linkValidity . 'S'));
         $registration->setEvent($event);
         $registration->setPid($event->getPid());
         $registration->setConfirmationUntil($confirmationUntil);
         $registration->_setProperty('_languageUid', $GLOBALS['TSFE']->sys_language_uid);
         $this->registrationRepository->add($registration);
         // Persist registration, so we have an UID
         $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager')->persistAll();
         // Send notifications to user and admin if confirmation link should be sent
         if (!$autoConfirmation) {
             $this->notificationService->sendUserMessage($event, $registration, $this->settings, MessageType::REGISTRATION_NEW);
             $this->notificationService->sendAdminMessage($event, $registration, $this->settings, MessageType::REGISTRATION_NEW);
         }
         // Create given amount of registrations if necessary
         if ($registration->getAmountOfRegistrations() > 1) {
             $this->registrationService->createDependingRegistrations($registration);
         }
         // Clear cache for configured pages
         $pidList = $this->settingsService->getClearCacheUids($this->settings);
         if (count($pidList) > 0) {
             $this->cacheService->clearPageCache($pidList);
         }
     }
     if ($autoConfirmation && $success) {
         $this->redirect('confirmRegistration', NULL, NULL, array('reguid' => $registration->getUid(), 'hmac' => $this->hashService->generateHmac('reg-' . $registration->getUid())));
     } else {
         $this->redirect('saveRegistrationResult', NULL, NULL, array('result' => $result));
     }
 }