Ejemplo n.º 1
0
 /**
  * Limits the requirements list to the requirements the user still needs to register to.
  *
  * @return void
  */
 public function limitToMissingRegistrations()
 {
     if (!tx_oelib_FrontEndLoginManager::getInstance()->isLoggedIn()) {
         throw new BadMethodCallException('No FE user is currently logged in. Please call this function only when a FE user is logged in.', 1333293236);
     }
     $this->setMarker('label_requirements', $this->translate('label_registration_requirements'));
     $this->limitRequirementsToMissing = TRUE;
 }
Ejemplo n.º 2
0
 /**
  * Returns a registrationBagBuilder object limited for registrations of the
  * currently logged in front-end user as attendee for the "my events" list
  * view.
  *
  * @return tx_seminars_BagBuilder_Registration the registrations for the
  *                                             "my events" list
  */
 private function createRegistrationBagBuilder()
 {
     /** @var tx_seminars_BagBuilder_Registration $registrationBagBuilder */
     $registrationBagBuilder = t3lib_div::makeInstance('tx_seminars_BagBuilder_Registration');
     /** @var tx_seminars_Model_FrontEndUser $loggedInUser */
     $loggedInUser = tx_oelib_FrontEndLoginManager::getInstance()->getLoggedInUser('tx_seminars_Mapper_FrontEndUser');
     $registrationBagBuilder->limitToAttendee($loggedInUser);
     $registrationBagBuilder->setOrderByEventColumn($this->getOrderByForListView());
     return $registrationBagBuilder;
 }
Ejemplo n.º 3
0
 /**
  * Checks whether a FE user is logged in and whether he/she may view this
  * seminar's registrations list.
  * This function is intended to be used from the registrations list,
  * NOT to check whether a link to that list should be shown.
  *
  * @param string $whichPlugin
  *        the type of plugin: list_registrations or list_vip_registrations
  * @param string $accessLevel
  *        who is allowed to view the front-end registration lists:
  *        "attendees_and_managers", "login" or "world"
  *
  * @return string an empty string if everything is OK, a localized error
  *                error message otherwise
  */
 public function canViewRegistrationsListMessage($whichPlugin, $accessLevel = 'attendees_and_managers')
 {
     $result = '';
     if (!$this->needsRegistration()) {
         $result = $this->translate('message_noRegistrationNecessary');
     } elseif ($accessLevel != 'world' && !tx_oelib_FrontEndLoginManager::getInstance()->isLoggedIn()) {
         $result = $this->translate('message_notLoggedIn');
     } elseif (!$this->canViewRegistrationsList($whichPlugin, $accessLevel)) {
         $result = $this->translate('message_accessDenied');
     }
     return $result;
 }
 /**
  * Removes the given registration (if it exists and if it belongs to the
  * currently logged-in FE user).
  *
  * @param int $uid the UID of the registration that should be removed
  * @param tslib_pibase $plugin a live plugin object
  *
  * @return void
  */
 public function removeRegistration($uid, tslib_pibase $plugin)
 {
     if (!tx_seminars_OldModel_Abstract::recordExists($uid, 'tx_seminars_attendances')) {
         return;
     }
     $this->registration = t3lib_div::makeInstance('tx_seminars_registration', $plugin->cObj, tx_oelib_db::select('*', 'tx_seminars_attendances', 'uid = ' . $uid . tx_oelib_db::enableFields('tx_seminars_attendances')));
     if ($this->registration->getUser() !== $this->getFeUserUid()) {
         return;
     }
     /** @var $user tx_seminars_Model_FrontEndUser */
     $user = tx_oelib_FrontEndLoginManager::getInstance()->getLoggedInUser('tx_seminars_Mapper_FrontEndUser');
     foreach ($this->getHooks() as $hook) {
         if (method_exists($hook, 'seminarRegistrationRemoved')) {
             $hook->seminarRegistrationRemoved($this->registration, $user);
         }
     }
     tx_oelib_db::update('tx_seminars_attendances', 'uid = ' . $uid, array('hidden' => 1, 'tstamp' => $GLOBALS['SIM_EXEC_TIME']));
     $this->notifyAttendee($this->registration, $plugin, 'confirmationOnUnregistration');
     $this->notifyOrganizers($this->registration, 'notificationOnUnregistration');
     $this->fillVacancies($plugin);
 }
Ejemplo n.º 5
0
 /**
  * Checks whether the currently logged-in FE user (if any) belongs to the
  * FE group that is allowed to enter and edit event records in the FE.
  * This group can be set using plugin.tx_seminars.eventEditorFeGroupID.
  *
  * It also is checked whether that event record exists and the logged-in
  * FE user is the owner or is editing a new record.
  *
  * @return string locallang key of an error message, will be an empty string if access was granted
  */
 private function checkAccess()
 {
     if (!tx_oelib_FrontEndLoginManager::getInstance()->isLoggedIn()) {
         return 'message_notLoggedIn';
     }
     $objectUid = $this->getObjectUid();
     if ($objectUid > 0 && !tx_seminars_OldModel_Abstract::recordExists($objectUid, 'tx_seminars_seminars', TRUE)) {
         return 'message_wrongSeminarNumber';
     }
     if ($objectUid > 0) {
         /** @var tx_seminars_seminar $seminar */
         $seminar = t3lib_div::makeInstance('tx_seminars_seminar', $this->getObjectUid(), FALSE, TRUE);
         $isUserVip = $seminar->isUserVip($this->getFeUserUid(), $this->getConfValueInteger('defaultEventVipsFeGroupID'));
         $isUserOwner = $seminar->isOwnerFeUser();
         $mayManagersEditTheirEvents = $this->getConfValueBoolean('mayManagersEditTheirEvents', 's_listView');
         $hasAccess = $isUserOwner || $mayManagersEditTheirEvents && $isUserVip;
     } else {
         $eventEditorGroupUid = $this->getConfValueInteger('eventEditorFeGroupID', 's_fe_editing');
         $hasAccess = $eventEditorGroupUid !== 0 && self::getLoggedInUser()->hasGroupMembership($eventEditorGroupUid);
     }
     return $hasAccess ? '' : 'message_noAccessToEventEditor';
 }
Ejemplo n.º 6
0
 /**
  * @test
  */
 public function canRegisterIfLoggedInMessageForRegistrationPossibleCallsCanUserRegisterForSeminarMessageHook()
 {
     $this->testingFramework->createAndLoginFrontEndUser();
     $user = tx_oelib_FrontEndLoginManager::getInstance()->getLoggedInUser('tx_seminars_Mapper_FrontEndUser');
     $hookClass = uniqid('tx_registrationHook');
     $hook = $this->getMock($hookClass, array('canRegisterForSeminarMessage'));
     $hook->expects(self::once())->method('canRegisterForSeminarMessage')->with($this->seminar, $user);
     $GLOBALS['T3_VAR']['getUserObj'][$hookClass] = $hook;
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seminars']['registration'][$hookClass] = $hookClass;
     $this->fixture->canRegisterIfLoggedInMessage($this->seminar);
 }
Ejemplo n.º 7
0
 /**
  * Retrieves (and converts, if necessary) the form data item with the key $key.
  *
  * @param string $key the key of the field for which the data should be retrieved
  *
  * @return string the formatted data item, will not be htmlspecialchared yet, might be empty
  *
  * @throws InvalidArgumentException
  */
 protected function getFormDataItemForConfirmationPage($key)
 {
     if (!in_array($key, $this->getAllFieldKeysForConfirmationPage(), TRUE)) {
         throw new InvalidArgumentException('The form data item ' . $key . ' is not valid on the confirmation page. Valid items are: ' . implode(', ', $this->getAllFieldKeysForConfirmationPage()), 1389813109);
     }
     // The "total_price" field doesn't exist as an actual renderlet and so cannot be read.
     $currentFormData = $key !== 'total_price' ? $this->getFormValue($key) : '';
     switch ($key) {
         case 'price':
             $currentFormData = $this->getSelectedPrice();
             break;
         case 'total_price':
             $currentFormData = $this->getTotalPriceWithUnit();
             break;
         case 'method_of_payment':
             $currentFormData = $this->getSelectedPaymentMethod();
             break;
         case 'lodgings':
             $this->ensureArray($currentFormData);
             $currentFormData = $this->getCaptionsForSelectedOptions($this->getSeminar()->getLodgings(), $currentFormData);
             break;
         case 'foods':
             $this->ensureArray($currentFormData);
             $currentFormData = $this->getCaptionsForSelectedOptions($this->getSeminar()->getFoods(), $currentFormData);
             break;
         case 'checkboxes':
             $this->ensureArray($currentFormData);
             $currentFormData = $this->getCaptionsForSelectedOptions($this->getSeminar()->getCheckboxes(), $currentFormData);
             break;
         case 'attendees_names':
             if ($this->isFormFieldEnabled('registered_themselves') && $this->getFormValue('registered_themselves') == '1') {
                 /** @var $user tx_seminars_Model_FrontEndUser */
                 $user = tx_oelib_FrontEndLoginManager::getInstance()->getLoggedInUser('tx_seminars_Mapper_FrontEndUser');
                 $userData = array($user->getName());
                 if ($this->getConfValueBoolean('createAdditionalAttendeesAsFrontEndUsers', 's_registration')) {
                     if ($user->hasJobTitle()) {
                         $userData[] = $user->getJobTitle();
                     }
                     if ($user->hasEMailAddress()) {
                         $userData[] = $user->getEMailAddress();
                     }
                 }
                 $currentFormData = implode(', ', $userData) . CR . $currentFormData;
             }
             break;
         default:
     }
     return (string) $currentFormData;
 }