/**
  * Gets the UID of the topic record if we are a date record. Otherwise, the
  * UID of this record is returned.
  *
  * @return int either the UID of this record or its topic record,
  *                 depending on whether we are a date record
  */
 public function getTopicUid()
 {
     if ($this->isTopicOkay()) {
         return $this->topic->getUid();
     } else {
         return $this->getUid();
     }
 }
Exemple #2
0
 /**
  * Limits the bag to date event records of the same topic as the event
  * given in the first parameter $event.
  *
  * @param tx_seminars_seminar $event the date or topic object to find other dates of the same topic for
  *
  * @return void
  */
 public function limitToOtherDatesForTopic(tx_seminars_seminar $event)
 {
     if (!$event->isEventDate() && !$event->isEventTopic()) {
         throw new InvalidArgumentException('The first parameter $event must be either a date or a topic record.', 1333292764);
     }
     $this->whereClauseParts['other_dates'] = '(' . 'tx_seminars_seminars.topic = ' . $event->getTopicUid() . ' AND object_type = ' . tx_seminars_Model_Event::TYPE_DATE . ' AND uid <> ' . $event->getUid() . ')';
 }
 /**
  * Sets this registration's data if this registration is newly created instead of from a DB query.
  *
  * This function must be called directly after construction or this object will not be usable.
  *
  * @param tx_seminars_seminar $seminar the seminar object (that's the seminar we would like to register for)
  * @param int $userUid UID of the FE user who wants to sign up
  * @param array $registrationData associative array with the registration data the user has just entered, may be empty
  *
  * @return void
  */
 public function setRegistrationData(tx_seminars_seminar $seminar, $userUid, array $registrationData)
 {
     $this->seminar = $seminar;
     $this->recordData = array();
     $this->recordData['seminar'] = $seminar->getUid();
     $this->recordData['user'] = $userUid;
     $this->recordData['registration_queue'] = !$seminar->hasVacancies() ? 1 : 0;
     $seats = (int) $registrationData['seats'];
     if ($seats < 1) {
         $seats = 1;
     }
     $this->recordData['seats'] = $seats;
     $this->recordData['registered_themselves'] = $registrationData['registered_themselves'] ? 1 : 0;
     $availablePrices = $seminar->getAvailablePrices();
     // If no (available) price is selected, use the first price by default.
     $selectedPrice = isset($registrationData['price']) && $seminar->isPriceAvailable($registrationData['price']) ? $registrationData['price'] : key($availablePrices);
     $this->recordData['price'] = $availablePrices[$selectedPrice]['caption'];
     $this->recordData['total_price'] = $seats * $availablePrices[$selectedPrice]['amount'];
     $this->recordData['attendees_names'] = $registrationData['attendees_names'];
     $this->recordData['kids'] = $registrationData['kids'];
     $methodOfPayment = $registrationData['method_of_payment'];
     // Auto-select the only payment method if no payment method has been
     // selected, there actually is anything to pay and only one payment
     // method is provided.
     if (!$methodOfPayment && $this->recordData['total_price'] > 0.0 && $seminar->getNumberOfPaymentMethods() == 1) {
         $rows = tx_oelib_db::selectMultiple('uid', 'tx_seminars_payment_methods, tx_seminars_seminars_payment_methods_mm', 'tx_seminars_payment_methods.uid = tx_seminars_seminars_payment_methods_mm.uid_foreign ' . 'AND tx_seminars_seminars_payment_methods_mm.uid_local = ' . $seminar->getTopicUid() . tx_oelib_db::enableFields('tx_seminars_payment_methods'), '', 'tx_seminars_seminars_payment_methods_mm.sorting');
         $methodOfPayment = $rows[0]['uid'];
     }
     $this->recordData['method_of_payment'] = $methodOfPayment;
     $this->recordData['account_number'] = $registrationData['account_number'];
     $this->recordData['bank_code'] = $registrationData['bank_code'];
     $this->recordData['bank_name'] = $registrationData['bank_name'];
     $this->recordData['account_owner'] = $registrationData['account_owner'];
     $this->recordData['company'] = $registrationData['company'];
     $this->recordData['gender'] = $registrationData['gender'];
     $this->recordData['name'] = $registrationData['name'];
     $this->recordData['address'] = $registrationData['address'];
     $this->recordData['zip'] = $registrationData['zip'];
     $this->recordData['city'] = $registrationData['city'];
     $this->recordData['country'] = $registrationData['country'];
     $this->recordData['telephone'] = $registrationData['telephone'];
     $this->recordData['email'] = $registrationData['email'];
     $this->lodgings = isset($registrationData['lodgings']) && is_array($registrationData['lodgings']) ? $registrationData['lodgings'] : array();
     $this->recordData['lodgings'] = count($this->lodgings);
     $this->foods = isset($registrationData['foods']) && is_array($registrationData['foods']) ? $registrationData['foods'] : array();
     $this->recordData['foods'] = count($this->foods);
     $this->checkboxes = isset($registrationData['checkboxes']) && is_array($registrationData['checkboxes']) ? $registrationData['checkboxes'] : array();
     $this->recordData['checkboxes'] = count($this->checkboxes);
     $this->recordData['interests'] = $registrationData['interests'];
     $this->recordData['expectations'] = $registrationData['expectations'];
     $this->recordData['background_knowledge'] = $registrationData['background_knowledge'];
     $this->recordData['accommodation'] = $registrationData['accommodation'];
     $this->recordData['food'] = $registrationData['food'];
     $this->recordData['known_from'] = $registrationData['known_from'];
     $this->recordData['notes'] = $registrationData['notes'];
     $this->recordData['pid'] = $this->seminar->hasAttendancesPid() ? $this->seminar->getAttendancesPid() : $this->getConfValueInteger('attendancesPID');
     $this->processAdditionalRegistrationData($registrationData);
     if ($this->isOk()) {
         // Stores the user data in $this->userData.
         $this->retrieveUserData();
         $this->createTitle();
     }
 }
Exemple #4
0
 /**
  * Creates a link to the registrations page, showing the attendees for the
  * given event UID.
  *
  * @param tx_seminars_seminar $event
  *        the event to show the registrations for, must be >= 0
  *
  * @return string the URL to the registrations tab with the registration for
  *                the current event, will not be empty
  */
 private function createEventRegistrationsLink(tx_seminars_seminar $event)
 {
     $pageData = $this->page->getPageData();
     $url = t3lib_BEfunc::getModuleUrl(self::MODULE_NAME, array('id' => $pageData['uid'], 'subModule' => '2', 'eventUid' => $event->getUid()));
     return '<a href="' . htmlspecialchars($url) . '">' . $GLOBALS['LANG']->getLL('label_show_event_registrations') . '</a>';
 }
 /**
  * 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;
 }
 /**
  * Returns localized e-mail content customized for the provided event and
  * the provided organizer.
  *
  * @param string $locallangKey
  *        locallang key for the text in which to replace key words beginning with "%" by the event's data, must not be empty
  * @param tx_seminars_seminar $event
  *        event for which to customize the text
  * @param string $organizerName
  *        name of the organizer, may be empty if no organizer name needs to be inserted in the text
  *
  * @return string the localized e-mail content, will not be empty
  */
 private function customizeMessage($locallangKey, tx_seminars_seminar $event, $organizerName = '')
 {
     /** @var tx_oelib_Mapper_BackEndUser $mapper */
     $mapper = tx_oelib_MapperRegistry::get('tx_oelib_Mapper_BackEndUser');
     /** @var Tx_Oelib_Model_BackEndUser $user */
     $user = $mapper->findByCliKey();
     $GLOBALS['LANG']->lang = $user->getLanguage();
     $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath('seminars') . 'locallang.xml');
     $result = $GLOBALS['LANG']->getLL($locallangKey);
     foreach (array('%begin_date' => $this->getDate($event->getBeginDateAsTimeStamp()), '%days' => $this->getDaysBeforeBeginDate(), '%event' => $event->getTitle(), '%organizer' => $organizerName, '%registrations' => $event->getAttendances(), '%uid' => $event->getUid()) as $search => $replace) {
         $result = str_replace($search, $replace, $result);
     }
     return $result;
 }