protected function setUp()
 {
     $this->extConfBackup = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'];
     $this->t3VarBackup = $GLOBALS['T3_VAR']['getUserObj'];
     $this->testingFramework = new tx_oelib_testingFramework('tx_seminars');
     $this->testingFramework->createFakeFrontEnd();
     /** @var Tx_Oelib_MailerFactory $mailerFactory */
     $mailerFactory = t3lib_div::makeInstance('Tx_Oelib_MailerFactory');
     $mailerFactory->enableTestMode();
     $this->mailer = $mailerFactory->getMailer();
     tx_seminars_registrationchild::purgeCachedSeminars();
     tx_oelib_configurationProxy::getInstance('seminars')->setAsInteger('eMailFormatForAttendees', tx_seminars_registrationmanager::SEND_TEXT_MAIL);
     $configurationRegistry = tx_oelib_ConfigurationRegistry::getInstance();
     $configurationRegistry->set('plugin.tx_seminars', new Tx_Oelib_Configuration());
     $configurationRegistry->set('plugin.tx_seminars._LOCAL_LANG.default', new Tx_Oelib_Configuration());
     $configurationRegistry->set('config', new Tx_Oelib_Configuration());
     $configurationRegistry->set('page.config', new Tx_Oelib_Configuration());
     $organizerUid = $this->testingFramework->createRecord('tx_seminars_organizers', array('title' => 'test organizer', 'email' => '*****@*****.**', 'email_footer' => 'organizer footer'));
     $this->seminarUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('title' => 'test event', 'begin_date' => $GLOBALS['SIM_EXEC_TIME'] + 1000, 'end_date' => $GLOBALS['SIM_EXEC_TIME'] + 2000, 'attendees_min' => 1, 'attendees_max' => 10, 'needs_registration' => 1, 'organizers' => 1));
     $this->testingFramework->createRelation('tx_seminars_seminars_organizers_mm', $this->seminarUid, $organizerUid);
     tx_oelib_templateHelper::setCachedConfigurationValue('templateFile', 'EXT:seminars/Resources/Private/Templates/Mail/e-mail.html');
     $headerProxyFactory = tx_oelib_headerProxyFactory::getInstance();
     $headerProxyFactory->enableTestMode();
     $this->headerCollector = $headerProxyFactory->getHeaderProxy();
     $this->seminar = new tx_seminars_seminarchild($this->seminarUid);
     $this->fixture = tx_seminars_registrationmanager::getInstance();
     $this->linkBuilder = $this->getMock('tx_seminars_Service_SingleViewLinkBuilder', array('createAbsoluteUrlForEvent'));
     $this->linkBuilder->expects(self::any())->method('createAbsoluteUrlForEvent')->will(self::returnValue('http://singleview.example.com/'));
     $this->fixture->injectLinkBuilder($this->linkBuilder);
 }
 protected function setUp()
 {
     tx_oelib_configurationProxy::getInstance('seminars')->setAsBoolean('enableConfigCheck', FALSE);
     $this->extConfBackup = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'];
     $this->t3VarBackup = $GLOBALS['T3_VAR']['getUserObj'];
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seminars'] = array();
     $this->testingFramework = new tx_oelib_testingFramework('tx_seminars');
     $this->testingFramework->createFakeFrontEnd();
     tx_oelib_headerProxyFactory::getInstance()->enableTestMode();
     $configuration = new tx_oelib_Configuration();
     $configuration->setAsString('currency', 'EUR');
     tx_oelib_ConfigurationRegistry::getInstance()->set('plugin.tx_seminars', $configuration);
     $this->systemFolderPid = $this->testingFramework->createSystemFolder();
     $this->seminarUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('pid' => $this->systemFolderPid, 'title' => 'Test & event', 'subtitle' => 'Something for you & me', 'accreditation_number' => '1 & 1', 'room' => 'Rooms 2 & 3'));
     $this->fixture = new tx_seminars_FrontEnd_DefaultController();
     $this->fixture->init(array('isStaticTemplateLoaded' => 1, 'enableRegistration' => 1, 'templateFile' => 'EXT:seminars/Resources/Private/Templates/FrontEnd/FrontEnd.html', 'what_to_display' => 'seminar_list', 'pidList' => $this->systemFolderPid, 'pages' => $this->systemFolderPid, 'recursive' => 1, 'listView.' => array('orderBy' => 'data', 'descFlag' => 0, 'results_at_a_time' => 999, 'maxPages' => 5), 'eventFieldsOnRegistrationPage' => 'title,price_regular,price_special,vacancies,accreditation_number', 'linkToSingleView' => 'always'));
     $this->fixture->getTemplateCode();
     $this->fixture->setLabels();
     $this->fixture->createHelperObjects();
     tx_oelib_templatehelper::setCachedConfigurationValue('dateFormatYMD', '%d.%m.%Y');
     tx_oelib_templatehelper::setCachedConfigurationValue('timeFormat', '%H:%M');
     $this->linkBuilder = $this->getMock('tx_seminars_Service_SingleViewLinkBuilder', array('createRelativeUrlForEvent'));
     $this->linkBuilder->expects(self::any())->method('createRelativeUrlForEvent')->will(self::returnValue('index.php?id=42&tx_seminars_pi1%5BshowUid%5D=1337'));
     $this->fixture->injectLinkBuilder($this->linkBuilder);
     /** @var $content tslib_cObj|PHPUnit_Framework_MockObject_MockObject */
     $content = $this->getMock('tslib_cObj', array('IMAGE'));
     $content->expects(self::any())->method('IMAGE')->will(self::returnValue('<img src="foo.jpg" alt="bar"/>'));
     $this->fixture->cObj = $content;
 }
 protected function setUp()
 {
     $configuration = new Tx_Oelib_Configuration();
     Tx_Oelib_ConfigurationRegistry::getInstance()->set('plugin.tx_seminars', $configuration);
     $this->extConfBackup = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'];
     $this->t3VarBackup = $GLOBALS['T3_VAR']['getUserObj'];
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seminars'] = array();
     $this->languageBackup = $GLOBALS['LANG']->lang;
     $GLOBALS['LANG']->lang = 'default';
     // Loads the locallang file for properly working localization in the tests.
     $GLOBALS['LANG']->includeLLFile('EXT:seminars/BackEnd/locallang.xml');
     tx_oelib_headerProxyFactory::getInstance()->enableTestMode();
     /** @var Tx_Oelib_MailerFactory $mailerFactory */
     $mailerFactory = t3lib_div::makeInstance('Tx_Oelib_MailerFactory');
     $mailerFactory->enableTestMode();
     $this->mailer = $mailerFactory->getMailer();
     $this->testingFramework = new tx_oelib_testingFramework('tx_seminars');
     tx_oelib_MapperRegistry::getInstance()->activateTestingMode($this->testingFramework);
     $this->dummySysFolderUid = $this->testingFramework->createSystemFolder();
     tx_oelib_PageFinder::getInstance()->setPageUid($this->dummySysFolderUid);
     $this->organizerUid = $this->testingFramework->createRecord('tx_seminars_organizers', array('title' => 'Dummy Organizer', 'email' => '*****@*****.**'));
     $this->eventUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('pid' => $this->dummySysFolderUid, 'title' => 'Dummy event', 'object_type' => tx_seminars_Model_Event::TYPE_DATE, 'begin_date' => $GLOBALS['SIM_EXEC_TIME'] + 86400, 'organizers' => 0));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $this->eventUid, $this->organizerUid, 'organizers');
     $this->fixture = new tx_seminars_BackEnd_CancelEventMailForm($this->eventUid);
     $this->linkBuilder = $this->getMock('tx_seminars_Service_SingleViewLinkBuilder', array('createAbsoluteUrlForEvent'));
     $this->linkBuilder->expects(self::any())->method('createAbsoluteUrlForEvent')->will(self::returnValue('http://singleview.example.com/'));
     $this->fixture->injectLinkBuilder($this->linkBuilder);
 }
 /**
  * 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');
 }
 /**
  * Gets the full URL to the single view of the current event.
  *
  * @return string the URL to the single view of the given event, will be
  *                empty if no single view URL could be determined
  */
 private function getSingleViewUrl()
 {
     if ($this->linkBuilder == NULL) {
         /** @var tx_seminars_Service_SingleViewLinkBuilder $linkBuilder */
         $linkBuilder = t3lib_div::makeInstance('tx_seminars_Service_SingleViewLinkBuilder');
         $this->injectLinkBuilder($linkBuilder);
     }
     $result = $this->linkBuilder->createAbsoluteUrlForEvent($this->getEvent());
     if ($result == '') {
         $this->setErrorMessage('messageBody', $GLOBALS['LANG']->getLL('eventMailForm_error_noDetailsPageFound'));
     }
     return $result;
 }
 /**
  * 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;
 }
 /**
  * Retrieves the single view page UID from the flexforms/TS Setup
  * configuration.
  *
  * @return int
  *         the single view page UID from the configuration, will be 0 if no
  *         page UID has been set
  */
 public function getSingleViewPageFromConfiguration()
 {
     return parent::getSingleViewPageFromConfiguration();
 }
 /**
  * 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 ? '&#8212;' : '-'));
     $this->setMarker('time', $event->getTime($useHtml ? '&#8212;' : '-'));
     $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');
 }