/**
  * Gets our place as plain text (just the name).
  * Returns a localized string "will be announced" if the time slot has no
  * place set.
  *
  * @return string our places or a localized string "will be announced" if this timeslot has no place assigned
  *
  * @throws tx_oelib_Exception_Database
  * @throws tx_oelib_Exception_NotFound
  */
 public function getPlaceShort()
 {
     if (!$this->hasPlace()) {
         return $this->translate('message_willBeAnnounced');
     }
     $dbResult = $GLOBALS['TYPO3_DB']->exec_SELECTquery('title', 'tx_seminars_sites', 'uid=' . $this->getPlace() . tx_oelib_db::enableFields('tx_seminars_sites'));
     if (!$dbResult) {
         throw new tx_oelib_Exception_Database();
     }
     $dbResultRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbResult);
     $GLOBALS['TYPO3_DB']->sql_free_result($dbResult);
     if (!$dbResultRow) {
         throw new tx_oelib_Exception_NotFound('The related place with the UID ' . $this->getPlace() . ' could not be found in the DB.', 1333291925);
     }
     return $dbResultRow['title'];
 }
示例#2
0
 /**
  * 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;
 }
 /**
  * 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);
 }
示例#4
0
文件: Event.php 项目: kurtkk/seminars
 /**
  * Limits the bag to events which have a price higher or equal to the given
  * minimum price.
  *
  * @param int $minimumPrice
  *                the minimum price an event is allowed to cost, must
  *                be >= 0
  *
  * @return void
  */
 public function limitToMinimumPrice($minimumPrice)
 {
     if ($minimumPrice == 0) {
         return;
     }
     $now = $GLOBALS['SIM_EXEC_TIME'];
     $whereClause = '(object_type = ' . tx_seminars_Model_Event::TYPE_TOPIC . ' OR ' . 'object_type = ' . tx_seminars_Model_Event::TYPE_COMPLETE . ') AND (' . '(deadline_early_bird < ' . $now . ' ' . 'AND (price_regular >= ' . $minimumPrice . ' ' . 'OR price_special >= ' . $minimumPrice . ')' . ') OR (deadline_early_bird > ' . $now . ' ' . 'AND ((' . '(price_regular_early = 0 ' . 'AND price_regular >= ' . $minimumPrice . ') ' . 'OR (price_special_early = 0 ' . 'AND price_special >= ' . $minimumPrice . ')) ' . 'OR (price_regular_early >= ' . $minimumPrice . ' ' . 'OR price_special_early >= ' . $minimumPrice . ') ' . ')) ' . 'OR price_regular_board >= ' . $minimumPrice . ' ' . 'OR price_special_board >= ' . $minimumPrice . ') ' . tx_oelib_db::enableFields('tx_seminars_seminars');
     $foundUids = implode(',', tx_oelib_db::selectColumnForMultiple('uid', 'tx_seminars_seminars', $whereClause));
     if ($foundUids == '') {
         $this->whereClauseParts['maximumPrice'] = '(0 = 1)';
     } else {
         $this->whereClauseParts['maximumPrice'] = '((object_type = ' . tx_seminars_Model_Event::TYPE_COMPLETE . ' ' . 'AND tx_seminars_seminars.uid IN (' . $foundUids . ')) OR ' . '(object_type = ' . tx_seminars_Model_Event::TYPE_DATE . ' AND ' . 'topic IN (' . $foundUids . ')))';
     }
 }
示例#5
0
    /**
     * Limits the bag to registrations to which a non-deleted FE user record
     * exists.
     *
     * @return void
     */
    public function limitToExistingUsers()
    {
        $this->whereClauseParts['existingUsers'] = 'EXISTS (
			SELECT * FROM fe_users WHERE ' . ' fe_users.uid = tx_seminars_attendances.user' . tx_oelib_db::enableFields('fe_users') . ')';
    }
 /**
  * Gets a LF-separated list of the titles of records referenced by this record.
  *
  * @param string $foreignTable the name of the foreign table (must not be empty), must have the fields uid and title
  * @param string $mmTable the name of the m:m table, having the fields uid_local, uid_foreign and sorting, must not be empty
  *
  * @return string the titles of the referenced records separated by LF,
  *                might be empty if no records are referenced
  */
 private function getMmRecords($foreignTable, $mmTable)
 {
     $result = '';
     $dbResult = $GLOBALS['TYPO3_DB']->exec_SELECTquery('title, sorting', $foreignTable . ', ' . $mmTable, 'uid_local = ' . $this->getUid() . ' AND uid_foreign = uid' . tx_oelib_db::enableFields($foreignTable), '', 'sorting');
     if ($dbResult) {
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbResult)) {
             if ($result !== '') {
                 $result .= LF;
             }
             $result .= $row['title'];
         }
     }
     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;
 }
示例#8
0
 /**
  * Updates the "registrations" field of the event records.
  *
  * @return string information about the status of the update process, will not be empty
  *
  * @throws tx_oelib_Exception_Database
  */
 private function updateRegistrationsField()
 {
     $query = 'UPDATE tx_seminars_seminars SET registrations = ' . '(SELECT COUNT(*) FROM tx_seminars_attendances' . ' WHERE seminar = tx_seminars_seminars.uid ' . tx_oelib_db::enableFields('tx_seminars_attendances') . ')' . ' WHERE registrations = 0 AND EXISTS (' . 'SELECT * FROM tx_seminars_attendances' . ' WHERE seminar = tx_seminars_seminars.uid ' . tx_oelib_db::enableFields('tx_seminars_attendances') . ')';
     if (!$GLOBALS['TYPO3_DB']->sql_query($query)) {
         throw new tx_oelib_Exception_Database();
     }
     return '<h2>Updating the events.registrations field.</h2>' . '<p>Updating ' . $GLOBALS['TYPO3_DB']->sql_affected_rows() . ' event records.</p>';
 }
 /**
  * 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);
 }
示例#10
0
 /**
  * For the main DB table and the additional tables, writes the corresponding
  * concatenated output from tx_oelib_db::enableFields into
  * $this->enabledFieldsQuery.
  *
  * @param int $showHiddenRecords If $showHiddenRecords is set (0/1), any hidden-fields in records are ignored.
  * @param bool $ignoreTimingOfRecords If $ignoreTimingOfRecords is TRUE the timing of records is ignored.
  *
  * @return void
  */
 private function createEnabledFieldsQuery($showHiddenRecords = -1, $ignoreTimingOfRecords = FALSE)
 {
     $ignoreColumns = array();
     if ($ignoreTimingOfRecords) {
         $ignoreColumns = array('starttime' => TRUE, 'endtime' => TRUE);
     }
     $allTableNames = t3lib_div::trimExplode(',', $this->dbTableName . $this->additionalTableNames);
     $this->enabledFieldsQuery = '';
     foreach ($allTableNames as $currentTableName) {
         // Is there a TCA entry for that table?
         $ctrl = $GLOBALS['TCA'][$currentTableName]['ctrl'];
         if (is_array($ctrl)) {
             $this->enabledFieldsQuery .= tx_oelib_db::enableFields($currentTableName, $showHiddenRecords, $ignoreColumns);
         }
     }
 }
示例#11
0
 /**
  * Retrieves a record from the database.
  *
  * The record is retrieved from $this->tableName. Therefore $this->tableName
  * has to be set before calling this method.
  *
  * @param int $uid the UID of the record to retrieve from the DB
  * @param bool $allowHiddenRecords whether to allow hidden records
  *
  * @return resource MySQL result pointer (of SELECT query) object, will be FALSE if the UID is invalid
  */
 protected function retrieveRecord($uid, $allowHiddenRecords = FALSE)
 {
     if (!self::recordExists($uid, $this->tableName, $allowHiddenRecords)) {
         return FALSE;
     }
     return $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->tableName, 'uid=' . (int) $uid . tx_oelib_db::enableFields($this->tableName, $allowHiddenRecords), '', '', '1');
 }
示例#12
0
 /**
  * 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;
 }
 /**
  * Gets our skills as a plain text list (just the skill names).
  *
  * @return string our skills list (or an empty string if there are no
  *                skills for this speaker or there is an error)
  */
 public function getSkillsShort()
 {
     if (!$this->hasSkills()) {
         return '';
     }
     $dbResult = $GLOBALS['TYPO3_DB']->exec_SELECTquery('title', 'tx_seminars_skills, tx_seminars_speakers_skills_mm', 'uid_local = ' . $this->getUid() . ' AND uid = uid_foreign' . tx_oelib_db::enableFields('tx_seminars_skills'), '', 'sorting ASC');
     if (!$dbResult) {
         return '';
     }
     $result = array();
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbResult)) {
         $result[] = $row['title'];
     }
     return implode(', ', $result);
 }