/** * Generates and prints out a registrations list. * * @return string the HTML source code to display */ public function show() { $content = ''; $pageData = $this->page->getPageData(); $this->template->setMarker('label_attendee_full_name', $GLOBALS['LANG']->getLL('registrationlist.feuser.name')); $this->template->setMarker('label_event_accreditation_number', $GLOBALS['LANG']->getLL('registrationlist.seminar.accreditation_number')); $this->template->setMarker('label_event_title', $GLOBALS['LANG']->getLL('registrationlist.seminar.title')); $this->template->setMarker('label_event_date', $GLOBALS['LANG']->getLL('registrationlist.seminar.date')); $eventUid = (int) t3lib_div::_GP('eventUid'); /** @var tx_seminars_Mapper_Event $mapper */ $mapper = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Event'); if ($eventUid > 0 && $mapper->existsModel($eventUid)) { $this->eventUid = $eventUid; /** @var tx_seminars_Model_Event $event */ $event = $mapper->find($eventUid); $registrationsHeading = sprintf($GLOBALS['LANG']->getLL('registrationlist.label_registrationsHeading'), htmlspecialchars($event->getTitle()), $event->getUid()); $newButton = ''; } else { $registrationsHeading = ''; $newButton = $this->getNewIcon($pageData['uid']); } $areAnyRegularRegistrationsVisible = $this->setRegistrationTableMarkers(self::REGULAR_REGISTRATIONS); $registrationTables = $this->template->getSubpart('REGISTRATION_TABLE'); $this->setRegistrationTableMarkers(self::REGISTRATIONS_ON_QUEUE); $registrationTables .= $this->template->getSubpart('REGISTRATION_TABLE'); $this->template->setOrDeleteMarkerIfNotEmpty('registrations_heading', $registrationsHeading, '', 'wrapper'); $this->template->setMarker('new_record_button', $newButton); $this->template->setMarker('csv_export_button', $areAnyRegularRegistrationsVisible ? $this->getCsvIcon() : ''); $this->template->setMarker('complete_table', $registrationTables); $this->template->setMarker('label_print_button', $GLOBALS['LANG']->getLL('print')); $content .= $this->template->getSubpart('SEMINARS_REGISTRATION_LIST'); $content .= $this->configCheckWarnings; return $content; }
/** * @test */ public function frontEndUserGroupCanReturnBackEndUserModel() { $backEndUser = tx_oelib_MapperRegistry::get('tx_oelib_Mapper_BackEndUser')->getNewGhost(); $frontEndUserGroup = $this->fixture->getLoadedTestingModel(array('tx_seminars_reviewer' => $backEndUser->getUid())); /** @var tx_seminars_Model_FrontEndUserGroup $model */ $model = $this->fixture->find($frontEndUserGroup->getUid()); self::assertTrue($model->getReviewer() instanceof tx_oelib_Model_BackEndUser); }
/** * Marks an event according to the status to set and commits the change to * the database. * * @return void */ protected function setEventStatus() { $this->getEvent()->setStatus(tx_seminars_Model_Event::STATUS_CONFIRMED); /** @var tx_seminars_Mapper_Event $mapper */ $mapper = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Event'); $mapper->save($this->getEvent()); /** @var t3lib_FlashMessage $message */ $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('message_eventConfirmed'), '', t3lib_FlashMessage::OK, TRUE); $this->addFlashMessage($message); }
/** * @test */ public function makeListToFormidableListForListWithTwoElementsReturnsArrayWithTwoModels() { $targetGroup1 = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_TargetGroup')->getLoadedTestingModel(array()); $targetGroup2 = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_TargetGroup')->getLoadedTestingModel(array()); $list = new tx_oelib_List(); $list->add($targetGroup1); $list->add($targetGroup2); self::assertEquals(2, count(tx_seminars_FrontEnd_EventEditor::makeListToFormidableList($list))); }
/** * Returns whether the registration has an existing front-end user. * * @return bool TRUE if the registration has an existing front-end user, FALSE otherwise */ public function hasExistingFrontEndUser() { if ($this->getUser() <= 0) { return FALSE; } /** @var tx_seminars_Mapper_FrontEndUser $mapper */ $mapper = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_FrontEndUser'); return $mapper->existsModel($this->getUser()); }
/** * @test */ public function getAuxiliaryRecordsFolderForTwoGroupsBothWithDifferentAuxiliaryRecordPidsReturnsOnlyOneOfThePids() { $group1 = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_BackEndUserGroup')->getLoadedTestingModel(array('tx_seminars_auxiliaries_folder' => 23)); $group2 = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_BackEndUserGroup')->getLoadedTestingModel(array('tx_seminars_auxiliaries_folder' => 42)); $groups = new tx_oelib_List(); $groups->add($group1); $groups->add($group2); $this->fixture->setData(array('usergroup' => $groups)); $eventFolder = $this->fixture->getAuxiliaryRecordsFolder(); self::assertTrue($eventFolder == 23 || $eventFolder == 42); }
/** * @test */ public function getCheckboxesWithOneCheckboxReturnsOneCheckbox() { $uid = $this->testingFramework->createRecord('tx_seminars_attendances'); $checkbox = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Checkbox')->getNewGhost(); $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_attendances', $uid, $checkbox->getUid(), 'checkboxes'); /** @var tx_seminars_Model_Registration $model */ $model = $this->fixture->find($uid); self::assertEquals($checkbox->getUid(), $model->getCheckboxes()->first()->getUid()); }
public function testNewButtonForEventStoredOnCurrentPageHasCurrentFolderLabel() { $backEndUser = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_BackEndUser')->getLoadedTestingModel(array()); tx_oelib_BackEndLoginManager::getInstance()->setLoggedInUser($backEndUser); self::assertContains(sprintf($GLOBALS['LANG']->getLL('label_create_record_in_current_folder'), '', $this->dummySysFolderPid), $this->fixture->show()); }
/** * @test */ public function getCheckboxesForEventTopicWithOneCheckboxReturnsOneCheckbox() { $uid = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC)); $checkbox = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Checkbox')->getNewGhost(); $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $uid, $checkbox->getUid(), 'checkboxes'); /** @var tx_seminars_Model_Event $model */ $model = $this->fixture->find($uid); self::assertEquals($checkbox->getUid(), $model->getCheckboxes()->getUids()); }
public function testNewButtonForSpeakerStorageSettingSetInUsersGroupSetsThisPidAsNewRecordPid() { $newSpeakerFolder = $this->dummySysFolderPid + 1; $backEndGroup = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_BackEndUserGroup')->getLoadedTestingModel(array('tx_seminars_auxiliaries_folder' => $newSpeakerFolder)); $backEndUser = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_BackEndUser')->getLoadedTestingModel(array('usergroup' => $backEndGroup->getUid())); tx_oelib_BackEndLoginManager::getInstance()->setLoggedInUser($backEndUser); self::assertContains('edit[tx_seminars_speakers][' . $newSpeakerFolder . ']=new', $this->fixture->show()); }
/** * Returns the country of this place as tx_oelib_Model_Country. * * @return tx_oelib_Model_Country the country of this place */ public function getCountry() { $countryCode = $this->getAsString('country'); if ($countryCode == '') { return NULL; } try { /** @var tx_oelib_Mapper_Country $mapper */ $mapper = tx_oelib_MapperRegistry::get('tx_oelib_Mapper_Country'); $country = $mapper->findByIsoAlpha2Code($countryCode); } catch (tx_oelib_Exception_NotFound $exception) { $country = NULL; } return $country; }
protected function setUp() { $this->testingFramework = new tx_oelib_testingFramework('tx_oelib'); $this->fixture = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_BackEndUserGroup'); }
/** * @test */ public function getOwnerWithOwnerReturnsOwner() { $frontEndUser = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_FrontEndUser')->getNewGhost(); $this->fixture->setOwner($frontEndUser); self::assertSame($frontEndUser, $this->fixture->getOwner()); }
/** * Provides data items for the list of skills. * * @return array[] items as an array with the keys "caption" (for the title) and "value" (for the UID) */ public static function populateListSkills() { /** @var tx_seminars_Mapper_Skill $mapper */ $mapper = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Skill'); $skills = $mapper->findAll('title ASC'); return self::makeListToFormidableList($skills); }
/** * @test */ public function setRegistrationDataForMissingCountrySetsEmptyCountry() { $className = $this->createAccessibleProxyClass(); /** @var tx_seminars_registrationmanager $fixture */ $fixture = new $className(); /** @var tx_seminars_Model_Event $event */ $event = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Event')->getLoadedTestingModel(array()); $registration = new tx_seminars_Model_Registration(); $registration->setEvent($event); $fixture->setRegistrationData($registration, array()); self::assertSame('', $registration->getCountry()); }
/** * @test */ public function sendRemindersToOrganizersForCliBackendUserWithLanguageGermanSendsReminderInGerman() { /** @var tx_seminars_Model_BackEndUser $user */ $user = tx_oelib_MapperRegistry::get('tx_oelib_Mapper_BackEndUser')->findByCliKey(); $this->testingFramework->changeRecord('be_users', $user->getUid(), array('lang' => 'de')); tx_oelib_MapperRegistry::purgeInstance(); $this->addSpeaker($this->createSeminarWithOrganizer(array('begin_date' => $GLOBALS['SIM_EXEC_TIME'] + tx_oelib_Time::SECONDS_PER_DAY, 'cancelled' => tx_seminars_seminar::STATUS_PLANNED))); $this->fixture->sendCancellationDeadlineReminders(); $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath('seminars') . 'locallang.xml'); $GLOBALS['LANG']->lang = 'de'; $subject = $GLOBALS['LANG']->getLL('email_cancelationDeadlineReminderSubject'); $subject = str_replace('%event', '', $subject); self::assertContains($subject, $this->mailer->getFirstSentEmail()->getSubject()); }
/** * @test */ public function relationToRegistrationIsReadFromRegistrationMapper() { $registration = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Registration')->getNewGhost(); $model = $this->fixture->getLoadedTestingModel(array('tx_seminars_registration' => $registration->getUid())); self::assertSame($registration, $model->getRegistration()); }
/** * Gets this event's owner (the FE user who has created this event). * * @return tx_oelib_Model_FrontEndUser the owner, will be NULL if the event * has no owner */ public function getOwner() { if (!$this->hasRecordPropertyInteger('owner_feuser')) { return NULL; } /** @var tx_oelib_Mapper_FrontEndUser $mapper */ $mapper = tx_oelib_MapperRegistry::get('tx_oelib_Mapper_FrontEndUser'); return $mapper->find($this->getRecordPropertyInteger('owner_feuser')); }
/** * @test */ public function getPlaceWithPlaceReturnsPlaceInstance() { $place = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Place')->getNewGhost(); $timeSlotUid = $this->testingFramework->createRecord('tx_seminars_timeslots', array('place' => $place->getUid())); /** @var tx_seminars_Model_TimeSlot $model */ $model = $this->fixture->find($timeSlotUid); self::assertTrue($model->getPlace() instanceof tx_seminars_Model_Place); }
/** * @test */ public function hasImageForEventDateWithImageReturnsTrue() { $topic = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Event')->getLoadedTestingModel(array('image' => 'file.jpg')); $this->fixture->setData(array('object_type' => tx_seminars_Model_Event::TYPE_DATE, 'topic' => $topic)); self::assertTrue($this->fixture->hasImage()); }
/** * @test */ public function limitToAttendeeWithNullFindsRegistrationsWithOtherAttendee() { $feUserGroupUid = $this->testingFramework->createFrontEndUserGroup(); $feUserUid = $this->testingFramework->createFrontEndUser($feUserGroupUid); $feUserUid2 = $this->testingFramework->createFrontEndUser($feUserGroupUid); $eventUid = $this->testingFramework->createRecord('tx_seminars_seminars'); $registrationUid = $this->testingFramework->createRecord('tx_seminars_attendances', array('seminar' => $eventUid, 'user' => $feUserUid2)); /** @var tx_seminars_Model_FrontEndUser $user */ $user = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_FrontEndUser')->find($feUserUid); $this->fixture->limitToAttendee($user); $this->fixture->limitToAttendee(NULL); $bag = $this->fixture->build(); self::assertEquals($registrationUid, $bag->current()->getUid()); }
/** * @test */ public function getOwnerWithOwnerReturnsOwnerInstance() { $frontEndUser = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_FrontEndUser')->getLoadedTestingModel(array()); self::assertTrue($this->fixture->getLoadedTestingModel(array('owner' => $frontEndUser->getUid()))->getOwner() instanceof tx_seminars_Model_FrontEndUser); }
/** * Creates an FE-user with the given gender and the name "Foo". * * @param int $gender * the gender for the FE user, must be one of * "tx_oelib_Model_FrontEndUser::GENDER_MALE", * "tx_oelib_Model_FrontEndUser::GENDER_FEMALE" or * "tx_oelib_Model_FrontEndUser::GENDER_UNKNOWN", may be empty * * @return tx_seminars_Model_FrontEndUser the loaded testing model of a * FE user */ private function createFrontEndUser($gender = tx_oelib_Model_FrontEndUser::GENDER_MALE) { return tx_oelib_MapperRegistry::get('tx_seminars_Mapper_FrontEndUser')->getLoadedTestingModel(array('name' => 'Foo', 'gender' => $gender)); }
/** * @test */ public function createSingleViewLinkByWithHtmlSpecialCharsFalseNotHtmlSpecialCharsLinkText() { /** @var tx_seminars_Model_Event $event */ $event = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Event')->getLoadedTestingModel(array()); self::assertContains('Chaos & Confusion', $this->fixture->createSingleViewLink($event, 'Chaos & Confusion', FALSE)); }
/** * 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'); }
/** * @test */ public function setPaymentMethodSetsPaymentMethod() { $paymentMethod = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_PaymentMethod')->getNewGhost(); $this->fixture->setPaymentMethod($paymentMethod); self::assertSame($paymentMethod, $this->fixture->getPaymentMethod()); }
/** * @test */ public function attachRegistrationSetsEventForRegistration() { $this->fixture->setRegistrations(new tx_oelib_List()); $registration = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Registration')->getLoadedTestingModel(array()); $this->fixture->attachRegistration($registration); self::assertSame($this->fixture, $registration->getEvent()); }
/** * Returns our language. * * @return tx_oelib_Model_Language our language, will be NULL if this event * has no language set */ public function getLanguage() { if (!$this->hasLanguage()) { return NULL; } /** @var tx_oelib_Mapper_Language $mapper */ $mapper = tx_oelib_MapperRegistry::get('tx_oelib_Mapper_Language'); return $mapper->findByIsoAlpha2Code($this->getAsString('language')); }
/** * Processes hide/unhide and copy events for the FE-editable events. * * @return void */ protected function processEventEditorActions() { $this->ensureIntegerPiVars(array('seminar')); if ($this->piVars['seminar'] <= 0) { return; } // hasAccessMessage returns an empty string only if an event record with // the UID set in the piVar "seminar" exists and the currently // logged-in FE user is allowed to edit it. if ($this->createEventEditorInstance()->hasAccessMessage() !== '') { return; } /** @var tx_seminars_Mapper_Event $mapper */ $mapper = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Event'); /** @var tx_seminars_Model_Event $event */ $event = $mapper->find($this->piVars['seminar']); if (!$event->isPublished()) { return; } switch ($this->piVars['action']) { case 'hide': $this->hideEvent($event); break; case 'unhide': $this->unhideEvent($event); break; case 'copy': $this->copyEvent($event); break; default: } }
/** * @test */ public function sendEmailCallsHookWithRegistration() { $registrationUid = $this->testingFramework->createRecord('tx_seminars_attendances', array('pid' => $this->dummySysFolderUid, 'seminar' => $this->eventUid, 'user' => $this->testingFramework->createFrontEndUser('', array('email' => '*****@*****.**', 'name' => 'foo User')))); /** @var tx_seminars_Model_Registration $registration */ $registration = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Registration')->find($registrationUid); $hook = $this->getMock('tx_seminars_Interface_Hook_BackEndModule'); $hook->expects(self::once())->method('modifyCancelEmail')->with($registration, self::anything()); $hookClass = get_class($hook); $GLOBALS['T3_VAR']['getUserObj'][$hookClass] = $hook; $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seminars']['backEndModule'][$hookClass] = $hookClass; $this->fixture->setPostData(array('action' => 'confirmEvent', 'isSubmitted' => '1', 'sender' => $this->organizerUid, 'subject' => 'foo', 'messageBody' => 'some message body')); $this->fixture->render(); }