/** * Returns the places associated with this event. * * @return Tx_Oelib_List with the models for the places of this event, will be empty if this event has no places */ public function getPlaces() { if (!$this->hasPlace()) { /** @var Tx_Oelib_List $list */ $list = t3lib_div::makeInstance('tx_oelib_List'); return $list; } $places = tx_oelib_db::selectMultiple('uid, title, address, zip, city, country, homepage, directions', 'tx_seminars_sites, tx_seminars_seminars_place_mm', 'uid_local = ' . $this->getUid() . ' AND uid = uid_foreign' . tx_oelib_db::enableFields('tx_seminars_sites')); /** @var tx_seminars_Mapper_Place $mapper */ $mapper = t3lib_div::makeInstance('tx_seminars_Mapper_Place'); return $mapper->getListOfModels($places); }
/** * 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(); } }
/** * Provides data items for the list of available payment methods. * * @param array[] $items array that contains any pre-filled data (may be empty, unused) * * @return array[] items from the payment methods table as an array * with the keys "caption" (for the title) and "value" (for the uid) */ public function populateListPaymentMethods(array $items) { if (!$this->getSeminar()->hasPaymentMethods()) { return array(); } $rows = tx_oelib_db::selectMultiple('uid, title', '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=' . $this->getSeminar()->getTopicUid() . tx_oelib_db::enableFields('tx_seminars_payment_methods')); $result = array(); foreach ($rows as $row) { $result[] = array('caption' => $row['title'], 'value' => $row['uid']); } return $result; }
/** * 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; }
/** * Creates a list of places with all places that are assigned to at least * one event. * * The list of places is stored in the member variable $this->places. * * Before this function is called, it must be assured that the seminar bag * is not empty. * * @return void */ private function collectPlaces() { if ($this->seminarBag->isEmpty()) { throw new BadMethodCallException('The seminar bag must not be empty when calling this function.', 1333293276); } if ($this->places) { return; } $dataOfPlaces = tx_oelib_db::selectMultiple('tx_seminars_sites.*', 'tx_seminars_sites, tx_seminars_seminars_place_mm', 'tx_seminars_sites.uid = tx_seminars_seminars_place_mm.uid_foreign ' . 'AND tx_seminars_seminars_place_mm.uid_local IN (' . $this->seminarBag->getUids() . ')'); /** @var tx_seminars_Mapper_Place $mapper */ $mapper = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Place'); $this->places = $mapper->getListOfModels($dataOfPlaces); }