本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::loadTCA方法的具体用法?PHP GeneralUtility::loadTCA怎么用?PHP GeneralUtility::loadTCA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::loadTCA方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreign_table_where_query
/**
* Returns select statement for MM relations (as used by TCEFORMs etc) . Code borrowed from class.t3lib_befunc.php
* Usage: 3
*
* @param array Configuration array for the field, taken from $TCA
* @param string Field name
* @param array TSconfig array from which to get further configuration settings for the field name
* @param string Prefix string for the key "*foreign_table_where" from $fieldValue array
* @return string resulting where string with accomplished marker substitution
* @internal
* @see t3lib_transferData::renderRecord(), t3lib_TCEforms::foreignTable()
*/
public static function foreign_table_where_query($fieldValue, $field = '', $TSconfig = array(), $prefix = '')
{
global $TCA;
$foreign_table = $fieldValue['config'][$prefix . 'foreign_table'];
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($foreign_table);
$rootLevel = $TCA[$foreign_table]['ctrl']['rootLevel'];
$fTWHERE = $fieldValue['config'][$prefix . 'foreign_table_where'];
if (strstr($fTWHERE, '###REC_FIELD_')) {
$fTWHERE_parts = explode('###REC_FIELD_', $fTWHERE);
foreach ($fTWHERE_parts as $kk => $vv) {
if ($kk) {
$fTWHERE_subpart = explode('###', $vv, 2);
$fTWHERE_parts[$kk] = $TSconfig['_THIS_ROW'][$fTWHERE_subpart[0]] . $fTWHERE_subpart[1];
}
}
$fTWHERE = implode('', $fTWHERE_parts);
}
$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);
if (isset($TSconfig[$field]) && is_array($TSconfig[$field])) {
$fTWHERE = str_replace('###PAGE_TSCONFIG_ID###', intval($TSconfig[$field]['PAGE_TSCONFIG_ID']), $fTWHERE);
$fTWHERE = str_replace('###PAGE_TSCONFIG_IDLIST###', $GLOBALS['TYPO3_DB']->cleanIntList($TSconfig[$field]['PAGE_TSCONFIG_IDLIST']), $fTWHERE);
$fTWHERE = str_replace('###PAGE_TSCONFIG_STR###', $GLOBALS['TYPO3_DB']->quoteStr($TSconfig[$field]['PAGE_TSCONFIG_STR'], $foreign_table), $fTWHERE);
} else {
$fTWHERE = str_replace('###PAGE_TSCONFIG_ID###', 0, $fTWHERE);
$fTWHERE = str_replace('###PAGE_TSCONFIG_IDLIST###', 0, $fTWHERE);
$fTWHERE = str_replace('###PAGE_TSCONFIG_STR###', 0, $fTWHERE);
}
return $fTWHERE;
}
示例2: main
/**
* 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)
{
if (version_compare(TYPO3_branch, '6.1', '<')) {
GeneralUtility::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';
$sortFields = GeneralUtility::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']);
}
}
示例3: cmdAddMetadata
/**
* Add metadata configuration
*
* @access protected
*
* @return void
*/
protected function cmdAddMetadata()
{
// Include metadata definition file.
include_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey) . 'modules/' . $this->modPath . 'metadata.inc.php';
// Load table configuration array to get default field values.
\TYPO3\CMS\Core\Utility\GeneralUtility::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), 'hidden' => $values['hidden'], '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' => 0, 'stored' => 0, 'indexed' => 0, 'boost' => 0.0, 'is_sortable' => 0, 'is_facet' => 0, 'is_listed' => $values['is_listed'], 'autocomplete' => 0);
$i++;
}
$_ids = tx_dlf_helper::processDBasAdmin($data);
// Check for failed inserts.
if (count($_ids) == $i) {
// Fine.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('flash.metadataAddedMsg'), $GLOBALS['LANG']->getLL('flash.metadataAdded', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::OK, FALSE);
} else {
// Something went wrong.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('flash.metadataNotAddedMsg'), $GLOBALS['LANG']->getLL('flash.metadataNotAdded', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, FALSE);
}
tx_dlf_helper::addMessage($_message);
}
示例4: loadTca
/**
* Load the configuration of a table and additional configuration by language packs
*
* @param string $tableName: the name of the table
* @return void
*/
public static function loadTca($tableName)
{
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($tableName);
// Get all extending TCA's
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['extendingTCA'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['extendingTCA'] as $extensionKey) {
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extensionKey)) {
include \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extensionKey) . 'ext_tables.php';
}
}
}
}
示例5: regItem
/**
* Register item function.
*
* @param string $table Table name
* @param integer $id Record uid
* @param string $field Field name
* @param string $content Content string.
* @return void
* @todo Define visibility
*/
public function regItem($table, $id, $field, $content)
{
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
$config = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
switch ($config['type']) {
case 'input':
if (isset($config['checkbox']) && $content == $config['checkbox']) {
$content = '';
break;
}
if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($config['eval'], 'date')) {
$content = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $content);
}
break;
case 'group':
case 'select':
break;
}
$this->theRecord[$field] = $content;
}
示例6: main
/**
* Main function
* Makes a header-location redirect to an edit form IF POSSIBLE from the passed data - otherwise the window will just close.
*
* @return void
* @todo Define visibility
*/
public function main()
{
if ($this->doClose) {
$this->closeWindow();
} else {
// Initialize:
$table = $this->P['table'];
$field = $this->P['field'];
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
$config = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
$fTable = $this->P['currentValue'] < 0 ? $config['neg_foreign_table'] : $config['foreign_table'];
// Detecting the various allowed field type setups and acting accordingly.
if (is_array($config) && $config['type'] == 'select' && !$config['MM'] && $config['maxitems'] <= 1 && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->P['currentValue']) && $this->P['currentValue'] && $fTable) {
// SINGLE value:
$redirectUrl = 'alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . '&edit[' . $fTable . '][' . $this->P['currentValue'] . ']=edit';
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
} elseif (is_array($config) && $this->P['currentSelectedValues'] && ($config['type'] == 'select' && $config['foreign_table'] || $config['type'] == 'group' && $config['internal_type'] == 'db')) {
// MULTIPLE VALUES:
// Init settings:
$allowedTables = $config['type'] == 'group' ? $config['allowed'] : $config['foreign_table'] . ',' . $config['neg_foreign_table'];
$prependName = 1;
$params = '';
// Selecting selected values into an array:
$dbAnalysis = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler');
$dbAnalysis->start($this->P['currentSelectedValues'], $allowedTables);
$value = $dbAnalysis->getValueArray($prependName);
// Traverse that array and make parameters for alt_doc.php:
foreach ($value as $rec) {
$recTableUidParts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $rec, 2);
$params .= '&edit[' . $recTableUidParts[0] . '][' . $recTableUidParts[1] . ']=edit';
}
// Redirect to alt_doc.php:
\TYPO3\CMS\Core\Utility\HttpUtility::redirect('alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . $params);
} else {
$this->closeWindow();
}
}
}
示例7: array
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/FlexFormPi1.xml');
/**
* Load UserFunc for FlexForm Field selection
*/
if (TYPO3_MODE == 'BE') {
require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Classes/Utility/FlexFormFieldSelection.php';
}
/**
* Table configuration fe_users
*/
$tempColumns = array('gender' => array('exclude' => 0, 'label' => 'LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.gender', 'config' => array('type' => 'radio', 'items' => array(array('LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.gender.item0', '0'), array('LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.gender.item1', '1')))), 'date_of_birth' => array('exclude' => 0, 'label' => 'LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.dateOfBirth', 'config' => array('type' => 'input', 'size' => 10, 'max' => 20, 'eval' => 'date', 'checkbox' => '0', 'default' => '')), 'crdate' => array('exclude' => 1, 'label' => 'LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:fe_users.crdate', 'config' => array('type' => 'input', 'size' => 30, 'eval' => 'datetime', 'readOnly' => 1, 'default' => time())), 'tstamp' => array('exclude' => 1, 'label' => 'LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:fe_users.tstamp', 'config' => array('type' => 'input', 'size' => 30, 'eval' => 'datetime', 'readOnly' => 1, 'default' => time())), 'tx_femanager_confirmedbyuser' => array('exclude' => 1, 'label' => 'LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:fe_users.registrationconfirmedbyuser', 'config' => array('type' => 'check', 'default' => 0)), 'tx_femanager_confirmedbyadmin' => array('exclude' => 1, 'label' => 'LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:fe_users.registrationconfirmedbyadmin', 'config' => array('type' => 'check', 'default' => 0)));
$fields = 'crdate, tstamp, tx_femanager_confirmedbyuser, tx_femanager_confirmedbyadmin';
if (empty($confArr['disableLog'])) {
$tempColumns['tx_femanager_log'] = array('exclude' => 1, 'label' => 'LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:fe_users.log', 'config' => array('type' => 'inline', 'foreign_table' => 'tx_femanager_domain_model_log', 'foreign_field' => 'user', 'maxitems' => 1000, 'minitems' => 0, 'appearance' => array('collapseAll' => 1, 'expandSingle' => 1)));
$fields .= ', tx_femanager_log';
}
$tempColumns['tx_femanager_changerequest'] = array('exclude' => 1, 'label' => 'LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:fe_users.changerequest', 'config' => array('type' => 'text', 'cols' => '40', 'rows' => '15', 'wrap' => 'off', 'readOnly' => 1));
$fields .= ', tx_femanager_changerequest';
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('fe_users');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('fe_users', 'gender, date_of_birth', '', 'after:name');
if (version_compare(TYPO3_branch, '6.2', '<')) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('fe_users', $tempColumns, 1);
} else {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('fe_users', $tempColumns);
}
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('fe_users', '--div--;LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:fe_users.tab;;;;1-1-1, ' . $fields);
/**
* Table configuration tx_femanager_domain_model_log
*/
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_femanager_domain_model_log');
$TCA['tx_femanager_domain_model_log'] = array('ctrl' => array('title' => 'LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_log', 'label' => 'title', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'dividers2tabs' => TRUE, 'versioningWS' => 2, 'versioning_followPages' => TRUE, 'origUid' => 't3_origuid', 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l10n_parent', 'transOrigDiffSourceField' => 'l10n_diffsource', 'delete' => 'deleted', 'default_sortby' => 'ORDER BY crdate DESC', 'enablecolumns' => array('disabled' => 'hidden', 'starttime' => 'starttime', 'endtime' => 'endtime'), 'searchFields' => 'title', 'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/Log.php', 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/Log.gif'));
示例8: processSoftReferences
/**
* Processing of soft references
*
* @return void
* @todo Define visibility
*/
public function processSoftReferences()
{
// Initialize:
$inData = array();
// Traverse records:
if (is_array($this->dat['header']['records'])) {
foreach ($this->dat['header']['records'] as $table => $recs) {
foreach ($recs as $uid => $thisRec) {
// If there are soft references defined, traverse those:
if (isset($GLOBALS['TCA'][$table]) && is_array($thisRec['softrefs'])) {
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
// First traversal is to collect softref configuration and split them up based on fields. This could probably also have been done with the "records" key instead of the header.
$fieldsIndex = array();
foreach ($thisRec['softrefs'] as $softrefDef) {
// If a substitution token is set:
if ($softrefDef['field'] && is_array($softrefDef['subst']) && $softrefDef['subst']['tokenID']) {
$fieldsIndex[$softrefDef['field']][$softrefDef['subst']['tokenID']] = $softrefDef;
}
}
// The new id:
$thisNewUid = \TYPO3\CMS\Backend\Utility\BackendUtility::wsMapId($table, $this->import_mapId[$table][$uid]);
// Now, if there are any fields that require substitution to be done, lets go for that:
foreach ($fieldsIndex as $field => $softRefCfgs) {
if (is_array($GLOBALS['TCA'][$table]['columns'][$field])) {
$conf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
if ($conf['type'] === 'flex') {
// This will fetch the new row for the element (which should be updated with any references to data structures etc.)
$origRecordRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($table, $thisNewUid, '*');
if (is_array($origRecordRow)) {
// Get current data structure and value array:
$dataStructArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getFlexFormDS($conf, $origRecordRow, $table);
$currentValueArray = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($origRecordRow[$field]);
// Do recursive processing of the XML data:
/** @var $iteratorObj \TYPO3\CMS\Core\DataHandling\DataHandler */
$iteratorObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
$iteratorObj->callBackObj = $this;
$currentValueArray['data'] = $iteratorObj->checkValue_flex_procInData($currentValueArray['data'], array(), array(), $dataStructArray, array($table, $uid, $field, $softRefCfgs), 'processSoftReferences_flexFormCallBack');
// The return value is set as an array which means it will be processed by tcemain for file and DB references!
if (is_array($currentValueArray['data'])) {
$inData[$table][$thisNewUid][$field] = $currentValueArray;
}
}
} else {
// Get tokenizedContent string and proceed only if that is not blank:
$tokenizedContent = $this->dat['records'][$table . ':' . $uid]['rels'][$field]['softrefs']['tokenizedContent'];
if (strlen($tokenizedContent) && is_array($softRefCfgs)) {
$inData[$table][$thisNewUid][$field] = $this->processSoftReferences_substTokens($tokenizedContent, $softRefCfgs, $table, $uid);
}
}
}
}
}
}
}
}
// Now write to database:
$tce = $this->getNewTCE();
$this->callHook('before_processSoftReferences', array('tce' => &$tce, 'data' => &$inData));
$tce->enableLogging = TRUE;
$tce->start($inData, array());
$tce->process_datamap();
$this->callHook('after_processSoftReferences', array('tce' => &$tce));
}
示例9: getRelatedItems
/**
* Gets the related items of the current record's configured field.
*
* @param array $configuration for the content object
* @param tslib_cObj $parentContentObject parent content object
* @return array Array of related items, values already resolved from related records
*/
protected function getRelatedItems(tslib_cObj $parentContentObject)
{
$relatedItems = array();
list($localTableName, $localRecordUid) = explode(':', $parentContentObject->currentRecord);
$GLOBALS['TSFE']->includeTCA();
if (version_compare(TYPO3_version, '6.0.0', '>=')) {
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($localTableName);
} else {
t3lib_div::loadTCA($localTableName);
}
$localTableTca = $GLOBALS['TCA'][$localTableName];
$localFieldName = $this->configuration['localField'];
$localFieldTca = $localTableTca['columns'][$localFieldName];
if (isset($localFieldTca['config']['MM']) && trim($localFieldTca['config']['MM']) !== '') {
$relatedItems = $this->getRelatedItemsFromMMTable($localTableName, $localRecordUid, $localFieldTca);
} else {
$relatedItems = $this->getRelatedItemsFromForeignTable($localFieldName, $localRecordUid, $localFieldTca, $parentContentObject);
}
return $relatedItems;
}
示例10: removeInvalidElements
/**
* 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 $wizardItems Wizard items, passed by reference
* @return void
* @todo Define visibility
*/
public function removeInvalidElements(&$wizardItems)
{
// Load full table definition:
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('tt_content');
// Get TCEFORM from TSconfig of current page
$row = array('pid' => $this->id);
$TCEFORM_TSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getTCEFORM_TSconfig('tt_content', $row);
$removeItems = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $TCEFORM_TSconfig['CType']['removeItems'], 1);
$keepItems = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $TCEFORM_TSconfig['CType']['keepItems'], 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 = \TYPO3\CMS\Core\Utility\GeneralUtility::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'] = \TYPO3\CMS\Core\Utility\GeneralUtility::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($GLOBALS['TCA']['tt_content']['columns'][$fN])) {
// Get information about if the field value is OK:
$config =& $GLOBALS['TCA']['tt_content']['columns'][$fN]['config'];
$authModeDeny = $config['type'] == 'select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode('tt_content', $fN, $fV, $config['authMode']);
$isNotInKeepItems = count($keepItems) && !in_array($fV, $keepItems);
if ($authModeDeny || $fN == 'CType' && in_array($fV, $removeItems) || $isNotInKeepItems) {
// 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) {
$tmp = explode('_', $key);
if ($tmp[0] && !$tmp[1] && !in_array($tmp[0], $headersUsed)) {
unset($wizardItems[$key]);
}
}
}
示例11: main
/**
* The main processing method if this class
*
* @return string Information of the template status or the taken actions as HTML string
* @todo Define visibility
*/
public function main()
{
global $BACK_PATH;
global $tmpl, $tplRow, $theConstants;
$this->pObj->MOD_MENU['includeTypoScriptFileContent'] = TRUE;
$edit = $this->pObj->edit;
$e = $this->pObj->e;
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('sys_template');
// Checking for more than one template an if, set a menu...
$manyTemplatesMenu = $this->pObj->templateMenu();
$template_uid = 0;
if ($manyTemplatesMenu) {
$template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
}
// Initialize
$existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
if ($existTemplate) {
$saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
}
// Create extension template
$newId = $this->pObj->createTemplate($this->pObj->id, $saveId);
if ($newId) {
// Switch to new template
$urlParameters = array('id' => $this->pObj->id, 'SET[templatesOnPage]' => $newId);
$aHref = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_ts', $urlParameters);
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($aHref);
}
if ($existTemplate) {
// Update template ?
$POST = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST();
if ($POST['submit'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['submit_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['submit_y']) || $POST['saveclose'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_y'])) {
// Set the data to be saved
$recData = array();
$alternativeFileName = array();
$tmp_upload_name = '';
// Set this to blank
$tmp_newresource_name = '';
if (is_array($POST['data'])) {
foreach ($POST['data'] as $field => $val) {
switch ($field) {
case 'constants':
case 'config':
case 'title':
case 'sitetitle':
case 'description':
$recData['sys_template'][$saveId][$field] = $val;
break;
}
}
}
if (count($recData)) {
$recData['sys_template'][$saveId] = $this->processTemplateRowBeforeSaving($recData['sys_template'][$saveId]);
// Create new tce-object
$tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
$tce->stripslashes_values = 0;
$tce->alternativeFileName = $alternativeFileName;
// Initialize
$tce->start($recData, array());
// Saved the stuff
$tce->process_datamap();
// Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
$tce->clear_cacheCmd('all');
// tce were processed successfully
$this->tce_processed = TRUE;
// re-read the template ...
$this->initialize_editor($this->pObj->id, $template_uid);
}
// If files has been edited:
if (is_array($edit)) {
if ($edit['filename'] && $tplRow['resources'] && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($tplRow['resources'], $edit['filename'])) {
// Check if there are resources, and that the file is in the resourcelist.
$path = PATH_site . $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $edit['filename'];
$fI = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($edit['filename']);
if (@is_file($path) && \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($path) && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->pObj->textExtensions, $fI['fileext'])) {
// checks that have already been done.. Just to make sure
// @TODO: Check if the hardcorded value already has a config member, otherwise create one
// Checks that have already been done.. Just to make sure
if (filesize($path) < 30720) {
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($path, $edit['file']);
$theOutput .= $this->pObj->doc->spacer(10);
$theOutput .= $this->pObj->doc->section('<font color=red>' . $GLOBALS['LANG']->getLL('fileChanged') . '</font>', sprintf($GLOBALS['LANG']->getLL('resourceUpdated'), $edit['filename']), 0, 0, 0, 1);
// Clear cache - the file has probably affected the template setup
// @TODO: Check if the edited file really had something to do with cached data and prevent this clearing if possible!
/** @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */
$tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
$tce->stripslashes_values = 0;
$tce->start(array(), array());
$tce->clear_cacheCmd('all');
}
}
}
}
}
// Hook post updating template/TCE processing
//.........这里部分代码省略.........
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:101,代码来源:TypoScriptTemplateInformationModuleFunctionController.php
示例12: setRelatingTableAndField
/**
* Set which pointing field (in the TCEForm) we are currently rendering the element browser for
*
* @param string $tableName Table name
* @param string $fieldName Field name
*/
public function setRelatingTableAndField($tableName, $fieldName)
{
global $TCA;
// Check validity of the input data and load TCA
if (isset($TCA[$tableName])) {
$this->relatingTable = $tableName;
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($tableName);
if ($fieldName && isset($TCA[$tableName]['columns'][$fieldName])) {
$this->relatingField = $fieldName;
}
}
}
示例13: renderListContent
/**
* Rendering all other listings than QuickEdit
*
* @return void
* @todo Define visibility
*/
public function renderListContent()
{
// Initialize list object (see "class.db_layout.inc"):
/** @var $dblist \TYPO3\CMS\Backend\View\PageLayoutView */
$dblist = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\PageLayoutView');
$dblist->backPath = $GLOBALS['BACK_PATH'];
$dblist->thumbs = $this->imagemode;
$dblist->no_noWrap = 1;
$dblist->descrTable = $this->descrTable;
$this->pointer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
$dblist->script = 'db_layout.php';
$dblist->showIcon = 0;
$dblist->setLMargin = 0;
$dblist->doEdit = $this->EDIT_CONTENT;
$dblist->ext_CALC_PERMS = $this->CALC_PERMS;
$dblist->agePrefixes = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
$dblist->id = $this->id;
$dblist->nextThree = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->modTSconfig['properties']['editFieldsAtATime'], 0, 10);
$dblist->option_showBigButtons = $this->modTSconfig['properties']['disableBigButtons'] === '0';
$dblist->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
$dblist->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0;
if (!$dblist->nextThree) {
$dblist->nextThree = 1;
}
$dblist->externalTables = $this->externalTables;
// Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!)
$h_menu = $dblist->getTableMenu($this->id);
// Initialize other variables:
$h_func = '';
$tableOutput = array();
$tableJSOutput = array();
$CMcounter = 0;
// Traverse the list of table names which has records on this page (that array is populated
// by the $dblist object during the function getTableMenu()):
foreach ($dblist->activeTables as $table => $value) {
// Load full table definitions:
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
if (!isset($dblist->externalTables[$table])) {
$q_count = $this->getNumberOfHiddenElements();
$h_func_b = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], 'db_layout.php', '', 'id="checkTt_content_showHidden"') . '<label for="checkTt_content_showHidden">' . (!$q_count ? $GLOBALS['TBE_TEMPLATE']->dfw($GLOBALS['LANG']->getLL('hiddenCE')) : $GLOBALS['LANG']->getLL('hiddenCE') . ' (' . $q_count . ')') . '</label>';
// Boolean: Display up/down arrows and edit icons for tt_content records
$dblist->tt_contentConfig['showCommands'] = 1;
// Boolean: Display info-marks or not
$dblist->tt_contentConfig['showInfo'] = 1;
// Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown
// in the total width of the page
$dblist->tt_contentConfig['single'] = 0;
if ($this->MOD_SETTINGS['function'] == 4) {
// Grid view
$dblist->tt_contentConfig['showAsGrid'] = 1;
}
// Setting up the tt_content columns to show:
if (is_array($GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'])) {
$colList = array();
$tcaItems = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getColPosListItemsParsed', $this->id, $this);
foreach ($tcaItems as $temp) {
$colList[] = $temp[1];
}
} else {
// ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
$colList = array('1', '0', '2', '3');
}
if (strcmp($this->colPosList, '')) {
$colList = array_intersect(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->colPosList), $colList);
}
// If only one column found, display the single-column view.
if (count($colList) === 1 && !$this->MOD_SETTINGS['function'] === 4) {
// Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol']
// is shown in the total width of the page
$dblist->tt_contentConfig['single'] = 1;
// The column(s) to show if single mode (under each other)
$dblist->tt_contentConfig['showSingleCol'] = current($colList);
}
// The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
$dblist->tt_contentConfig['cols'] = implode(',', $colList);
$dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
$dblist->tt_contentConfig['sys_language_uid'] = intval($this->current_sys_language);
// If the function menu is set to "Language":
if ($this->MOD_SETTINGS['function'] == 2) {
$dblist->tt_contentConfig['single'] = 0;
$dblist->tt_contentConfig['languageMode'] = 1;
$dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
$dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
}
} else {
if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) {
$h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[' . $table . ']', $this->MOD_SETTINGS[$table], $this->MOD_MENU[$table], 'db_layout.php', '');
} else {
$h_func = '';
}
}
// Start the dblist object:
$dblist->itemsLimitSingleTable = 1000;
$dblist->start($this->id, $table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
//.........这里部分代码省略.........
示例14: makeFieldList
/**
* Makes the list of fields to select for a table
*
* @param string $table Table name
* @param boolean $dontCheckUser If set, users access to the field (non-exclude-fields) is NOT checked.
* @param boolean $addDateFields If set, also adds crdate and tstamp fields (note: they will also be added if user is admin or dontCheckUser is set)
* @return array Array, where values are fieldnames to include in query
* @todo Define visibility
*/
public function makeFieldList($table, $dontCheckUser = 0, $addDateFields = 0)
{
// Init fieldlist array:
$fieldListArr = array();
// Check table:
if (is_array($GLOBALS['TCA'][$table]) && isset($GLOBALS['TCA'][$table]['columns']) && is_array($GLOBALS['TCA'][$table]['columns'])) {
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
if (isset($GLOBALS['TCA'][$table]['columns']) && is_array($GLOBALS['TCA'][$table]['columns'])) {
// Traverse configured columns and add them to field array, if available for user.
foreach ($GLOBALS['TCA'][$table]['columns'] as $fN => $fieldValue) {
if ($dontCheckUser || (!$fieldValue['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $fN)) && $fieldValue['config']['type'] != 'passthrough') {
$fieldListArr[] = $fN;
}
}
// Add special fields:
if ($dontCheckUser || $GLOBALS['BE_USER']->isAdmin()) {
$fieldListArr[] = 'uid';
$fieldListArr[] = 'pid';
}
// Add date fields
if ($dontCheckUser || $GLOBALS['BE_USER']->isAdmin() || $addDateFields) {
if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) {
$fieldListArr[] = $GLOBALS['TCA'][$table]['ctrl']['tstamp'];
}
if ($GLOBALS['TCA'][$table]['ctrl']['crdate']) {
$fieldListArr[] = $GLOBALS['TCA'][$table]['ctrl']['crdate'];
}
}
// Add more special fields:
if ($dontCheckUser || $GLOBALS['BE_USER']->isAdmin()) {
if ($GLOBALS['TCA'][$table]['ctrl']['cruser_id']) {
$fieldListArr[] = $GLOBALS['TCA'][$table]['ctrl']['cruser_id'];
}
if ($GLOBALS['TCA'][$table]['ctrl']['sortby']) {
$fieldListArr[] = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
}
if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
$fieldListArr[] = 't3ver_id';
$fieldListArr[] = 't3ver_state';
$fieldListArr[] = 't3ver_wsid';
}
}
} else {
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(sprintf('$TCA is broken for the table "%s": no required "columns" entry in $TCA.', $table), 'core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
}
}
return $fieldListArr;
}
示例15: render_uploads
/**
* Rendering the "Filelinks" type content element, called from TypoScript (tt_content.uploads.20)
*
* @param string $content Content input. Not used, ignore.
* @param array $conf TypoScript configuration
* @return string HTML output.
* @access private
* @todo Define visibility
*/
public function render_uploads($content, $conf)
{
// Look for hook before running default code for function
if ($hookObj = $this->hookRequest('render_uploads')) {
return $hookObj->render_uploads($content, $conf);
} else {
// Loading language-labels
$this->pi_loadLL();
$out = '';
// Set layout type:
$type = intval($this->cObj->data['layout']);
// See if the file path variable is set, this takes precedence
$filePathConf = $this->cObj->stdWrap($conf['filePath'], $conf['filePath.']);
if ($filePathConf) {
$fileList = $this->cObj->filelist($filePathConf);
list($path) = explode('|', $filePathConf);
} else {
// Get the list of files from the field
$field = trim($conf['field']) ? trim($conf['field']) : 'media';
$fileList = $this->cObj->data[$field];
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('tt_content');
$path = 'uploads/media/';
if (is_array($GLOBALS['TCA']['tt_content']['columns'][$field]) && !empty($GLOBALS['TCA']['tt_content']['columns'][$field]['config']['uploadfolder'])) {
// In TCA-Array folders are saved without trailing slash, so $path.$fileName won't work
$path = $GLOBALS['TCA']['tt_content']['columns'][$field]['config']['uploadfolder'] . '/';
}
}
$path = trim($path);
// Explode into an array:
$fileArray = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $fileList, 1);
// If there were files to list...:
if (count($fileArray)) {
// Get the descriptions for the files (if any):
$descriptions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $this->cObj->data['imagecaption']);
// Get the titles for the files (if any)
$titles = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $this->cObj->data['titleText']);
// Get the alternative text for icons/thumbnails
$altTexts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $this->cObj->data['altText']);
// Add the target to linkProc when explicitly set
if ($this->cObj->data['target']) {
$conf['linkProc.']['target'] = $this->cObj->data['target'];
unset($conf['linkProc.']['target.']);
}
// Adding hardcoded TS to linkProc configuration:
$conf['linkProc.']['path.']['current'] = 1;
if ($conf['linkProc.']['combinedLink']) {
$conf['linkProc.']['icon'] = $type > 0 ? 1 : 0;
} else {
// Always render icon - is inserted by PHP if needed.
$conf['linkProc.']['icon'] = 1;
// Temporary, internal split-token!
$conf['linkProc.']['icon.']['wrap'] = ' | //**//';
// ALways link the icon
$conf['linkProc.']['icon_link'] = 1;
}
$conf['linkProc.']['icon_image_ext_list'] = $type == 2 || $type == 3 ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] : '';
// If the layout is type 2 or 3 we will render an image based icon if possible.
if ($conf['labelStdWrap.']) {
$conf['linkProc.']['labelStdWrap.'] = $conf['labelStdWrap.'];
}
if ($conf['useSpacesInLinkText'] || $conf['stripFileExtensionFromLinkText']) {
$conf['linkProc.']['removePrependedNumbers'] = 0;
}
// Traverse the files found:
$filesData = array();
foreach ($fileArray as $key => $fileName) {
$absPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName(\TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($path . $fileName));
if (@is_file($absPath)) {
$fI = pathinfo($fileName);
$filesData[$key] = array();
$currentPath = $path;
if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($fileName, '../../')) {
$currentPath = '';
$fileName = substr($fileName, 6);
}
$filesData[$key]['filename'] = $fileName;
$filesData[$key]['path'] = $currentPath;
$filesData[$key]['filesize'] = filesize($absPath);
$filesData[$key]['fileextension'] = strtolower($fI['extension']);
$filesData[$key]['description'] = trim($descriptions[$key]);
$conf['linkProc.']['title'] = trim($titles[$key]);
if (isset($altTexts[$key]) && !empty($altTexts[$key])) {
$altText = trim($altTexts[$key]);
} else {
$altText = sprintf($this->pi_getLL('uploads.icon'), $fileName);
}
$conf['linkProc.']['altText'] = $conf['linkProc.']['iconCObject.']['altText'] = $altText;
$this->cObj->setCurrentVal($currentPath);
$GLOBALS['TSFE']->register['ICON_REL_PATH'] = $currentPath . $fileName;
$GLOBALS['TSFE']->register['filename'] = $filesData[$key]['filename'];
$GLOBALS['TSFE']->register['path'] = $filesData[$key]['path'];
//.........这里部分代码省略.........