Ejemplo n.º 1
0
 /**
  * Creates the list of required events.
  *
  * @return string HTML code of the list, will not be empty
  */
 public function render()
 {
     if (!$this->event) {
         throw new BadMethodCallException('No event was set, please set an event before calling render.', 1333293250);
     }
     if ($this->linkBuilder == NULL) {
         /** @var tx_seminars_Service_SingleViewLinkBuilder $linkBuilder */
         $linkBuilder = t3lib_div::makeInstance('tx_seminars_Service_SingleViewLinkBuilder');
         $this->injectLinkBuilder($linkBuilder);
     }
     $this->linkBuilder->setPlugin($this);
     $output = '';
     /** @var tx_seminars_Mapper_Event $eventMapper */
     $eventMapper = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Event');
     $requirements = $this->getRequirements();
     /** @var tx_seminars_seminar $requirement */
     foreach ($requirements as $requirement) {
         /** @var tx_seminars_Model_Event $event */
         $event = $eventMapper->find($requirement->getUid());
         $singleViewUrl = $this->linkBuilder->createRelativeUrlForEvent($event);
         $this->setMarker('requirement_url', htmlspecialchars($singleViewUrl));
         $this->setMarker('requirement_title', htmlspecialchars($event->getTitle()));
         $output .= $this->getSubpart('SINGLE_REQUIREMENT');
     }
     $this->setSubpart('SINGLE_REQUIREMENT', $output);
     return $this->getSubpart('FIELD_WRAPPER_REQUIREMENTS');
 }
Ejemplo n.º 2
0
 /**
  * Returns a link builder instance.
  *
  * @return tx_seminars_Service_SingleViewLinkBuilder the link builder instance
  */
 protected function getLinkBuilder()
 {
     if ($this->linkBuilder === NULL) {
         /** @var tx_seminars_Service_SingleViewLinkBuilder $linkBuilder */
         $linkBuilder = t3lib_div::makeInstance('tx_seminars_Service_SingleViewLinkBuilder');
         $this->injectLinkBuilder($linkBuilder);
     }
     $this->linkBuilder->setPlugin($this);
     return $this->linkBuilder;
 }
 /**
  * Builds the e-mail body for an e-mail to the attendee.
  *
  * @param tx_seminars_registration $registration
  *        the registration for which the notification should be send
  * @param tslib_pibase $plugin a live plugin
  * @param string $helloSubjectPrefix
  *        prefix for the locallang key of the localized hello and subject
  *        string; allowed values are:
  *        - confirmation
  *        - confirmationOnUnregistration
  *        - confirmationOnRegistrationForQueue
  *        - confirmationOnQueueUpdate
  *        In the following, the parameter is prefixed with "email_" and postfixed with "Hello" or "Subject".
  * @param bool $useHtml whether to create HTML instead of plain text
  *
  * @return string the e-mail body for the attendee e-mail, will not be empty
  */
 private function buildEmailContent(tx_seminars_registration $registration, tslib_pibase $plugin, $helloSubjectPrefix, $useHtml = FALSE)
 {
     if ($this->linkBuilder === NULL) {
         /** @var $linkBuilder tx_seminars_Service_SingleViewLinkBuilder */
         $linkBuilder = t3lib_div::makeInstance('tx_seminars_Service_SingleViewLinkBuilder');
         $this->injectLinkBuilder($linkBuilder);
     }
     $this->linkBuilder->setPlugin($plugin);
     $wrapperPrefix = ($useHtml ? 'html_' : '') . 'field_wrapper';
     if (t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 4007000) {
         $charset = 'utf-8';
     } else {
         $charset = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] : 'utf-8';
     }
     $this->setMarker('html_mail_charset', $charset);
     $this->hideSubparts($this->getConfValueString('hideFieldsInThankYouMail'), $wrapperPrefix);
     $this->setEMailIntroduction($helloSubjectPrefix, $registration);
     $event = $registration->getSeminarObject();
     $this->fillOrHideUnregistrationNotice($helloSubjectPrefix, $registration, $useHtml);
     $this->setMarker('uid', $event->getUid());
     $this->setMarker('registration_uid', $registration->getUid());
     if ($registration->hasSeats()) {
         $this->setMarker('seats', $registration->getSeats());
     } else {
         $this->hideSubparts('seats', $wrapperPrefix);
     }
     $this->fillOrHideAttendeeMarker($registration, $useHtml);
     if ($registration->hasLodgings()) {
         $this->setMarker('lodgings', $registration->getLodgings());
     } else {
         $this->hideSubparts('lodgings', $wrapperPrefix);
     }
     if ($registration->hasAccommodation()) {
         $this->setMarker('accommodation', $registration->getAccommodation());
     } else {
         $this->hideSubparts('accommodation', $wrapperPrefix);
     }
     if ($registration->hasFoods()) {
         $this->setMarker('foods', $registration->getFoods());
     } else {
         $this->hideSubparts('foods', $wrapperPrefix);
     }
     if ($registration->hasFood()) {
         $this->setMarker('food', $registration->getFood());
     } else {
         $this->hideSubparts('food', $wrapperPrefix);
     }
     if ($registration->hasCheckboxes()) {
         $this->setMarker('checkboxes', $registration->getCheckboxes());
     } else {
         $this->hideSubparts('checkboxes', $wrapperPrefix);
     }
     if ($registration->hasKids()) {
         $this->setMarker('kids', $registration->getNumberOfKids());
     } else {
         $this->hideSubparts('kids', $wrapperPrefix);
     }
     if ($event->hasAccreditationNumber()) {
         $this->setMarker('accreditation_number', $event->getAccreditationNumber());
     } else {
         $this->hideSubparts('accreditation_number', $wrapperPrefix);
     }
     if ($event->hasCreditPoints()) {
         $this->setMarker('credit_points', $event->getCreditPoints());
     } else {
         $this->hideSubparts('credit_points', $wrapperPrefix);
     }
     $this->setMarker('date', $event->getDate($useHtml ? '—' : '-'));
     $this->setMarker('time', $event->getTime($useHtml ? '—' : '-'));
     $this->fillPlacesMarker($event, $useHtml);
     if ($event->hasRoom()) {
         $this->setMarker('room', $event->getRoom());
     } else {
         $this->hideSubparts('room', $wrapperPrefix);
     }
     if ($registration->hasPrice()) {
         $this->setMarker('price', $registration->getPrice());
     } else {
         $this->hideSubparts('price', $wrapperPrefix);
     }
     if ($registration->hasTotalPrice()) {
         $this->setMarker('total_price', $registration->getTotalPrice());
     } else {
         $this->hideSubparts('total_price', $wrapperPrefix);
     }
     // We don't need to check $this->seminar->hasPaymentMethods() here as
     // method_of_payment can only be set (using the registration form) if
     // the event has at least one payment method.
     if ($registration->hasMethodOfPayment()) {
         $this->setMarker('paymentmethod', $event->getSinglePaymentMethodPlain($registration->getMethodOfPaymentUid()));
     } else {
         $this->hideSubparts('paymentmethod', $wrapperPrefix);
     }
     $this->setMarker('billing_address', $registration->getBillingAddress());
     if ($registration->hasInterests()) {
         $this->setMarker('interests', $registration->getInterests());
     } else {
         $this->hideSubparts('interests', $wrapperPrefix);
     }
     /** @var tx_seminars_Mapper_Event $mapper */
     $mapper = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Event');
     /** @var $newEvent tx_seminars_Model_Event */
     $newEvent = $mapper->find($event->getUid());
     $singleViewUrl = $this->linkBuilder->createAbsoluteUrlForEvent($newEvent);
     $this->setMarker('url', $useHtml ? htmlspecialchars($singleViewUrl) : $singleViewUrl);
     if ($event->isPlanned()) {
         $this->unhideSubparts('planned_disclaimer', $wrapperPrefix);
     } else {
         $this->hideSubparts('planned_disclaimer', $wrapperPrefix);
     }
     $footers = $event->getOrganizersFooter();
     $this->setMarker('footer', !empty($footers) ? LF . '-- ' . LF . $footers[0] : '');
     $this->callModifyAttendeeEmailTextHooks($registration, $this->getTemplate());
     return $this->getSubpart($useHtml ? 'MAIL_THANKYOU_HTML' : 'MAIL_THANKYOU');
 }