/** * Creates a registration in $this->registration from the database record * with the UID specified in the parameter $registrationUid. * If the registration cannot be created, $this->registration will be NULL, * and this function will return FALSE. * * @param int $registrationUid a registration UID * * @return bool TRUE if the registration UID is valid and the object has been created, FALSE otherwise */ public function createRegistration($registrationUid) { $result = FALSE; if (tx_seminars_OldModel_Abstract::recordExists($registrationUid, 'tx_seminars_attendances')) { $dbResult = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_seminars_attendances', 'tx_seminars_attendances.uid = ' . $registrationUid . tx_oelib_db::enableFields('tx_seminars_attendances')); $this->registration = t3lib_div::makeInstance('tx_seminars_registration', $this->cObj, $dbResult); if ($dbResult !== FALSE) { $GLOBALS['TYPO3_DB']->sql_free_result($dbResult); } $result = $this->registration->isOk(); if (!$result) { $this->registration = NULL; } } else { $this->registration = NULL; } return $result; }
/** * Retrieves the topic from the DB and returns it as an object. * * In case of an error, the return value will be NULL. * * @return tx_seminars_seminar the topic object (will be NULL if an error * has occured) */ private function retrieveTopic() { $result = NULL; // Check whether this event has an topic set. if ($this->hasRecordPropertyInteger('topic')) { if (tx_seminars_OldModel_Abstract::recordExists($this->getRecordPropertyInteger('topic'), 'tx_seminars_seminars')) { /** @var tx_seminars_seminar $result */ $result = t3lib_div::makeInstance('tx_seminars_seminar', $this->getRecordPropertyInteger('topic')); } } return $result; }
/** * Checks whether the currently logged in BE-User has access to the given * event and its registrations. * * Stores the type of the error in $this->errorType * * @param int $eventUid * the event to check the access for, must be >= 0 but not necessarily point to an existing event * * @return bool TRUE if the event record exists and the BE-User has * access to the registrations belonging to the event, * FALSE otherwise */ private function hasAccessToEventAndItsRegistrations($eventUid) { $result = FALSE; if (!tx_seminars_OldModel_Abstract::recordExists($eventUid, 'tx_seminars_seminars')) { $this->errorType = self::NOT_FOUND; } elseif (!$this->canAccessListOfRegistrations($eventUid)) { $this->errorType = self::ACCESS_DENIED; } else { $result = TRUE; } 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); }
/** * 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'; }