/** * Frees as much memory that has been used by this object as possible. */ public function __destruct() { unset($this->configGetter, $this->seminar, $this->registration, $this->feuser, $this->listViewHooks, $this->singleViewHooks, $this->feuser, $this->linkBuilder); $this->listViewHooksHaveBeenRetrieved = FALSE; $this->singleViewHooksHaveBeenRetrieved = FALSE; parent::__destruct(); }
/** * Gets our place (or places), complete as RTE'ed HTML with address and * links. Returns a localized string "will be announced" if the seminar has * no places set. * * @param tx_oelib_templatehelper $plugin the current FE plugin * * @return string our places description (or '' if there is an error) */ public function getPlaceWithDetails(tx_oelib_templatehelper $plugin) { if (!$this->hasPlace()) { $plugin->setMarker('message_will_be_announced', $this->translate('message_willBeAnnounced')); return $plugin->getSubpart('PLACE_LIST_EMPTY'); } $result = ''; foreach ($this->getPlacesAsArray() as $place) { $name = htmlspecialchars($place['title']); if ($place['homepage'] != '') { $name = $plugin->cObj->getTypoLink($name, $place['homepage'], array(), $plugin->getConfValueString('externalLinkTarget')); } $plugin->setMarker('place_item_title', $name); $descriptionParts = array(); if ($place['address'] != '') { $descriptionParts[] = htmlspecialchars(str_replace(CR, ',', $place['address'])); } if ($place['city'] != '') { $descriptionParts[] = trim(htmlspecialchars($place['zip'] . ' ' . $place['city'])); } if ($place['country'] != '') { $countryName = $this->getCountryNameFromIsoCode($place['country']); if ($countryName != '') { $descriptionParts[] = htmlspecialchars($countryName); } } $description = implode(', ', $descriptionParts); if ($place['directions'] != '') { $description .= $plugin->pi_RTEcssText($place['directions']); } $plugin->setMarker('place_item_description', $description); $result .= $plugin->getSubpart('PLACE_LIST_ITEM'); } $plugin->setMarker('place_list_content', $result); return $plugin->getSubpart('PLACE_LIST_COMPLETE'); }
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; }
/** * Creates an HTML link to either the registration page (if a user is logged in) or the login page (if no user is logged in). * * This function only creates the link to the standard registration or login * page; it should not be used if the seminar has a separate details page. * * @param tx_oelib_templatehelper $plugin an object for a live page * @param tx_seminars_seminar $seminar a seminar for which we'll check if it is possible to register * @param string $label label for the link, will not be empty * * @return string HTML code with the link */ private function getLinkToStandardRegistrationOrLoginPage(tx_oelib_templatehelper $plugin, tx_seminars_seminar $seminar, $label) { if (tx_oelib_FrontEndLoginManager::getInstance()->isLoggedIn()) { // provides the registration link $result = $plugin->cObj->getTypoLink($label, $plugin->getConfValueInteger('registerPID'), array('tx_seminars_pi1[seminar]' => $seminar->getUid(), 'tx_seminars_pi1[action]' => 'register')); } else { // provides the login link $result = $plugin->getLoginLink($label, $plugin->getConfValueInteger('registerPID'), $seminar->getUid()); } return $result; }
/** * @test */ public function notifyAttendeeForRegistrationMailAndUnregistrationPossibleAddsUnregistrationNotice() { tx_oelib_templatehelper::setCachedConfigurationValue('allowUnregistrationWithEmptyWaitingList', TRUE); $fixture = $this->getMock('tx_seminars_registrationmanager', array('getUnregistrationNotice')); $fixture->expects(self::once())->method('getUnregistrationNotice'); $fixture->setConfigurationValue('sendConfirmation', TRUE); $registration = $this->createRegistration(); $this->testingFramework->changeRecord('fe_users', $registration->getFrontEndUser()->getUid(), array('email' => '*****@*****.**')); $this->testingFramework->changeRecord('tx_seminars_seminars', $this->seminarUid, array('deadline_unregistration' => $GLOBALS['SIM_EXEC_TIME'] + tx_oelib_Time::SECONDS_PER_DAY)); $pi1 = new tx_seminars_FrontEnd_DefaultController(); $pi1->init(); $fixture->notifyAttendee($registration, $pi1); }
/** * Frees as much memory that has been used by this object as possible. */ public function __destruct() { parent::__destruct(); }
/** * Gets our PID. * * @return int our PID (or 0 if there is an error) */ public function getCurrentBePageId() { $result = parent::getCurrentBePageId(); if (!$result) { $result = $this->getRecordPropertyInteger('pid'); } return $result; }
/** * Creates a link to this speaker's homepage, with the title as link text. * * @param tx_oelib_templatehelper $plugin templatehelper object with current configuration values * * @return string this speaker's title wrapped in an link tag, or if the * speaker has no homepage just the speaker name, will not * be empty */ public function getLinkedTitle(tx_oelib_templatehelper $plugin) { $safeTitle = htmlspecialchars($this->getTitle()); if ($this->hasHomepage()) { $result = $plugin->cObj->getTypoLink($safeTitle, $this->getHomepage(), array(), $plugin->getConfValueString('externalLinkTarget')); } else { $result = $safeTitle; } return $result; }