includeLLFile('EXT:wse_events/mod1/locallang.xml'); } /** * Class 'tx_wseevents_rooms' for the 'wse_events' extension. * * @package TYPO3 * @subpackage wse_events * @author Michael Oehlhof */ class tx_wseevents_rooms { /** The extension key. */ var $extKey = 'wseevents'; /** * Dummy constructor: Does nothing. * * The base classe's constructor is called in $this->init(). * * @return void ... */ function tx_wseevents_rooms() { } /** * This is the main function * * @param array TypoScript configuration for the plugin * @return void ... * @access protected */ function main($items) { return; } /** * Get list of available rooms * * @param array $PA TypoScript configuration for the plugin * @param object $fobj: ToDo: insert description * @return void ... * @access protected */ function getTCAroomlist($PA,$fobj) { global $TCA; # debug ($PA); # debug ($fobj); // --------------------- Get the location of the selected event --------------------- // Initialize variables for the database query. $tableName ='tx_wseevents_events'; $queryWhere = 'uid='.$PA['row']['event']. t3lib_BEfunc::BEenableFields($tableName). t3lib_BEfunc::deleteClause($tableName). // ' AND '.$TCA[$tableName]['ctrl']['languageField'].'=0'. t3lib_BEfunc::versioningPlaceholderClause($tableName); $additionalTables = ''; $groupBy = ''; $orderBy = 'name'; $limit = ''; // Check if event is selected, if not get first event if ($PA['row']['event'] == 0) { $queryWhere = 'pid='.$PA['row']['pid']. t3lib_BEfunc::BEenableFields($tableName). t3lib_BEfunc::deleteClause($tableName). // ' AND '.$TCA[$this->tableName]['ctrl']['languageField'].'=0'. t3lib_BEfunc::versioningPlaceholderClause($this->tableName); } // Get location of the event $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( '*', $tableName, $queryWhere, $groupBy, $orderBy, $limit); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res) ; $GLOBALS['TYPO3_DB']->sql_free_result($res); $location = $row['location']; if (!empty($location)) { $location = 'location='.$location; } else { $location = '1=1'; } // --------------------- Get the rooms of the location of the selected event --------------------- // Initialize variables for the database query. $tableName ='tx_wseevents_rooms'; $queryWhere = $location. t3lib_BEfunc::BEenableFields($tableName). t3lib_BEfunc::deleteClause($tableName). ' AND '.$TCA[$tableName]['ctrl']['languageField'].'=0'. t3lib_BEfunc::versioningPlaceholderClause($tableName); $additionalTables = ''; $groupBy = ''; $orderBy = 'name'; $limit = ''; // Get list of all rooms of the location $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( '*', $tableName, $queryWhere, $groupBy, $orderBy, $limit); // check if selected room is in location $roomfound = false; // Clear the item array $PA['items'] = array(); // Fill item array with rooms of location of selected event while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // Add the name and id to the itemlist $entry = array(); $entry[0] = $row['name']; $entry[1] = $row['uid']; $entry[2] = ''; $PA['items'][] = $entry; if ($row['uid'] = $PA['row']['room']) { $roomfound = true; } } $GLOBALS['TYPO3_DB']->sql_free_result($res); // Add the name and id of ALL ROOMS to the itemlist $entry = array(); $entry[0] = '- All rooms -'; //$LANG->getLL('timeslots.allrooms'); $entry[1] = 0; $entry[2] = ''; $PA['items'][] = $entry; // Set selected room to first room of location, if given room is from another location if (!$roomfound) { $PA['row']['room'] = $PA['items']['0']['1']; } # debug ($PA); return; } } if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/wse_events/class.tx_wseevents_rooms.php']) { include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/wse_events/class.tx_wseevents_rooms.php']); } ?>