/** * Get the localization of the select field items (right-hand part of form) * Referenced by TCA * * @param array $params: array of searched translation * @return void ... */ public function get_localized_categories($params) { /* $params['items'] = &$items; $params['config'] = $config; $params['TSconfig'] = $iArray; $params['table'] = $table; $params['row'] = $row; $params['field'] = $field; */ $items = $params['items']; $config = $params['config']; $table = $config['itemsProcFunc_config']['table']; // initialize backend user language if ($GLOBALS['LANG']->lang && t3lib_extMgm::isLoaded('static_info_tables')) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_language.uid', 'sys_language LEFT JOIN static_languages ON sys_language.static_lang_isocode=static_languages.uid', 'static_languages.lg_typo3=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($GLOBALS['LANG']->lang, 'static_languages') . t3lib_pageSelect::enableFields('sys_language') . t3lib_pageSelect::enableFields('static_languages')); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $this->sys_language_uid = $row['uid']; $this->collate_locale = $row['lg_collate_locale']; } } if (is_array($params['items'])) { reset($params['items']); while (list($k, $item) = each($params['items'])) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid=' . intval($item[1])); while ($rowCat = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $localizedRowCat = tx_srfeuserregister_dmstatic::getRecordOverlay($table, $rowCat, $this->sys_language_uid, ''); if ($localizedRowCat) { $params['items'][$k][0] = $localizedRowCat['category']; } } } } }
/** * Wrapper function for t3lib_pageSelect::enableFields() since it is no * longer accessible statically. * * Returns a part of a WHERE clause which will filter out records with * start/end times or deleted/hidden/fe_groups fields set to values that * should de-select them according to the current time, preview settings or * user login. * Is using the $TCA arrays "ctrl" part where the key "enablefields" * determines for each table which of these features applies to that table. * * @param string $tableName * table name found in the $TCA array * @param integer $showHidden * If $showHidden is set (0/1), any hidden-fields in records are * ignored. NOTICE: If you call this function, consider what to do * with the show_hidden parameter. * @param array $ignoreArray * Array you can pass where keys can be "disabled", "starttime", * "endtime", "fe_group" (keys from "enablefields" in TCA) and if set * they will make sure that part of the clause is not added. Thus * disables the specific part of the clause. For previewing etc. * @param boolean $noVersionPreview * If set, enableFields will be applied regardless of any versioning * preview settings which might otherwise disable enableFields. * * @return string the WHERE clause starting like " AND ...=... AND ...=..." * * @throws InvalidArgumentException */ public static function enableFields($tableName, $showHidden = -1, array $ignoreArray = array(), $noVersionPreview = FALSE) { if (!in_array($showHidden, array(-1, 0, 1))) { throw new InvalidArgumentException('$showHidden may only be -1, 0 or 1, but actually is ' . $showHidden, 1331315445); } // maps $showHidden (-1..1) to (0..2) which ensures valid array keys $showHiddenKey = $showHidden + 1; $ignoresKey = serialize($ignoreArray); $previewKey = intval($noVersionPreview); if (!isset(self::$enableFieldsCache[$tableName][$showHiddenKey][$ignoresKey][$previewKey])) { self::retrievePageForEnableFields(); self::$enableFieldsCache[$tableName][$showHiddenKey][$ignoresKey][$previewKey] = self::$pageForEnableFields->enableFields($tableName, $showHidden, $ignoreArray, $noVersionPreview); } return self::$enableFieldsCache[$tableName][$showHiddenKey][$ignoresKey][$previewKey]; }