コード例 #1
0
 /**
  * Sends an e-mail to all organizers with a message about a registration or unregistration.
  *
  * @param tx_seminars_registration $registration
  *        the registration for which the notification should be send
  * @param string $helloSubjectPrefix
  *        prefix for the locallang key of the localized hello and subject string, Allowed values are:
  *        - notification
  *        - notificationOnUnregistration
  *        - notificationOnRegistrationForQueue
  *        - notificationOnQueueUpdate
  *        In the following, the parameter is prefixed with "email_" and postfixed with "Hello" or "Subject".
  *
  * @return void
  */
 public function notifyOrganizers(tx_seminars_registration $registration, $helloSubjectPrefix = 'notification')
 {
     if (!$this->getConfValueBoolean('send' . ucfirst($helloSubjectPrefix))) {
         return;
     }
     if (!$registration->hasExistingFrontEndUser()) {
         return;
     }
     $event = $registration->getSeminarObject();
     if (!$event->hasOrganizers()) {
         return;
     }
     $organizers = $event->getOrganizerBag();
     /** @var $eMailNotification tx_oelib_Mail */
     $eMailNotification = t3lib_div::makeInstance('tx_oelib_Mail');
     $eMailNotification->setSender($event->getFirstOrganizer());
     /** @var tx_seminars_OldModel_Organizer $organizer */
     foreach ($organizers as $organizer) {
         $eMailNotification->addRecipient($organizer);
     }
     $eMailNotification->setSubject($this->translate('email_' . $helloSubjectPrefix . 'Subject') . ': ' . $registration->getTitle());
     $this->initializeTemplate();
     $this->hideSubparts($this->getConfValueString('hideFieldsInNotificationMail'), 'field_wrapper');
     $this->setMarker('hello', $this->translate('email_' . $helloSubjectPrefix . 'Hello'));
     $this->setMarker('summary', $registration->getTitle());
     if ($this->hasConfValueString('showSeminarFieldsInNotificationMail')) {
         $this->setMarker('seminardata', $event->dumpSeminarValues($this->getConfValueString('showSeminarFieldsInNotificationMail')));
     } else {
         $this->hideSubparts('seminardata', 'field_wrapper');
     }
     if ($this->hasConfValueString('showFeUserFieldsInNotificationMail')) {
         $this->setMarker('feuserdata', $registration->dumpUserValues($this->getConfValueString('showFeUserFieldsInNotificationMail')));
     } else {
         $this->hideSubparts('feuserdata', 'field_wrapper');
     }
     if ($this->hasConfValueString('showAttendanceFieldsInNotificationMail')) {
         $this->setMarker('attendancedata', $registration->dumpAttendanceValues($this->getConfValueString('showAttendanceFieldsInNotificationMail')));
     } else {
         $this->hideSubparts('attendancedata', 'field_wrapper');
     }
     $this->callModifyOrganizerNotificationEmailHooks($registration, $this->getTemplate());
     $eMailNotification->setMessage($this->getSubpart('MAIL_NOTIFICATION'));
     $this->modifyNotificationEmail($eMailNotification, $registration);
     /** @var Tx_Oelib_MailerFactory $mailerFactory */
     $mailerFactory = t3lib_div::makeInstance('Tx_Oelib_MailerFactory');
     $mailerFactory->getMailer()->send($eMailNotification);
 }