/** * Add metadata configuration * * @access protected * * @return void */ protected function cmdAddMetadata() { // Include metadata definition file. include_once t3lib_extMgm::extPath($this->extKey) . 'modules/' . $this->modPath . 'metadata.inc.php'; // Load table configuration array to get default field values. if (version_compare(TYPO3_branch, '6.1', '<')) { t3lib_div::loadTCA('tx_dlf_metadata'); } $i = 0; // Build data array. foreach ($metadata as $index_name => $values) { $formatIds = array(); foreach ($values['format'] as $format) { $formatIds[] = uniqid('NEW'); $data['tx_dlf_metadataformat'][end($formatIds)] = $format; $data['tx_dlf_metadataformat'][end($formatIds)]['pid'] = intval($this->id); $i++; } $data['tx_dlf_metadata'][uniqid('NEW')] = array('pid' => intval($this->id), 'label' => $GLOBALS['LANG']->getLL($index_name), 'index_name' => $index_name, 'format' => implode(',', $formatIds), 'default_value' => $values['default_value'], 'wrap' => !empty($values['wrap']) ? $values['wrap'] : $GLOBALS['TCA']['tx_dlf_metadata']['columns']['wrap']['config']['default'], 'tokenized' => $values['tokenized'], 'stored' => $values['stored'], 'indexed' => $values['indexed'], 'boost' => $values['boost'], 'is_sortable' => $values['is_sortable'], 'is_facet' => $values['is_facet'], 'is_listed' => $values['is_listed'], 'autocomplete' => $values['autocomplete']); $i++; } $_ids = tx_dlf_helper::processDBasAdmin($data); // Check for failed inserts. if (count($_ids) == $i) { // Fine. $_message = t3lib_div::makeInstance('t3lib_FlashMessage', tx_dlf_helper::getLL('flash.metadataAddedMsg'), tx_dlf_helper::getLL('flash.metadataAdded', TRUE), t3lib_FlashMessage::OK, FALSE); } else { // Something went wrong. $_message = t3lib_div::makeInstance('t3lib_FlashMessage', tx_dlf_helper::getLL('flash.metadataNotAddedMsg'), tx_dlf_helper::getLL('flash.metadataNotAdded', TRUE), t3lib_FlashMessage::ERROR, FALSE); } t3lib_FlashMessageQueue::addMessage($_message); }
/** * Manipulating the input array, $params, adding new selectorbox items. * * @param array array of select field options (reference) * @param object parent object (reference) * @return void */ function main(&$params, &$pObj) { t3lib_div::loadTCA('tt_address'); // TODO consolidate with list in pi1 $coreSortFields = 'gender, first_name, middle_name, last_name, title, company, ' . 'address, building, room, birthday, zip, city, region, country, email, www, phone, mobile, ' . 'fax, addressgroup'; $sortFields = t3lib_div::trimExplode(',', $coreSortFields); $selectOptions = array(); foreach ($sortFields as $field) { $label = $GLOBALS['LANG']->sL($GLOBALS['TCA']['tt_address']['columns'][$field]['label']); $label = substr($label, 0, -1); $selectOptions[] = array('field' => $field, 'label' => $label); } // add sorting by order of single selection $selectOptions[] = array('field' => 'singleSelection', 'label' => $GLOBALS['LANG']->sL('LLL:EXT:tt_address/pi1/locallang_ff.xml:pi1_flexform.sortBy.singleSelection')); // sort by labels $labels = array(); foreach ($selectOptions as $key => $v) { $labels[$key] = $v['label']; } $labels = array_map('strtolower', $labels); array_multisort($labels, SORT_ASC, $selectOptions); // add fields to <select> foreach ($selectOptions as $option) { $params['items'][] = array($option['label'], $option['field']); } }
/** * Adds an entry to the "ds" array of the tt_content field "ce_flexform". * * @param string The same value as the key for the plugin * @param string Either a reference to a flex-form XML file (eg. "FILE:EXT:newloginbox/flexform_ds.xml") or the XML directly. * @return void */ function txdam_addCTypeFlexFormValue($piKeyToMatch, $value, $field = 'ce_flexform') { global $TCA; t3lib_div::loadTCA('tt_content'); if (is_array($TCA['tt_content']['columns']) && is_array($TCA['tt_content']['columns'][$field]['config']['ds'])) { $TCA['tt_content']['columns'][$field]['config']['ds'][$piKeyToMatch] = $value; } }
function main() { global $BE_USER, $BACK_PATH, $LANG; $params = t3lib_div::_GP('P'); t3lib_div::loadTCA($params['table']); $params['wConf'] = $GLOBALS['TCA'][$params['table']]['columns'][$params['field']]['config']['wizards']['googlemap']; $params['row'] = t3lib_BEfunc::getRecord($params['table'], $params['uid']); $this->content = ''; $wiz = $this->renderWizard($params); $this->content .= $this->doc->startPage($LANG->getLL('mlang_tabs_tab')); $this->content .= $wiz; }
function main(&$backRef, $menuItems, $table, $uid) { global $BE_USER, $TCA, $LANG, $TYPO3_CONF_VARS; // Returns directly, because the clicked item was rendered by t3lib_TCEforms::getClickMenu() if ($backRef->iParts[3] == '+copy,info,edit,view') { return $menuItems; } // Returns directly, because the clicked item was not from the DAM table if ($table != 'tx_dam') { return $menuItems; } $this->backRef =& $backRef; $item = $backRef->rec; // just clear the whole menu $menuItems = array(); if (is_array($backRef->rec)) { if ($backRef->cmLevel == 0) { t3lib_div::loadTCA($table); $calcPerms = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages', $table === 'pages' ? $backRef->rec['uid'] : $backRef->rec['pid'])); $permsEdit = $calcPerms & 16; $permsDelete = $calcPerms & 16; $item['__type'] = 'record'; $item['__table'] = $table; $actionCall = t3lib_div::makeInstance('tx_dam_actionCall'); if (is_array($backRef->disabledItems)) { foreach ($backRef->disabledItems as $idName) { $actionCall->removeAction($idName); } } $actionCall->setRequest('context', $item); $actionCall->setEnv('returnUrl', t3lib_div::_GP('returnUrl')); $actionCall->setEnv('backPath', $backRef->PH_backPath); $actionCall->setEnv('defaultCmdScript', PATH_txdam_rel . 'mod_cmd/index.php'); $actionCall->setEnv('defaultEditScript', PATH_txdam_rel . 'mod_edit/index.php'); $actionCall->setEnv('calcPerms', $calcPerms); $actionCall->setEnv('permsEdit', $permsEdit); $actionCall->setEnv('permsDelete', $permsDelete); $actionCall->setEnv('cmLevel', $backRef->cmLevel); $actionCall->initActions(true); $actions = $actionCall->renderActionsContextMenu(true); foreach ($actions as $id => $action) { if ($action['isDivider']) { $menuItems[$id] = 'spacer'; } else { $onclick = $action['onclick'] ? $action['onclick'] : $this->createOnClick($action['url'], $action['dontHide']); $menuItems[$id] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($action['label']), $backRef->excludeIcon($action['icon']), $onclick, $action['onlyCM'], $action['dontHide']); } } } else { } } return $menuItems; }
/** * Sets all fields that are related to a member record to read-only mode, * if a related_member is configured in the current $row. * * @param string $table * @param array $row * @param t3lib_TCEforms $formEngine */ public function getMainFields_preProcess($table, array $row, t3lib_TCEforms $formEngine) { if ($table !== 'tx_typo3agencies_domain_model_agency') { return; } if (empty($row['related_member'])) { return; } t3lib_div::loadTCA('tx_typo3agencies_domain_model_agency'); foreach ($this->agencyColumns as $columnName) { $GLOBALS['TCA']['tx_typo3agencies_domain_model_agency']['columns'][$columnName]['config']['readOnly'] = true; } }
/** * Generates extension site map. * * @return void */ protected function generateSitemapContent() { $selector = trim(t3lib_div::_GP('selector')); t3lib_div::loadTCA($selector); $typoscriptSelector = $selector . '.'; $currentSetup = $GLOBALS['TSFE']->tmpl->setup['plugin.']['dd_googlesitemap_dmf.'][$typoscriptSelector]; $pidList = $currentSetup['pidList'] ? t3lib_div::intExplode(',', $currentSetup['pidList']) : $this->pidList; $catList = t3lib_div::_GP('catList') ? t3lib_div::intExplode(',', t3lib_div::_GP('catList')) : t3lib_div::intExplode(',', $currentSetup['catList']); $catMMList = t3lib_div::_GP('catMMList') ? t3lib_div::intExplode(',', t3lib_div::_GP('catMMList')) : t3lib_div::intExplode(',', $currentSetup['catMMList']); $currentSetup['singlePid'] = t3lib_div::_GP('singlePid') ? intval(t3lib_div::_GP('singlePid')) : intval($currentSetup['singlePid']); $currentSetup['languageUid'] = ''; if (!$currentSetup['disableLanguageCheck']) { if (is_int($GLOBALS['TSFE']->sys_language_uid)) { // set language through TSFE checkup $currentSetup['languageUid'] = intval($GLOBALS['TSFE']->sys_language_uid); } if (t3lib_div::_GP('L')) { // overwrites if L param is set $currentSetup['languageUid'] = intval(t3lib_div::_GP('L')); } } if (count($pidList) > 0 && isset($selector) && isset($currentSetup)) { $table = $currentSetup['sqlMainTable']; $mmTable = $currentSetup['sqlMMTable']; $catColumn = $currentSetup['sqlCatColumn']; $sqlCondition = $catColumn && count($catList) > 0 && $catList[0] > 0 ? ' AND ' . $catColumn . ' IN (' . implode(',', $catList) . ')' : ''; $sqlMMCondition = $sqlMMTable = ''; if ($mmTable != '' && count($catMMList) > 0 && $catMMList[0] > 0) { $sqlMMTable = ',' . $mmTable; $sqlMMCondition = ' AND ' . $table . '.uid = ' . $mmTable . '.uid_local AND ' . $mmTable . '.uid_foreign IN (' . implode(',', $catMMList) . ')'; } $newsSelect = t3lib_div::_GP('type') == 'news' ? ',' . $currentSetup['sqlTitle'] . ',' . $currentSetup['sqlKeywords'] : ''; $languageWhere = is_int($currentSetup['languageUid']) ? ' AND ' . $table . '.sys_language_uid=' . $currentSetup['languageUid'] : ''; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,' . $currentSetup['sqlLastUpdated'] . $newsSelect, $table . $sqlMMTable, 'pid IN (' . implode(',', $pidList) . ')' . $sqlCondition . $sqlMMCondition . $this->cObj->enableFields($table) . $languageWhere, 'uid', $currentSetup['sqlOrder'] ? $currentSetup['sqlOrder'] : ''); $rowCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res); while (FALSE !== ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) { if ($url = $this->getVariousItemUrl($row['uid'], $currentSetup)) { $frequency = $currentSetup['frequency'] ? $currentSetup['frequency'] : $this->getChangeFrequency($row[$currentSetup['sqlLastUpdated']]); echo $this->renderer->renderEntry($url, $row[$currentSetup['sqlTitle']], $row[$currentSetup['sqlLastUpdated']], $frequency, $row[$currentSetup['sqlKeywords']]); } } $GLOBALS['TYPO3_DB']->sql_free_result($res); if ($rowCount === 0) { echo '<!-- It appears that there are no extension entries. If your ' . 'storage sysfolder is outside of the rootline, you may ' . 'want to use the dd_googlesitemap.skipRootlineCheck=1 TS ' . 'setup option. Beware: it is insecure and may cause certain ' . 'undesired effects! Better move your pid sysfolder ' . 'inside the rootline! -->'; } elseif (!$rowCount) { echo '<!-- There is an sql error. please check all corresponding sql fields in your typoscript setup. -->'; } } else { echo 'There is something wrong with the config. Please check your selector and pidList elements. You may ' . 'want to use the dd_googlesitemap.skipRootlineCheck=1 TS ' . 'setup option if your storage sysfolder is outside the rootline. Beware: it is insecure and may cause certain ' . 'undesired effects! Better move your pid sysfolder ' . 'inside the rootline! -->'; } }
/** * Adding fe_users field list to selector box array * * @param array Parameters, changing "items". Passed by reference. * @param object Parent object * @return void */ function main(&$params, &$pObj) { global $TCA; t3lib_div::loadTCA('fe_users'); $params['items'] = array(); if (is_array($TCA['fe_users']['columns'])) { foreach ($TCA['fe_users']['columns'] as $key => $config) { if ($config['label'] && !t3lib_div::inList('password', $key)) { $label = t3lib_div::fixed_lgd(ereg_replace(':$', '', $GLOBALS['LANG']->sL($config['label'])), 30) . ' (' . $key . ')'; $params['items'][] = array($label, $key); } } } }
public function init() { if (TYPO3_VERSION_INTEGER >= 7000000) { $this->lang = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Lang\\LanguageService'); } else { if (TYPO3_VERSION_INTEGER >= 6002000) { $this->lang = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('language'); } else { $this->lang = t3lib_div::makeInstance('language'); } } if (TYPO3_VERSION_INTEGER < 6001000) { t3lib_div::loadTCA('tx_kesearch_index'); } }
/** * Returns the columns part of the external import configuration for the given table and index * * @param string $table Name of the table * @param string|integer $index Key of the configuration * @return array The relevant TCA configuration */ public function findColumnsByTableAndIndex($table, $index) { t3lib_div::loadTCA($table); if (isset($GLOBALS['TCA'][$table]['columns'])) { $columns = array(); $columnsConfiguration = $GLOBALS['TCA'][$table]['columns']; ksort($columnsConfiguration); foreach ($columnsConfiguration as $columnName => $columnData) { if (isset($columnData['external'][$index])) { $columns[$columnName] = $columnData['external'][$index]; } } } else { $columns = NULL; } return $columns; }
/** * treat the values before handling by t3lib_TCEmain * * We replace empty values with our custom NULL values here for dates and times * * @param array $fieldArray * @param string $table * @param integer $id * @param t3lib_TCEmain $tce */ public function processDatamap_preProcessFieldArray(&$fieldArray, $table, $id, $tce) { if ($table == 'tx_czsimplecal_domain_model_event' || $table == 'tx_czsimplecal_domain_model_exception') { t3lib_div::loadTCA($table); foreach (array('start_time', 'end_date', 'end_time', 'recurrance_until') as $fieldName) { if (array_key_exists($fieldName, $fieldArray)) { /* * this must be an empty string, not "0"! * - empty strings are created by the clear field button introduced with TYPO3 4.5 and by deleting a value * - "0" means midnight, so don't strip it */ if ($fieldArray[$fieldName] === '') { $fieldArray[$fieldName] = $GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['default']; } } } } }
function getSingleField_beforeRender($table, $field, &$row, &$PA) { global $TCA; if ($table == 'tx_caretaker_instance' && $field === 'testconfigurations') { switch ($PA['fieldConf']['config']['tag']) { case 'testconfigurations.test_service': /* * / if (count($PA['fieldConf']['config']['items']) != count($TCA['tx_caretaker_test']['columns']['test_service']['config']['items'])) { t3lib_div::loadTCA('tx_caretaker_test'); $PA['fieldConf']['config']['items'] = $TCA['tx_caretaker_test']['columns']['test_service']['config']['items']; } // */ break; case 'testconfigurations.test_conf': $test = $this->getFFValue($table, $row, $field, str_replace('test_conf', 'test_service', $PA['itemFormElName'])); // get related test configuration $testrow = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,test_service,test_conf', 'tx_caretaker_test', 'uid=' . intval($test) . t3lib_BEfunc::deleteClause('tx_caretaker_test')); $row['test_service'] = $testrow[0]['test_service']; if ($PA['itemFormElValue'] == NULL) { $PA['itemFormElValue'] = $testrow[0]['test_conf']; } if (is_array($PA['itemFormElValue'])) { $PA['itemFormElValue'] = t3lib_div::array2xml($PA['itemFormElValue']); } if (!is_array($PA['fieldConf']['config']['ds'])) { t3lib_div::loadTCA('tx_caretaker_test'); $PA['fieldConf']['config']['ds'] = $TCA['tx_caretaker_test']['columns']['test_conf']['config']['ds']; } // var_dump($PA['fieldConf']['config']['ds']); /* * / $row['test_service'] = $test; if (!is_array($PA['fieldConf']['config']['ds'])) { t3lib_div::loadTCA('tx_caretaker_test'); $PA['fieldConf']['config']['ds'] = $TCA['tx_caretaker_test']['columns']['test_conf']['config']['ds']; } // FIXME $PA['itemFormElValue']=''; // */ break; } } }
/** * Creates part of query for searching after a word ($this->searchString) fields in input table * * DBAL specific: no LIKE for numeric fields, in this case "uid" (breaks on Oracle) * no LIKE for BLOB fields, skip * * @param string Table, in which the fields are being searched. * @return string Returns part of WHERE-clause for searching, if applicable. */ function makeSearchString($table) { // Make query, only if table is valid and a search string is actually defined: if ($GLOBALS['TCA'][$table] && $this->searchString) { // Loading full table description - we need to traverse fields: t3lib_div::loadTCA($table); // Initialize field array: $sfields = array(); $or = ''; // add the uid only if input is numeric, cast to int if (is_numeric($this->searchString)) { $queryPart = ' AND (uid=' . (int) $this->searchString . ' OR '; } else { $queryPart = ' AND ('; } if ($GLOBALS['TYPO3_DB']->runningADOdbDriver('oci8')) { foreach ($GLOBALS['TCA'][$table]['columns'] as $fieldName => $info) { if ($GLOBALS['TYPO3_DB']->cache_fieldType[$table][$fieldName]['metaType'] === 'B') { // skip, LIKE is not supported on BLOB columns... } elseif ($info['config']['type'] === 'text' || $info['config']['type'] === 'input' && !preg_match('/date|time|int/', $info['config']['eval'])) { $queryPart .= $or . $fieldName . ' LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($this->searchString, $table) . '%\''; $or = ' OR '; } } } else { // Traverse the configured columns and add all columns that can be searched foreach ($GLOBALS['TCA'][$table]['columns'] as $fieldName => $info) { if ($info['config']['type'] === 'text' || $info['config']['type'] === 'input' && !preg_match('/date|time|int/', $info['config']['eval'])) { $sfields[] = $fieldName; } } // If search-fields were defined (and there always are) we create the query: if (count($sfields)) { $like = ' LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($this->searchString, $table) . '%\''; // Free-text $queryPart .= implode($like . ' OR ', $sfields) . $like; } } // Return query: return $queryPart . ')'; } }
function getMainFields_preProcess($table, &$row, $tceform) { if ($table == 'tx_woehrlseminare_domain_model_event') { global $TCA; t3lib_div::loadTCA('tx_woehrlseminare_domain_model_event'); if ($row['author'] == 0 || empty($row['author'])) { $row['author'] = $GLOBALS['BE_USER']->user['uid']; } if (empty($row['contact_name'])) { $row['contact_name'] = $GLOBALS['BE_USER']->user['realName']; } if (empty($row['contact_email'])) { $row['contact_email'] = $GLOBALS['BE_USER']->user['email']; } if (empty($row['end_date_time_select']) && empty($row['end_date_time'])) { $row['end_date_time_select'] = 60; } if (empty($row['sub_end_date_time_select']) && empty($row['sub_end_date_time'])) { $row['sub_end_date_time_select'] = 1440; } } }
/** * Constructor of this class */ public function __construct() { // get extension configuration array $this->extConf = tx_kesearch_helper::getExtConf(); $this->extConfPremium = tx_kesearch_helper::getExtConfPremium(); if (TYPO3_VERSION_INTEGER >= 7000000) { $this->registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry'); } else { if (TYPO3_VERSION_INTEGER >= 6002000) { $this->registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_Registry'); } else { $this->registry = t3lib_div::makeInstance('t3lib_Registry'); } } // fetch the list of the default indexers which come with ke_search // load TCA definition first (only necessary in TYPO3 below 6.1) if (TYPO3_VERSION_INTEGER < 6001000) { t3lib_div::loadTCA('tx_kesearch_indexerconfig'); } foreach ($GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['type']['config']['items'] as $indexerType) { $this->defaultIndexerTypes[] = $indexerType[1]; } }
/** * Get record data from the given table and uid * * @param array $parameter A table 'table', field name 'field' and the value 'value' to find the record * @return The first found record as an array or FALSE if no record was found */ public function execute($parameter = array()) { $table = $parameter['table']; $field = $parameter['field']; $value = $parameter['value']; $checkEnableFields = $parameter['checkEnableFields'] == TRUE; $t3Version = floatval($GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version']); if ($t3Version >= 6.0) { \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); } else { $this->includeTCA(); t3lib_div::loadTCA($table); } if (!isset($GLOBALS['TCA'][$table])) { return new tx_caretakerinstance_OperationResult(FALSE, 'Table [' . $table . '] not found in the TCA'); } if (!isset($GLOBALS['TCA'][$table]['columns'][$field]) && !in_array($field, $this->implicitFields)) { return new tx_caretakerinstance_OperationResult(FALSE, 'Field [' . $field . '] of table [' . $table . '] not found in the TCA'); } $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, $field . ' = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value, $table) . ($checkEnableFields ? $this->enableFields($table) : '')); if ($result) { $record = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); if ($record !== FALSE) { if (isset($this->protectedFieldsByTable[$table])) { $protectedFields = $this->protectedFieldsByTable[$table]; foreach ($protectedFields as $protectedField) { unset($record[$protectedField]); } } return new tx_caretakerinstance_OperationResult(TRUE, $record); } else { return new tx_caretakerinstance_OperationResult(TRUE, FALSE); } } else { return new tx_caretakerinstance_OperationResult(FALSE, 'Error when executing SQL: [' . $GLOBALS['TYPO3_DB']->sql_error() . ']'); } }
function setVirtualTable($virtual, $existant) { global $BE_USER, $TCA; // fake table - to be safe t3lib_div::loadTCA($existant); $TCA[$virtual] = $TCA[$existant]; $this->virtual = $virtual; $TCA[$virtual]['orig_table'] = $existant; $this->savedGroupData = $BE_USER->groupData; $checkFields = array('explicit_allowdeny', 'tables_select', 'tables_modify', 'non_exclude_fields'); foreach ($checkFields as $key) { $addList = ''; $checkList = t3lib_div::trimExplode(',', $BE_USER->groupData[$key], 1); foreach ($checkList as $val) { list($table, $field) = explode(':', $val, 2); if ($val == $existant) { $addList .= ',' . $virtual; } elseif ($table == $existant and $field) { $addList .= ',' . $virtual . ':' . $field; } } $BE_USER->groupData[$key] .= $addList; } }
public static function registerNotificationExitPoint($extKey, $path, $key, $title, $description = '') { global $TCA; t3lib_div::loadTCA('tx_caretaker_exitpoints'); // Register test service t3lib_extMgm::addService('caretaker', 'caretaker_exitpoint', $key, array('title' => $title, 'description' => $description, 'subtype' => $key, 'available' => TRUE, 'priority' => 50, 'quality' => 50, 'os' => '', 'exec' => '', 'classFile' => t3lib_extMgm::extPath($extKey) . $path . '/class.' . $key . 'ExitPoint.php', 'className' => $key . 'ExitPoint')); // Add exitpoint to TCA if (is_array($TCA['tx_caretaker_exitpoints']['columns']) && is_array($TCA['tx_caretaker_exitpoints']['columns']['service']['config']['items'])) { $TCA['tx_caretaker_exitpoints']['columns']['service']['config']['items'][] = array($title, $key); } // Add flexform to service-item if (is_array($TCA['tx_caretaker_exitpoints']['columns']) && is_array($TCA['tx_caretaker_exitpoints']['columns']['config']['config']['ds'])) { $TCA['tx_caretaker_exitpoints']['columns']['config']['config']['ds'][$key] = 'FILE:EXT:' . $extKey . '/' . $path . '/' . ($flexform ? $flexform : 'ds.' . $key . 'ExitPoint.xml'); } }
/** * Creates part of query for searching after a word ($searchString) fields in input table * * @param string Table, in which the fields are being searched. * @param string search string * @return string Returns part of WHERE-clause for searching, if applicable. */ function makeSearchQueryPart($table, $searchString) { global $TCA; // Make query, only if table is valid and a search string is actually defined: if ($TCA[$table] && $searchString) { // Loading full table description - we need to traverse fields: t3lib_div::loadTCA($table); // Initialize field array: $sfields = array(); $sfields[] = 'uid'; // Adding "uid" by default. // Traverse the configured columns and add all columns that can be searched: foreach ($TCA[$table]['columns'] as $fieldName => $info) { if ($info['config']['type'] === 'text' || $info['config']['type'] === 'input' && !preg_match('/date|time|int/', $info['config']['eval'])) { $sfields[] = $table . '.' . $fieldName; } } // If search-fields were defined (and there always are) we create the query: if (count($sfields)) { $likeStr = $GLOBALS['TYPO3_DB']->escapeStrForLike($searchString, $table); $like = ' LIKE ' . $GLOBALS['TYPO3_DB']->fullQuoteStr('%' . $likeStr . '%', $table); // Free-text searching... $queryPart = '(' . implode($like . ' OR ', $sfields) . $like . ')'; // Return query: return $queryPart; } } }
/** * Create visual difference view of two records. Using t3lib_diff library * * @param string Table name * @param array New version record (green) * @param array Old version record (red) * @return array Array with two keys (0/1) with HTML content / percentage integer (if -1, then it means N/A) indicating amount of change */ function createDiffView($table, $diff_1_record, $diff_2_record) { global $TCA, $LANG; // Initialize: $pctChange = 'N/A'; // Check that records are arrays: if (is_array($diff_1_record) && is_array($diff_2_record)) { // Load full table description and initialize diff-object: t3lib_div::loadTCA($table); $t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff'); // Add header row: $tRows = array(); $tRows[] = ' <tr class="bgColor5 tableheader"> <td>' . $LANG->getLL('diffview_label_field_name') . '</td> <td width="98%" nowrap="nowrap">' . $LANG->getLL('diffview_label_colored_diff_view') . '</td> </tr> '; // Initialize variables to pick up string lengths in: $allStrLen = 0; $diffStrLen = 0; // Traversing the first record and process all fields which are editable: foreach ($diff_1_record as $fN => $fV) { if ($TCA[$table]['columns'][$fN] && $TCA[$table]['columns'][$fN]['config']['type'] != 'passthrough' && !t3lib_div::inList('t3ver_label', $fN)) { // Check if it is files: $isFiles = FALSE; if (strcmp(trim($diff_1_record[$fN]), trim($diff_2_record[$fN])) && $TCA[$table]['columns'][$fN]['config']['type'] == 'group' && $TCA[$table]['columns'][$fN]['config']['internal_type'] == 'file') { // Initialize: $uploadFolder = $TCA[$table]['columns'][$fN]['config']['uploadfolder']; $files1 = array_flip(t3lib_div::trimExplode(',', $diff_1_record[$fN], 1)); $files2 = array_flip(t3lib_div::trimExplode(',', $diff_2_record[$fN], 1)); // Traverse filenames and read their md5 sum: foreach ($files1 as $filename => $tmp) { $files1[$filename] = @is_file(PATH_site . $uploadFolder . '/' . $filename) ? md5(t3lib_div::getUrl(PATH_site . $uploadFolder . '/' . $filename)) : $filename; } foreach ($files2 as $filename => $tmp) { $files2[$filename] = @is_file(PATH_site . $uploadFolder . '/' . $filename) ? md5(t3lib_div::getUrl(PATH_site . $uploadFolder . '/' . $filename)) : $filename; } // Implode MD5 sums and set flag: $diff_1_record[$fN] = implode(' ', $files1); $diff_2_record[$fN] = implode(' ', $files2); $isFiles = TRUE; } // If there is a change of value: if (strcmp(trim($diff_1_record[$fN]), trim($diff_2_record[$fN]))) { // Get the best visual presentation of the value and present that: $val1 = t3lib_BEfunc::getProcessedValue($table, $fN, $diff_2_record[$fN], 0, 1); $val2 = t3lib_BEfunc::getProcessedValue($table, $fN, $diff_1_record[$fN], 0, 1); // Make diff result and record string lenghts: $diffres = $t3lib_diff_Obj->makeDiffDisplay($val1, $val2, $isFiles ? 'div' : 'span'); $diffStrLen .= $t3lib_diff_Obj->differenceLgd; $allStrLen .= strlen($val1 . $val2); // If the compared values were files, substituted MD5 hashes: if ($isFiles) { $allFiles = array_merge($files1, $files2); foreach ($allFiles as $filename => $token) { if (strlen($token) == 32 && strstr($diffres, $token)) { $filename = t3lib_BEfunc::thumbCode(array($fN => $filename), $table, $fN, $this->doc->backPath) . $filename; $diffres = str_replace($token, $filename, $diffres); } } } ############# new hook for post processing of DAM images if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/user/ws/class.wslib_gui.php']['postProcessDiffView'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/user/ws/class.wslib_gui.php']['postProcessDiffView'] as $classRef) { $hookObject =& t3lib_div::getUserObj($classRef); if (method_exists($hookObject, 'postProcessDiffView')) { $diffres = $hookObject->postProcessDiffView($table, $fN, $diff_2_record, $diff_1_record, $diffres, $this); } } } ############# // Add table row with result: $tRows[] = ' <tr class="bgColor4"> <td>' . htmlspecialchars($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table, $fN))) . '</td> <td width="98%">' . $diffres . '</td> </tr> '; } else { // Add string lengths even if value matched - in this was the change percentage is not high if only a single field is changed: $allStrLen += strlen($diff_1_record[$fN] . $diff_2_record[$fN]); } } } // Calculate final change percentage: $pctChange = $allStrLen ? ceil($diffStrLen * 100 / $allStrLen) : -1; // Create visual representation of result: if (count($tRows) > 1) { $content .= '<table border="0" cellpadding="1" cellspacing="1" class="diffTable">' . implode('', $tRows) . '</table>'; } else { $content .= '<span class="nobr">' . $this->doc->icons(1) . $LANG->getLL('diffview_complete_match') . '</span>'; } } else { $content .= $this->doc->icons(3) . $LANG->getLL('diffview_cannot_find_records'); } // Return value: return array($content, $pctChange); }
$TCA['tt_content']['columns']['select_key']['config']['wizards']['link']['JSopenParams'] = 'height=400,width=600,status=0,menubar=0,scrollbars=1'; $TCA['tt_content']['columns']['select_key']['config']['eval'] = 'trim'; // t3lib_extMgm::addToAllTCAtypes('tt_content','tx_hetools_filelist_layout', 'uploads', 'after:select_key'); // zusätzliche Felder als Palette einfügen // Neue Palette erzeugen $palettenNr = max(array_keys($TCA['tt_content']['palettes'])) + 1; $TCA['tt_content']['palettes'][$palettenNr] = array(); $TCA['tt_content']['palettes'][$palettenNr]['showitem'] = 'tx_hetools_filelist_dateitypen, ' . 'tx_hetools_filelist_sortierfeld, ' . 'tx_hetools_filelist_sortierung, ' . '--linebreak--, ' . 'tx_hetools_filelist_layout'; $TCA['tt_content']['palettes'][$palettenNr]['canNotCollapse'] = '1'; t3lib_extMgm::addToAllTCAtypes('tt_content', '--palette--;Optionen zu den Dateiverweisen;' . $palettenNr, 'uploads', 'after:select_key'); // Feld 'layout' im Bereich upload ausblenden $uploadItems = explode(',', $TCA['tt_content']['types']['uploads']['showitem']); foreach ($uploadItems as $index => $text) { $eintrag = trim($text); if (strpos($eintrag, 'layout') !== FALSE && strpos($eintrag, 'layout') == 0) { unset($uploadItems[$index]); } } $TCA['tt_content']['types']['uploads']['showitem'] = implode(',', $uploadItems); // Ende Dateiverweise $damColumns = array('tx_hetools_dam_sortiernummer' => array('exclude' => 1, 'label' => 'Sortiernummer', 'config' => array('type' => 'input', 'size' => '3'))); t3lib_div::loadTCA('tx_dam'); t3lib_extMgm::addTCAcolumns('tx_dam', $damColumns, 1); t3lib_extMgm::addToAllTCAtypes('tx_dam', 'tx_hetools_dam_sortiernummer'); $TCA['tx_dam']['txdamInterface']['index_fieldList'] .= ',tx_hetools_dam_sortiernummer'; // Kontext-sensitive Hilfetexte ändern t3lib_extMgm::addLLrefForTCAdescr('tt_content', 'EXT:he_tools/lang/locallang_csh_tt_content.php'); if (TYPO3_MODE == 'BE') { t3lib_extMgm::addModulePath('web_txhetoolsM1', t3lib_extMgm::extPath($_EXTKEY) . 'mod1/'); t3lib_extMgm::addModule('web', 'txhetoolsM1', '', t3lib_extMgm::extPath($_EXTKEY) . 'mod1/'); }
<?php if (!defined('TYPO3_MODE')) { die('Access denied.'); } $TCA["tx_dlcubehnshop_articles"] = array("ctrl" => array('title' => 'LLL:EXT:dlcube_hn_shop/locallang_db.xml:tx_dlcubehnshop_articles', 'label' => 'title', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', "sortby" => "sorting", "delete" => "deleted", "enablecolumns" => array("disabled" => "hidden", "starttime" => "starttime", "endtime" => "endtime", "fe_group" => "fe_group"), "dynamicConfigFile" => t3lib_extMgm::extPath($_EXTKEY) . "tca.php", "iconfile" => t3lib_extMgm::extRelPath($_EXTKEY) . "icon_tx_dlcubehnshop_articles.gif"), "feInterface" => array("fe_admin_fieldList" => "hidden, starttime, endtime, fe_group, ref, ref2, title, auteur, editor, support, designation, descdetail, parut, price, tva,cotypresta,cosstypresta isbn, weight, nbpages, archive, technicaldegree, img1, img2, file")); $TCA["tx_dlcubehnshop_editors"] = array("ctrl" => array('title' => 'LLL:EXT:dlcube_hn_shop/locallang_db.xml:tx_dlcubehnshop_editors', 'label' => 'name', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', "default_sortby" => "ORDER BY crdate", "delete" => "deleted", "enablecolumns" => array("disabled" => "hidden"), "dynamicConfigFile" => t3lib_extMgm::extPath($_EXTKEY) . "tca.php", "iconfile" => t3lib_extMgm::extRelPath($_EXTKEY) . "icon_tx_dlcubehnshop_editors.gif"), "feInterface" => array("fe_admin_fieldList" => "hidden, name, infos")); t3lib_div::loadTCA("tt_content"); //$TCA["tt_content"]["types"]["list"]["subtypes_excludelist"][$_EXTKEY."_pi1"]="layout,select_key"; //$TCA["tt_content"]["types"]["list"]["subtypes_excludelist"][$_EXTKEY."_pi1"]="layout"; #t3lib_extMgm::addPlugin(Array("LLL:EXT:dlcube_hn_shop/locallang_db.php:tt_content.list_type", $_EXTKEY."_pi1"),"list_type"); t3lib_extMgm::addPlugin(array("Rayon de boutique HN", $_EXTKEY . "_pi1"), "list_type"); t3lib_extMgm::allowTableOnStandardPages("tx_dlcubehnshop_articles"); t3lib_extMgm::addToInsertRecords("tx_dlcubehnshop_articles");
/** * Checks the array for elements which might contain unallowed default values and will unset them! * Looks for the "tt_content_defValues" key in each element and if found it will traverse that array as fieldname / value pairs and check. The values will be added to the "params" key of the array (which should probably be unset or empty by default). * * @param array Wizard items, passed by reference * @return void */ function removeInvalidElements(&$wizardItems) { global $TCA; // Load full table definition: t3lib_div::loadTCA('tt_content'); // Get TCEFORM from TSconfig of current page $TCEFORM_TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig('tt_content', array('pid' => $this->id)); $removeItems = t3lib_div::trimExplode(',', $TCEFORM_TSconfig['CType']['removeItems'], 1); $headersUsed = array(); // Traverse wizard items: foreach ($wizardItems as $key => $cfg) { // Exploding parameter string, if any (old style) if ($wizardItems[$key]['params']) { // Explode GET vars recursively $tempGetVars = t3lib_div::explodeUrl2Array($wizardItems[$key]['params'], TRUE); // If tt_content values are set, merge them into the tt_content_defValues array, unset them from $tempGetVars and re-implode $tempGetVars into the param string (in case remaining parameters are around). if (is_array($tempGetVars['defVals']['tt_content'])) { $wizardItems[$key]['tt_content_defValues'] = array_merge(is_array($wizardItems[$key]['tt_content_defValues']) ? $wizardItems[$key]['tt_content_defValues'] : array(), $tempGetVars['defVals']['tt_content']); unset($tempGetVars['defVals']['tt_content']); $wizardItems[$key]['params'] = t3lib_div::implodeArrayForUrl('', $tempGetVars); } } // If tt_content_defValues are defined...: if (is_array($wizardItems[$key]['tt_content_defValues'])) { // Traverse field values: foreach ($wizardItems[$key]['tt_content_defValues'] as $fN => $fV) { if (is_array($TCA['tt_content']['columns'][$fN])) { // Get information about if the field value is OK: $config =& $TCA['tt_content']['columns'][$fN]['config']; $authModeDeny = $config['type'] == 'select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode('tt_content', $fN, $fV, $config['authMode']); if ($authModeDeny || in_array($fV, $removeItems)) { // Remove element all together: unset($wizardItems[$key]); break; } else { // Add the parameter: $wizardItems[$key]['params'] .= '&defVals[tt_content][' . $fN . ']=' . rawurlencode($fV); $tmp = explode('_', $key); $headersUsed[$tmp[0]] = $tmp[0]; } } } } } // Remove headers without elements foreach ($wizardItems as $key => $cfg) { list($itemCategory, $dummy) = explode('_', $key); if (!isset($headersUsed[$itemCategory])) { unset($wizardItems[$key]); } } }
function renderTree() { t3lib_div::loadTCA($this->fieldConfig['foreign_table']); $orderBy = $GLOBALS['TCA'][$this->fieldConfig['foreign_table']]['ctrl']['sortby'] ? $this->fieldConfig['foreign_table'] . '.' . $GLOBALS['TCA'][$this->fieldConfig['foreign_table']]['ctrl']['sortby'] : substr($GLOBALS['TCA'][$this->fieldConfig['foreign_table']]['ctrl']['default_sortby'], 9); $treeViewObj = t3lib_div::makeInstance('tx_cpstcatree_treeview'); $treeViewObj->thisScript = 'class.tx_cpstcatree.php'; $treeViewObj->title = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->fieldConfig['foreign_table']]['ctrl']['title']); $treeViewObj->treeName = $this->table . '_' . $this->field . '_tree'; $treeViewObj->table = $this->fieldConfig['foreign_table']; // Set parent field of table if (isset($this->fieldConfig['treeViewParentField'])) { $this->parentField = $this->fieldConfig['treeViewParentField']; } else { $this->parentField = $GLOBALS['TCA'][$this->fieldConfig['foreign_table']]['ctrl']['treeParentField']; } if (!$this->parentField) { $this->parentField = 'pid'; } $treeViewObj->parentField = $this->parentField; $treeViewObj->parentField = $this->parentField; // Set select fields $treeViewObj->fieldArray = array('uid'); $treeViewObj->addField($GLOBALS['TCA'][$treeViewObj->table]['ctrl']['label']); if (isset($GLOBALS['TCA'][$treeViewObj->table]['ctrl']['label_alt'])) { $treeViewObj->addField($GLOBALS['TCA'][$treeViewObj->table]['ctrl']['label_alt']); } $treeViewObj->tceFormsTable = $this->table; if ($this->table == 'tt_content') { $treeViewObj->tceFormsField = $this->field . ',' . $this->fieldConfig['piFlexFormSheet'] . ',' . $this->fieldConfig['piFlexFormLang'] . ',' . $this->fieldConfig['piFlexFormValue'] . ',' . $this->row['CType'] . ',' . $this->row['list_type']; } else { $treeViewObj->tceFormsField = $this->field; } $treeViewObj->tceFormsRecID = $this->row['uid']; $treeViewObj->ext_IconMode = '0'; $treeViewObj->treeView = $this->fieldConfig['treeView']; $treeViewObj->expandable = $this->fieldConfig['expandable']; $treeViewObj->expandFirst = $this->fieldConfig['expandFirst']; $treeViewObj->expandAll = $this->fieldConfig['expandAll']; $treeViewObj->ignorePermsClause = $this->fieldConfig['ignorePermsClause']; // Get TSconfig $TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig($this->table, $this->row); // Get TSconfig for field if ($this->table == 'tt_content') { $fieldTSconfig = t3lib_TCEforms::setTSconfig($this->table, $this->row); $fieldTSconfig = $fieldTSconfig['pi_flexform'][$this->row['list_type'] . '.'][$this->field . '.']; } else { $fieldTSconfig = t3lib_TCEforms::setTSconfig($this->table, $this->row, $this->field); } $clause = ''; // removeItems if (isset($fieldTSconfig['removeItems'])) { $this->removeItems = tx_cpsdevlib_div::toListArray(tx_cpsdevlib_db::getRootLineDownwards($treeViewObj->table, $treeViewObj->parentField, $fieldTSconfig['removeItems']), '', 1, 1, 1); } // keepItems if (isset($fieldTSconfig['keepItems'])) { $this->keepItems = tx_cpsdevlib_div::toListArray($fieldTSconfig['keepItems']); if (count($this->removeItems)) { // If items were removed from list check keepItems to add back foreach ($this->keepItems as $value) { if (($key = array_search($value, $this->removeItems)) !== false) { unset($this->removeItems[$key]); // Get rootline upwards to restore parent items $rL = tx_cpsdevlib_div::toListArray(tx_cpsdevlib_db::getRootLineUpwards($treeViewObj->table, 'pid', $value), '', 1, 1, 1); foreach ($rL as $v) { if (($k = array_search($v, $this->removeItems)) !== false) { $treeViewObj->TCEforms_nonSelectableItemsArray[] = $v; unset($this->removeItems[$k]); } } } } } else { // If just keepItems is set only show selected if (count($this->keepItems)) { $clause = ' AND ' . $treeViewObj->table . '.uid IN (' . implode(',', $this->keepItems) . ')'; } } } if (count($this->removeItems)) { $clause = ' AND ' . $treeViewObj->table . '.uid NOT IN (' . implode(',', $this->removeItems) . ')'; } // hideItems if (isset($fieldTSconfig['hideItems'])) { $this->hideItems = tx_cpsdevlib_div::toListArray($fieldTSconfig['hideItems']); $treeViewObj->TCEforms_nonSelectableItemsArray = array_merge($treeViewObj->TCEforms_nonSelectableItemsArray, $this->hideItems); } // Add foreign_table_where if ($this->fieldConfig['foreign_table_where']) { // Remove ORDER BY part if present if (strpos(strtolower($this->fieldConfig['foreign_table_where']), 'order by') !== false) { $ftWhere = substr($this->fieldConfig['foreign_table_where'], 0, strpos(strtolower($this->fieldConfig['foreign_table_where']), 'order by')); } else { $ftWhere = $this->fieldConfig['foreign_table_where']; } // Replace record maker in foreign_table_where if (strstr($ftWhere, '###REC_FIELD_')) { $ftWhereParts = explode('###REC_FIELD_', $ftWhere); foreach ($ftWhereParts as $key => $value) { if ($key) { $ftWhereSubpart = explode('###', $value, 2); if (substr($ftWhereParts[0], -1) === '\'' && $ftWhereSubpart[1][0] === '\'') { $ftWhereParts[$key] = $GLOBALS['TYPO3_DB']->quoteStr($TSconfig['_THIS_ROW'][$ftWhereSubpart[0]], $treeViewObj->table) . $ftWhereSubpart[1]; } else { $ftWhereParts[$key] = $GLOBALS['TYPO3_DB']->fullQuoteStr($TSconfig['_THIS_ROW'][$ftWhereSubpart[0]], $treeViewObj->table) . $ftWhereSubpart[1]; } } } $ftWhere = implode('', $ftWhereParts); } // Replace special marker in foreign_table_where $ftWhere = str_replace('###CURRENT_PID###', intval($TSconfig['_CURRENT_PID']), $ftWhere); $ftWhere = str_replace('###THIS_UID###', intval($TSconfig['_THIS_UID']), $ftWhere); $ftWhere = str_replace('###THIS_CID###', intval($TSconfig['_THIS_CID']), $ftWhere); $ftWhere = str_replace('###STORAGE_PID###', intval($TSconfig['_STORAGE_PID']), $ftWhere); $ftWhere = str_replace('###SITEROOT###', intval($TSconfig['_SITEROOT']), $ftWhere); $ftWhere = str_replace('###PAGE_TSCONFIG_ID###', intval($TSconfig[$this->field]['PAGE_TSCONFIG_ID']), $ftWhere); $ftWhere = str_replace('###PAGE_TSCONFIG_IDLIST###', $GLOBALS['TYPO3_DB']->cleanIntList($TSconfig[$this->field]['PAGE_TSCONFIG_IDLIST']), $ftWhere); $ftWhere = str_replace('###PAGE_TSCONFIG_STR###', $GLOBALS['TYPO3_DB']->quoteStr($TSconfig[$this->field]['PAGE_TSCONFIG_STR'], $this->fieldConfig['foreign_table']), $ftWhere); $clause .= ' ' . trim($ftWhere); } // Hook to manipulate clause $parameter = array('clause' => &$clause, 'treeViewObj' => &$treeViewObj); tx_cpsdevlib_div::callHookObjects('cps_tcatree', 'changeClauseHook', $parameter, $this); $treeViewObj->init($clause, $orderBy); $treeViewObj->TCEforms_itemFormElName = $this->itemFormElName; if ($this->table == $this->fieldConfig['foreign_table']) { $treeViewObj->TCEforms_nonSelectableItemsArray[] = $this->row['uid']; } $treeViewObj->TCEforms_selectedItemsArray = $this->selectedItems; $treeViewObj->selectedItemsArrayParents = $this->getItemRootline($this->selectedItems); $treeContent = $treeViewObj->getBrowsableTree(); return $treeContent; }
/** * [Describe function...] * * @param [type] $fN: ... * @param [type] $fV: ... * @param [type] $conf: ... * @param [type] $table: ... * @param [type] $splitString: ... * @return [type] ... */ function makeValueList($fN, $fV, $conf, $table, $splitString) { $fieldSetup = $conf; $out = ''; if ($fieldSetup['type'] == 'files') { $d = dir(PATH_site . $fieldSetup['uploadfolder']); while (FALSE !== ($entry = $d->read())) { if ($entry == '.' || $entry == '..') { continue; } $fileArray[] = $entry; } $d->close(); natcasesort($fileArray); while (list(, $fileName) = each($fileArray)) { if (t3lib_div::inList($fV, $fileName) || $fV == $fileName) { if (!$out) { $out = htmlspecialchars($fileName); } else { $out .= $splitString . htmlspecialchars($fileName); } } } } if ($fieldSetup['type'] == 'multiple') { foreach ($fieldSetup['items'] as $key => $val) { if (substr($val[0], 0, 4) == 'LLL:') { $value = $GLOBALS['LANG']->sL($val[0]); } else { $value = $val[0]; } if (t3lib_div::inList($fV, $val[1]) || $fV == $val[1]) { if (!$out) { $out = htmlspecialchars($value); } else { $out .= $splitString . htmlspecialchars($value); } } } } if ($fieldSetup['type'] == 'binary') { foreach ($fieldSetup['items'] as $Key => $val) { if (substr($val[0], 0, 4) == 'LLL:') { $value = $GLOBALS['LANG']->sL($val[0]); } else { $value = $val[0]; } if (!$out) { $out = htmlspecialchars($value); } else { $out .= $splitString . htmlspecialchars($value); } } } if ($fieldSetup['type'] == 'relation') { if ($fieldSetup['items']) { foreach ($fieldSetup['items'] as $key => $val) { if (substr($val[0], 0, 4) == 'LLL:') { $value = $GLOBALS['LANG']->sL($val[0]); } else { $value = $val[0]; } if (t3lib_div::inList($fV, $value) || $fV == $value) { if (!$out) { $out = htmlspecialchars($value); } else { $out .= $splitString . htmlspecialchars($value); } } } } global $TCA; if (stristr($fieldSetup['allowed'], ',')) { $from_table_Arr = explode(',', $fieldSetup['allowed']); $useTablePrefix = 1; if (!$fieldSetup['prepend_tname']) { $checkres = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fN, $table, 'uid ' . t3lib_BEfunc::deleteClause($table), $groupBy = '', $orderBy = '', $limit = ''); if ($checkres) { while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($checkres)) { if (stristr($row[$fN], ',')) { $checkContent = explode(',', $row[$fN]); foreach ($checkContent as $singleValue) { if (!stristr($singleValue, '_')) { $dontPrefixFirstTable = 1; } } } else { $singleValue = $row[$fN]; if (strlen($singleValue) && !stristr($singleValue, '_')) { $dontPrefixFirstTable = 1; } } } $GLOBALS['TYPO3_DB']->sql_free_result($checkres); } } } else { $from_table_Arr[0] = $fieldSetup['allowed']; } if ($fieldSetup['prepend_tname']) { $useTablePrefix = 1; } if ($fieldSetup['foreign_table']) { $from_table_Arr[0] = $fieldSetup['foreign_table']; } $counter = 0; foreach ($from_table_Arr as $from_table) { if ($useTablePrefix && !$dontPrefixFirstTable && $counter != 1 || $counter == 1) { $tablePrefix = $from_table . '_'; } $counter = 1; if (is_array($TCA[$from_table])) { t3lib_div::loadTCA($from_table); $labelField = $TCA[$from_table]['ctrl']['label']; $altLabelField = $TCA[$from_table]['ctrl']['label_alt']; if ($TCA[$from_table]['columns'][$labelField]['config']['items']) { reset($TCA[$from_table]['columns'][$labelField]['config']['items']); while (list(, $labelArray) = each($TCA[$from_table]['columns'][$labelField]['config']['items'])) { if (substr($labelArray[0], 0, 4) == 'LLL:') { $labelFieldSelect[$labelArray[1]] = $GLOBALS['LANG']->sL($labelArray[0]); } else { $labelFieldSelect[$labelArray[1]] = $labelArray[0]; } } $useSelectLabels = 1; } if ($TCA[$from_table]['columns'][$altLabelField]['config']['items']) { reset($TCA[$from_table]['columns'][$altLabelField]['config']['items']); foreach ($TCA[$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) { if (substr($altLabelArray[0], 0, 4) == 'LLL:') { $altLabelFieldSelect[$altLabelArray[1]] = $GLOBALS['LANG']->sL($altLabelArray[0]); } else { $altLabelFieldSelect[$altLabelArray[1]] = $altLabelArray[0]; } } $useAltSelectLabels = 1; } $altLabelFieldSelect = $altLabelField ? ',' . $altLabelField : ''; $select_fields = 'uid,' . $labelField . $altLabelFieldSelect; if (!$GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) { $webMounts = $GLOBALS['BE_USER']->returnWebmounts(); $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $webMountPageTree = ''; foreach ($webMounts as $key => $val) { if ($webMountPageTree) { $webMountPageTreePrefix = ','; } $webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($val, 999, $begin = 0, $perms_clause); } if ($from_table == 'pages') { $where_clause = 'uid IN (' . $webMountPageTree . ') ' . t3lib_BEfunc::deleteClause($from_table) . ' AND ' . $perms_clause; } else { $where_clause = 'pid IN (' . $webMountPageTree . ') ' . t3lib_BEfunc::deleteClause($from_table); } } else { $where_clause = 'uid' . t3lib_BEfunc::deleteClause($from_table); } $orderBy = 'uid'; if (!$this->tableArray[$from_table]) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy, $limit = ''); $this->tableArray[$from_table] = array(); } if ($res) { while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $this->tableArray[$from_table][] = $row; } $GLOBALS['TYPO3_DB']->sql_free_result($res); } reset($this->tableArray[$from_table]); foreach ($this->tableArray[$from_table] as $key => $val) { $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 1 ? 'on' : $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix']; $prefixString = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 'on' ? '' : ' [' . $tablePrefix . $val['uid'] . '] '; if (t3lib_div::inList($fV, $tablePrefix . $val['uid']) || $fV == $tablePrefix . $val['uid']) { if ($useSelectLabels) { if (!$out) { $out = htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]); } else { $out .= $splitString . htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]); } } elseif ($val[$labelField]) { if (!$out) { $out = htmlspecialchars($prefixString . $val[$labelField]); } else { $out .= $splitString . htmlspecialchars($prefixString . $val[$labelField]); } } elseif ($useAltSelectLabels) { if (!$out) { $out = htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]); } else { $out .= $splitString . htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]); } } else { if (!$out) { $out = htmlspecialchars($prefixString . $val[$altLabelField]); } else { $out .= $splitString . htmlspecialchars($prefixString . $val[$altLabelField]); } } } } } } } return $out; }
/** * Returns an array with rows for subrecords with parent_id IN ($uidList). * * @param integer $uidList UID list of records * @param integer $level Level depth. How deep walk into the tree. Default is 1. * @param string $fields List of fields to select (default is '*'). * @param string $table Table name. Default 'tx_dam_cat' * @param string $where Additional WHERE clause, eg. " AND blablabla=0" * @return array Returns the rows if found, otherwise empty array */ function getSubRecords($uidList, $level = 1, $fields = '*', $table = 'tx_dam_cat', $where = '') { $rows = array(); while ($level && $uidList) { $level--; $newIdList = array(); t3lib_div::loadTCA($table); $ctrl = $GLOBALS['TCA'][$table]['ctrl']; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $ctrl['treeParentField'] . ' IN (' . $uidList . ') ' . $where . $this->damSel->qg->enableFields($table)); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $rows[$row['uid']] = $row; $newIdList[] = $row['uid']; } $uidList = implode(',', $newIdList); } return $rows; }
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'select_key'; $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform,recursive'; t3lib_extMgm::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_list.xml'); } if (TYPO3_MODE === 'BE') { /** * Registers a Backend Module */ Tx_Extbase_Utility_Extension::registerModule($_EXTKEY, 'web', 'tx_blogexample_m1', '', array('Blog' => 'index,new,create,delete,deleteAll,edit,update,populate', 'Post' => 'index,show,new,create,delete,edit,update', 'Comment' => 'create,delete,deleteAll'), array('access' => 'user,group', 'icon' => 'EXT:blog_example/ext_icon.gif', 'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mod.xml')); } /** * Add labels for context sensitive help (CSH) */ t3lib_extMgm::addLLrefForTCAdescr('_MOD_web_BlogExampleTxBlogexampleM1', 'EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_csh.xml'); t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'BlogExample setup'); t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript/DefaultStyles', 'BlogExample CSS Styles (optional)'); t3lib_extMgm::allowTableOnStandardPages('tx_blogexample_domain_model_blog'); $TCA['tx_blogexample_domain_model_blog'] = array('ctrl' => array('title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_blog', 'label' => 'title', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'versioningWS' => 2, 'versioning_followPages' => true, 'origUid' => 't3_origuid', 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l18n_parent', 'transOrigDiffSourceField' => 'l18n_diffsource', 'delete' => 'deleted', 'enablecolumns' => array('disabled' => 'hidden'), 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/Blog.php', 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/icon_tx_blogexample_domain_model_blog.gif')); t3lib_extMgm::allowTableOnStandardPages('tx_blogexample_domain_model_post'); $TCA['tx_blogexample_domain_model_post'] = array('ctrl' => array('title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_post', 'label' => 'title', 'label_alt' => 'author', 'label_alt_force' => TRUE, 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'versioningWS' => 2, 'versioning_followPages' => true, 'origUid' => 't3_origuid', 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l18n_parent', 'transOrigDiffSourceField' => 'l18n_diffsource', 'delete' => 'deleted', 'enablecolumns' => array('disabled' => 'hidden'), 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/Post.php', 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/icon_tx_blogexample_domain_model_post.gif')); t3lib_extMgm::allowTableOnStandardPages('tx_blogexample_domain_model_comment'); $TCA['tx_blogexample_domain_model_comment'] = array('ctrl' => array('title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_comment', 'label' => 'date', 'label_alt' => 'author', 'label_alt_force' => TRUE, 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'delete' => 'deleted', 'enablecolumns' => array('disabled' => 'hidden'), 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/Comment.php', 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/icon_tx_blogexample_domain_model_comment.gif')); t3lib_extMgm::allowTableOnStandardPages('tx_blogexample_domain_model_person'); $TCA['tx_blogexample_domain_model_person'] = array('ctrl' => array('title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_person', 'label' => 'lastname', 'label_alt' => 'firstname', 'label_alt_force' => TRUE, 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'versioningWS' => 2, 'versioning_followPages' => true, 'origUid' => 't3_origuid', 'prependAtCopy' => 'LLL:EXT:lang/locallang_general.xml:LGL.prependAtCopy', 'delete' => 'deleted', 'enablecolumns' => array('disabled' => 'hidden'), 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/Person.php', 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/icon_tx_blogexample_domain_model_person.gif')); t3lib_extMgm::allowTableOnStandardPages('tx_blogexample_domain_model_tag'); $TCA['tx_blogexample_domain_model_tag'] = array('ctrl' => array('title' => 'LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:tx_blogexample_domain_model_tag', 'label' => 'name', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'delete' => 'deleted', 'enablecolumns' => array('disabled' => 'hidden'), 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/Tag.php', 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/icon_tx_blogexample_domain_model_tag.gif')); t3lib_div::loadTCA('fe_users'); if (is_array($TCA['fe_users']['columns']['tx_extbase_type'])) { $TCA['fe_users']['types']['Tx_BlogExample_Domain_Model_Administrator'] = $TCA['fe_users']['types']['0']; array_push($TCA['fe_users']['columns']['tx_extbase_type']['config']['items'], array('LLL:EXT:blog_example/Resources/Private/Language/locallang_db.xml:fe_users.tx_extbase_type.Tx_BlogExample_Domain_Model_Administrator', 'Tx_BlogExample_Domain_Model_Administrator')); }
<?php if (!defined('TYPO3_MODE')) { die('Access denied.'); } if (TYPO3_MODE == 'BE') { // register the cache in BE so it will be cleared with "clear all caches" try { t3lib_cache::initializeCachingFramework(); $GLOBALS['typo3CacheFactory']->create('tx_extbase_cache_reflection', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['options']); } catch (t3lib_cache_exception_NoSuchCache $exception) { } $TBE_MODULES['_dispatcher'][] = 'Tx_Extbase_Dispatcher'; } $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['extbase'][] = 'tx_extbase_utility_extbaserequirementscheck'; t3lib_div::loadTCA('fe_users'); if (!isset($TCA['fe_groups']['ctrl']['type'])) { $tempColumns = array('tx_extbase_type' => array('exclude' => 1, 'label' => 'LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_users.tx_extbase_type', 'config' => array('type' => 'select', 'items' => array(array('LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_users.tx_extbase_type.0', '0'), array('LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_users.tx_extbase_type.Tx_Extbase_Domain_Model_FrontendUser', 'Tx_Extbase_Domain_Model_FrontendUser')), 'size' => 1, 'maxitems' => 1, 'default' => '0'))); t3lib_extMgm::addTCAcolumns('fe_users', $tempColumns, 1); t3lib_extMgm::addToAllTCAtypes('fe_users', 'tx_extbase_type'); $TCA['fe_users']['ctrl']['type'] = 'tx_extbase_type'; } $TCA['fe_users']['types']['Tx_Extbase_Domain_Model_FrontendUser'] = $TCA['fe_users']['types']['0']; t3lib_div::loadTCA('fe_groups'); if (!isset($TCA['fe_groups']['ctrl']['type'])) { $tempColumns = array('tx_extbase_type' => array('exclude' => 1, 'label' => 'LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_groups.tx_extbase_type', 'config' => array('type' => 'select', 'items' => array(array('LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_groups.tx_extbase_type.0', '0'), array('LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_groups.tx_extbase_type.Tx_Extbase_Domain_Model_FrontendUserGroup', 'Tx_Extbase_Domain_Model_FrontendUserGroup')), 'size' => 1, 'maxitems' => 1, 'default' => '0'))); t3lib_extMgm::addTCAcolumns('fe_groups', $tempColumns, 1); t3lib_extMgm::addToAllTCAtypes('fe_groups', 'tx_extbase_type'); $TCA['fe_groups']['ctrl']['type'] = 'tx_extbase_type'; } $TCA['fe_groups']['types']['Tx_Extbase_Domain_Model_FrontendUserGroup'] = $TCA['fe_groups']['types']['0'];
<?php if (!defined('TYPO3_MODE')) { die('Access denied.'); } t3lib_div::loadTCA('tt_content'); $TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY . '_pi1'] = 'layout,select_key,pages'; $TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY . '_pi1'] = ''; t3lib_extMgm::addPlugin(array('LLL:EXT:user_azeliz_contacts/locallang_db.xml:tt_content.list_type_pi1', $_EXTKEY . '_pi1', t3lib_extMgm::extRelPath($_EXTKEY) . 'ext_icon.gif'), 'list_type'); // Ajout FLexForm $TCA["tt_content"]["types"]["list"]["subtypes_addlist"][$_EXTKEY . "_pi1"] = "pi_flexform"; t3lib_extMgm::addPiFlexFormValue($_EXTKEY . '_pi1', 'FILE:EXT:' . $_EXTKEY . '/flexform_ds.xml'); if (TYPO3_MODE == 'BE') { $TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']['user_azelizcontacts_pi1_wizicon'] = t3lib_extMgm::extPath($_EXTKEY) . 'pi1/class.user_azelizcontacts_pi1_wizicon.php'; }
/** * Initialization of the class. * * @param string List of group/select items * @param string Comma list of tables, first table takes priority if no table is set for an entry in the list. * @param string Name of a MM table. * @param integer Local UID for MM lookup * @param string current table name * @param integer TCA configuration for current field * @return void */ function start($itemlist, $tablelist, $MMtable = '', $MMuid = 0, $currentTable = '', $conf = array()) { // SECTION: MM reverse relations $this->MM_is_foreign = $conf['MM_opposite_field'] ? 1 : 0; $this->MM_oppositeField = $conf['MM_opposite_field']; $this->MM_table_where = $conf['MM_table_where']; $this->MM_hasUidField = $conf['MM_hasUidField']; $this->MM_match_fields = is_array($conf['MM_match_fields']) ? $conf['MM_match_fields'] : array(); $this->MM_insert_fields = is_array($conf['MM_insert_fields']) ? $conf['MM_insert_fields'] : $this->MM_match_fields; $this->currentTable = $currentTable; if ($this->MM_is_foreign) { $tmp = $conf['type'] === 'group' ? $conf['allowed'] : $conf['foreign_table']; // normally, $conf['allowed'] can contain a list of tables, but as we are looking at a MM relation from the foreign side, it only makes sense to allow one one table in $conf['allowed'] $tmp = t3lib_div::trimExplode(',', $tmp); $this->MM_oppositeTable = $tmp[0]; unset($tmp); // only add the current table name if there is more than one allowed field t3lib_div::loadTCA($this->MM_oppositeTable); // We must be sure this has been done at least once before accessing the "columns" part of TCA for a table. $this->MM_oppositeFieldConf = $GLOBALS['TCA'][$this->MM_oppositeTable]['columns'][$this->MM_oppositeField]['config']; if ($this->MM_oppositeFieldConf['allowed']) { $oppositeFieldConf_allowed = explode(',', $this->MM_oppositeFieldConf['allowed']); if (count($oppositeFieldConf_allowed) > 1) { $this->MM_isMultiTableRelationship = $oppositeFieldConf_allowed[0]; } } } // SECTION: normal MM relations // If the table list is "*" then all tables are used in the list: if (!strcmp(trim($tablelist), '*')) { $tablelist = implode(',', array_keys($GLOBALS['TCA'])); } // The tables are traversed and internal arrays are initialized: $tempTableArray = t3lib_div::trimExplode(',', $tablelist, 1); foreach ($tempTableArray as $key => $val) { $tName = trim($val); $this->tableArray[$tName] = array(); if ($this->checkIfDeleted && $GLOBALS['TCA'][$tName]['ctrl']['delete']) { $fieldN = $tName . '.' . $GLOBALS['TCA'][$tName]['ctrl']['delete']; $this->additionalWhere[$tName] .= ' AND ' . $fieldN . '=0'; } } if (is_array($this->tableArray)) { reset($this->tableArray); } else { return 'No tables!'; } // Set first and second tables: $this->firstTable = key($this->tableArray); // Is the first table next($this->tableArray); $this->secondTable = key($this->tableArray); // If the second table is set and the ID number is less than zero (later) then the record is regarded to come from the second table... // Now, populate the internal itemArray and tableArray arrays: if ($MMtable) { // If MM, then call this function to do that: if ($MMuid) { $this->readMM($MMtable, $MMuid); } else { // Revert to readList() for new records in order to load possible default values from $itemlist $this->readList($itemlist); } } elseif ($MMuid && $conf['foreign_field']) { // If not MM but foreign_field, the read the records by the foreign_field $this->readForeignField($MMuid, $conf); } else { // If not MM, then explode the itemlist by "," and traverse the list: $this->readList($itemlist); // do automatic default_sortby, if any if ($conf['foreign_default_sortby']) { $this->sortList($conf['foreign_default_sortby']); } } }