/** * Returns the WHERE clause part to limit the entries to the records stored * with the general record storage PID. * * @param string $tableName table name as prefix for the PID column, must not be empty * * @return string WHERE clause for the foreignTable WHERE part, will be * empty if the storage PID should not be used to filter the * select options */ function txSeminarsGetTableRelationsClause($tableName) { if (!tx_oelib_configurationProxy::getInstance('seminars')->getAsBoolean('useStoragePid')) { return ''; } return 'AND (' . $tableName . '.pid = ###STORAGE_PID### ' . 'OR ###STORAGE_PID### = 0)'; }
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() { tx_oelib_configurationProxy::getInstance('seminars')->setAsBoolean('enableConfigCheck', FALSE); tx_oelib_headerProxyFactory::getInstance()->enableTestMode(); $this->testingFramework = new tx_oelib_testingFramework('tx_seminars'); $this->testingFramework->createFakeFrontEnd(); $this->seminarUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_COMPLETE, 'title' => 'Test event & more', 'attendees_max' => 10, 'needs_registration' => 1)); $this->fixture = new tx_seminars_FrontEnd_RegistrationsList(array('templateFile' => 'EXT:seminars/Resources/Private/Templates/FrontEnd/FrontEnd.html', 'enableRegistration' => 1), 'list_registrations', $this->seminarUid, $GLOBALS['TSFE']->cObj); }
protected function setUp() { tx_oelib_configurationProxy::getInstance('seminars')->setAsBoolean('enableConfigCheck', FALSE); $this->testingFramework = new tx_oelib_testingFramework('tx_seminars'); $this->testingFramework->createFakeFrontEnd(); $this->systemFolderPid = $this->testingFramework->createSystemFolder(); $this->seminarUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('pid' => $this->systemFolderPid, 'title' => 'Test event')); $this->fixture = new tx_seminars_FrontEnd_CategoryList(array('isStaticTemplateLoaded' => 1, 'templateFile' => 'EXT:seminars/Resources/Private/Templates/FrontEnd/FrontEnd.html', 'pages' => $this->systemFolderPid, 'pidList' => $this->systemFolderPid, 'recursive' => 1), $GLOBALS['TSFE']->cObj); }
protected function setUp() { $configurationRegistry = Tx_Oelib_ConfigurationRegistry::getInstance(); $configurationRegistry->set('config', new Tx_Oelib_Configuration()); $configurationRegistry->set('page.config', new Tx_Oelib_Configuration()); $configurationRegistry->set('plugin.tx_seminars._LOCAL_LANG.default', new Tx_Oelib_Configuration()); tx_oelib_configurationProxy::getInstance('seminars')->setAsBoolean('enableConfigCheck', FALSE); $this->testingFramework = new tx_oelib_testingFramework('tx_seminars'); $this->testingFramework->createFakeFrontEnd(); $this->mapper = $this->getMock('tx_seminars_Mapper_Event', array('findNextUpcoming')); $this->fixture = new tx_seminars_FrontEnd_Countdown(array('isStaticTemplateLoaded' => 1, 'templateFile' => 'EXT:seminars/Resources/Private/Templates/FrontEnd/FrontEnd.html'), $GLOBALS['TSFE']->cObj); }
protected function setUp() { tx_oelib_configurationProxy::getInstance('seminars')->setAsBoolean('enableConfigCheck', FALSE); $this->testingFramework = new tx_oelib_testingFramework('tx_seminars'); $this->dummySysFolderPid = $this->testingFramework->createSystemFolder(); $this->backEndLanguageBackup = $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'); $this->backEndModule = new tx_seminars_BackEnd_Module(); $this->backEndModule->id = $this->dummySysFolderPid; $this->backEndModule->setPageData(array('uid' => $this->dummySysFolderPid, 'doktype' => tx_seminars_BackEnd_AbstractList::SYSFOLDER_TYPE)); $document = new bigDoc(); $this->backEndModule->doc = $document; $document->backPath = $GLOBALS['BACK_PATH']; $document->docType = 'xhtml_strict'; $this->fixture = new tx_seminars_BackEnd_RegistrationsList($this->backEndModule); }
protected function setUp() { $pluginConfiguration = new Tx_Oelib_Configuration(); $pluginConfiguration->setAsString('dateFormatYMD', '%d.%m.%Y'); $configurationRegistry = Tx_Oelib_ConfigurationRegistry::getInstance(); $configurationRegistry->set('plugin.tx_seminars', $pluginConfiguration); $configurationRegistry->set('config', new Tx_Oelib_Configuration()); $configurationRegistry->set('page.config', new Tx_Oelib_Configuration()); $configurationRegistry->set('plugin.tx_seminars._LOCAL_LANG.default', new Tx_Oelib_Configuration()); tx_oelib_configurationProxy::getInstance('seminars')->setAsBoolean('enableConfigCheck', FALSE); $this->testingFramework = new tx_oelib_testingFramework('tx_seminars'); $this->testingFramework->createFakeFrontEnd(); // just picked some random date (2001-01-01 00:00:00) $this->eventDate = 978303600; $this->mapper = new tx_seminars_Mapper_Event(); $event = $this->mapper->getLoadedTestingModel(array('pid' => 0, 'title' => 'Test event', 'begin_date' => $this->eventDate)); $this->eventId = $event->getUid(); $this->fixture = new tx_seminars_FrontEnd_EventHeadline(array('isStaticTemplateLoaded' => 1, 'templateFile' => 'EXT:seminars/Resources/Private/Templates/FrontEnd/FrontEnd.html'), $GLOBALS['TSFE']->cObj); $this->fixture->injectEventMapper($this->mapper); }
protected function setUp() { tx_oelib_configurationProxy::getInstance('seminars')->setAsBoolean('enableConfigCheck', FALSE); // Sets the localization to the default language so that all tests can // run even if the BE user has its interface set to another language. $this->originalLanguage = $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'); $this->testingFramework = new Tx_Oelib_TestingFramework('tx_seminars'); $this->dummySysFolderPid = $this->testingFramework->createSystemFolder(); $this->backEndModule = new tx_seminars_BackEnd_Module(); $this->backEndModule->id = $this->dummySysFolderPid; $this->backEndModule->setPageData(array('uid' => $this->dummySysFolderPid, 'doktype' => tx_seminars_BackEnd_AbstractList::SYSFOLDER_TYPE)); $document = new bigDoc(); $this->backEndModule->doc = $document; $document->backPath = $GLOBALS['BACK_PATH']; $document->docType = 'xhtml_strict'; $this->fixture = new tx_seminars_BackEnd_EventsList($this->backEndModule); $backEndGroup = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_BackEndUserGroup')->getLoadedTestingModel(array('tx_seminars_events_folder' => $this->dummySysFolderPid + 1)); $backEndUser = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_BackEndUser')->getLoadedTestingModel(array('usergroup' => $backEndGroup->getUid())); tx_oelib_BackEndLoginManager::getInstance()->setLoggedInUser($backEndUser); }
/** * @test */ public function populateListSpeakersForSetStoragePageAndUseStoragePageSetDoesNotReturnsRecordWithOtherPageId() { $pageUid = $this->testingFramework->createFrontEndPage(0, array('storage_pid' => 42)); tx_oelib_configurationProxy::getInstance('seminars')->setAsBoolean('useStoragePid', TRUE); $this->testingFramework->createFakeFrontEnd($pageUid); $this->testingFramework->createAndLoginFrontEndUser(); $speakerUid = $this->testingFramework->createRecord('tx_seminars_speakers', array('pid' => 21)); self::assertFalse(in_array(array('caption' => '', 'value' => $speakerUid, 'wrapitem' => '|</td><td> '), $this->fixture->populateListSpeakers(array()))); }
protected function setUp() { tx_oelib_configurationProxy::getInstance('seminars')->setAsBoolean('enableConfigCheck', TRUE); $this->objectToCheck = new Tx_Oelib_Tests_Unit_Fixtures_DummyObjectToCheck(array()); $this->fixture = new tx_seminars_configcheck($this->objectToCheck); }
/** * @test */ public function notifyAttendeeForPlaceAddressAndHtmlMailsSeparatresAddressAndCityLineWithBreaks() { $this->fixture->setConfigurationValue('sendConfirmation', TRUE); tx_oelib_configurationProxy::getInstance('seminars')->setAsInteger('eMailFormatForAttendees', tx_seminars_registrationmanager::SEND_HTML_MAIL); $this->fixture->setConfigurationValue('cssFileForAttendeeMail', 'EXT:seminars/Resources/Private/CSS/thankYouMail.css'); $uid = $this->testingFramework->createRecord('tx_seminars_sites', array('address' => 'address', 'city' => 'footown')); $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $this->seminarUid, $uid, 'place'); $pi1 = new tx_seminars_FrontEnd_DefaultController(); $pi1->init(); $registration = $this->createRegistration(); $this->fixture->notifyAttendee($registration, $pi1); self::assertContains('address<br>footown', $this->getEmailHtmlPart()); }
/** * Fills in the matching marker for the owner data or hides the subpart if * the event has no owner or the owner data should not be displayed. * * @return void */ private function setOwnerDataMarker() { if (!$this->getConfValueBoolean('showOwnerDataInSingleView', 's_singleView') || !$this->seminar->hasOwner()) { $this->hideSubparts('owner_data', 'field_wrapper'); return; } $owner = $this->seminar->getOwner(); $ownerData = array(); // getName always returns a non-empty string for valid records. $ownerData[] = htmlspecialchars($owner->getName()); if ($owner->hasPhoneNumber()) { $ownerData[] = htmlspecialchars($owner->getPhoneNumber()); } if ($owner->hasEMailAddress()) { $ownerData[] = htmlspecialchars($owner->getEMailAddress()); } $this->setSubpart('OWNER_DATA', implode($this->getSubpart('OWNER_DATA_SEPARATOR'), $ownerData)); if ($owner->hasImage()) { $configuredUploadFolder = tx_oelib_configurationProxy::getInstance('sr_feuser_register')->getAsString('uploadFolder'); $uploadFolder = $configuredUploadFolder == '' ? 'uploads/tx_srfeuserregister' : $configuredUploadFolder; if (substr($uploadFolder, -1) != '/') { $uploadFolder .= '/'; } $imageTag = $this->createRestrictedImage($uploadFolder . $owner->getImage(), '', $this->getConfValueInteger('ownerPictureMaxWidth'), 0, 0, '', $this->prefixId . '_owner_image'); } else { $imageTag = ''; } $this->setMarker('owner_image', $imageTag); }
/** * @test */ public function getEntriesFromGeneralStoragePageForUseStoragePidSetAndNoStoragePidSetFindsRecordWithAnyPid() { tx_oelib_configurationProxy::getInstance('seminars')->setAsBoolean('useStoragePid', TRUE); $recordUid = $this->testingFramework->createRecord($this->testingTable, array('title' => 'foo record', 'pid' => 42)); $configuration = $this->fixture->getEntriesFromGeneralStoragePage(array('config' => array('itemTable' => $this->testingTable), 'row' => array('pid' => $this->testingFramework->createFrontEndPage()), 'items' => array())); self::assertTrue(in_array(array(0 => 'foo record', 1 => $recordUid, 2 => 'fooicon'), $configuration['items'])); }
protected function setUp() { tx_oelib_configurationProxy::getInstance('seminars')->setAsBoolean('enableConfigCheck', FALSE); $this->fixture = new tx_seminars_BackEnd_Module(); }
/** * Returns the allowed PIDs for the auxiliary records. * * @return string comma-sparated list of PIDs for the auxiliary records, may * be empty */ private function getPidsForAuxiliaryRecords() { $recordPids = array(); $frontEndUser = self::getLoggedInUser(); $auxiliaryRecordsPid = $frontEndUser->getAuxiliaryRecordsPid(); if ($auxiliaryRecordsPid == 0) { $auxiliaryRecordsPid = self::getSeminarsConfiguration()->getAsInteger('createAuxiliaryRecordsPID'); } if (tx_oelib_configurationProxy::getInstance('seminars')->getAsBoolean('useStoragePid')) { $recordPids[] = $this->getStoragePid(); } if ($auxiliaryRecordsPid != 0) { $recordPids[] = $auxiliaryRecordsPid; } return implode(',', $recordPids); }
/** * Sends an e-mail to the attendee with a message concerning his/her registration or unregistration. * * @param tx_seminars_registration $oldRegistration the registration for which the notification should be sent * @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". * * @return void */ public function notifyAttendee(tx_seminars_registration $oldRegistration, tslib_pibase $plugin, $helloSubjectPrefix = 'confirmation') { if (!$this->getConfValueBoolean('send' . ucfirst($helloSubjectPrefix))) { return; } /** @var $event tx_seminars_seminar */ $event = $oldRegistration->getSeminarObject(); if (!$event->hasOrganizers()) { return; } if (!$oldRegistration->hasExistingFrontEndUser()) { return; } if (!$oldRegistration->getFrontEndUser()->hasEMailAddress()) { return; } /** @var $eMailNotification tx_oelib_Mail */ $eMailNotification = t3lib_div::makeInstance('tx_oelib_Mail'); $eMailNotification->addRecipient($oldRegistration->getFrontEndUser()); $eMailNotification->setSender($event->getFirstOrganizer()); $eMailNotification->setSubject($this->translate('email_' . $helloSubjectPrefix . 'Subject') . ': ' . $event->getTitleAndDate('-')); $this->initializeTemplate(); $mailFormat = tx_oelib_configurationProxy::getInstance('seminars')->getAsInteger('eMailFormatForAttendees'); if ($mailFormat == self::SEND_HTML_MAIL || $mailFormat == self::SEND_USER_MAIL && $oldRegistration->getFrontEndUser()->wantsHtmlEMail()) { $eMailNotification->setCssFile($this->getConfValueString('cssFileForAttendeeMail')); $eMailNotification->setHTMLMessage($this->buildEmailContent($oldRegistration, $plugin, $helloSubjectPrefix, TRUE)); } $eMailNotification->setMessage($this->buildEmailContent($oldRegistration, $plugin, $helloSubjectPrefix)); /** @var tx_seminars_Mapper_Registration $mapper */ $mapper = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Registration'); /** @var $registration tx_seminars_Model_Registration */ $registration = $mapper->find($oldRegistration->getUid()); foreach ($this->getHooks() as $hook) { if (method_exists($hook, 'modifyThankYouEmail')) { $hook->modifyThankYouEmail($eMailNotification, $registration); } } /** @var Tx_Oelib_MailerFactory $mailerFactory */ $mailerFactory = t3lib_div::makeInstance('Tx_Oelib_MailerFactory'); $mailerFactory->getMailer()->send($eMailNotification); }
/** * Returns the items of the given table for the flexforms. * * The table to retrieve the items for must have a title column. * * The given configuration array must apply to the following convention: * - the sub-arrays "config", "row" and "items" must exist * - "config" must have an element "itemTable" with a valid table name of a * table which has a title column * - "row" must have an item "pid" with the current page ID * * @param array[] $configuration the flexforms configuration * * @return array[] the modified flexforms configuration including the items available for selection */ public function getEntriesFromGeneralStoragePage(array $configuration) { $whereClause = '1 = 1'; $table = $configuration['config']['itemTable']; if (tx_oelib_configurationProxy::getInstance('seminars')->getAsBoolean('useStoragePid')) { $rootlinePages = t3lib_befunc::BEgetRootLine($configuration['row']['pid']); foreach ($rootlinePages as $page) { $storagePid = (int) $page['storage_pid']; if ($storagePid > 0) { $whereClause = '(' . $table . '.pid = ' . $storagePid . ')'; break; } } } $items = tx_oelib_db::selectMultiple('uid,title', $table, $whereClause . tx_oelib_db::enableFields($table), '', 'title ASC'); $configuration['items'] = array(); foreach ($items as $item) { $configuration['items'][] = array(0 => $item['title'], 1 => $item['uid'], 2 => $GLOBALS['TCA'][$table]['ctrl']['iconfile']); } return $configuration; }