96 if ((
string)$idList ===
'prev') {
102 foreach ($ids as $id) {
104 if ((
string)$id !==
'') {
106 if ($operation ==
'new') {
111 $TCAdefaultOverride =
$GLOBALS[
'BE_USER']->getTSConfigProp(
'TCAdefaults');
112 if (is_array($TCAdefaultOverride[$table .
'.'])) {
113 foreach ($TCAdefaultOverride[$table .
'.'] as $theF => $theV) {
114 if (isset(
$GLOBALS[
'TCA'][$table][
'columns'][$theF])) {
115 $newRow[$theF] = $theV;
120 $record = BackendUtility::getRecord($table, abs($id),
'pid');
121 $pid = $record[
'pid'];
127 if (isset($pageTS[
'TCAdefaults.'])) {
128 $TCAPageTSOverride = $pageTS[
'TCAdefaults.'];
129 if (is_array($TCAPageTSOverride[$table .
'.'])) {
130 foreach ($TCAPageTSOverride[$table .
'.'] as $theF => $theV) {
131 if (isset(
$GLOBALS[
'TCA'][$table][
'columns'][$theF])) {
132 $newRow[$theF] = $theV;
138 if (!empty($this->defVals[$table]) && is_array($this->defVals[$table])) {
139 foreach ($this->defVals[$table] as $theF => $theV) {
140 if (isset(
$GLOBALS[
'TCA'][$table][
'columns'][$theF])) {
141 $newRow[$theF] = $theV;
146 if ($id < 0 &&
$GLOBALS[
'TCA'][$table][
'ctrl'][
'useColumnsForDefaultValues']) {
149 if ($row =
$GLOBALS[
'TYPO3_DB']->sql_fetch_assoc($res)) {
152 foreach ($fArr as $theF) {
153 if (isset(
$GLOBALS[
'TCA'][$table][
'columns'][$theF]) && !isset($newRow[$theF])) {
154 $newRow[$theF] = $row[$theF];
158 $GLOBALS[
'TYPO3_DB']->sql_free_result($res);
161 $this->
renderRecord($table, uniqid(
'NEW', TRUE), $id, $newRow);
166 if ($row =
$GLOBALS[
'TYPO3_DB']->sql_fetch_assoc($res)) {
169 $contentTable =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'contentTable'];
170 $this->
lockRecord($table, $id, $contentTable == $table ? $row[
'pid'] : 0);
172 $GLOBALS[
'TYPO3_DB']->sql_free_result($res);
194 $dateTimeFormats =
$GLOBALS[
'TYPO3_DB']->getDateTimeFormats($table);
195 foreach (
$GLOBALS[
'TCA'][$table][
'columns'] as $column => $config) {
196 if (isset($config[
'config'][
'dbType']) &&
GeneralUtility::inList(
'date,datetime', $config[
'config'][
'dbType'])) {
197 $emptyValue = $dateTimeFormats[$config[
'config'][
'dbType']][
'empty'];
198 $row[$column] = !empty($row[$column]) && $row[$column] !== $emptyValue ? strtotime($row[$column]) : 0;
202 $uniqueItemRef = $table .
'_' . $id;
207 if (!$this->regTableItems[$uniqueItemRef]) {
208 $this->regTableItems[$uniqueItemRef] = 1;
211 if ($table ==
'pages') {
212 $this->prevPageID = $id;
214 $this->regTableItems_data[$uniqueItemRef] = $this->
renderRecordRaw($table, $id, $pid, $row, $TSconfig, $tscPID);
216 if ($this->addRawData && is_array($row) && is_array($this->regTableItems_data[$uniqueItemRef])) {
217 $this->regTableItems_data[$uniqueItemRef] = array_merge($row, $this->regTableItems_data[$uniqueItemRef]);
238 public function renderRecordRaw($table, $id, $pid, $row, $TSconfig =
'', $tscPID = 0) {
239 if (!is_array($TSconfig)) {
243 $totalRecordContent = array();
246 $copyOfColumns =
$GLOBALS[
'TCA'][$table][
'columns'];
247 foreach ($copyOfColumns as $field => $fieldConfig) {
249 if (isset($row[$field])) {
250 $data = (string)$row[$field];
251 } elseif (!empty($fieldConfig[
'config'][
'eval']) &&
GeneralUtility::inList($fieldConfig[
'config'][
'eval'],
'null')) {
253 if (array_key_exists($field, $row)) {
256 } elseif (array_key_exists(
'default', $fieldConfig[
'config']) && $fieldConfig[
'config'][
'default'] === NULL) {
259 $data = (string)$fieldConfig[
'config'][
'default'];
262 $data = (string)$fieldConfig[
'config'][
'default'];
264 $data = $this->
renderRecord_SW($data, $fieldConfig, $TSconfig, $table, $row, $field);
265 $totalRecordContent[$field] = $data;
270 if (is_array($types_fieldConfig)) {
271 $totalRecordContent = $this->
renderRecord_typesProc($totalRecordContent, $types_fieldConfig, $tscPID, $table, $pid);
274 foreach ($totalRecordContent as $field => $data) {
275 $this->
regItem($table, $id, $field, $data);
278 reset($totalRecordContent);
279 return $totalRecordContent;
294 public function renderRecord_SW($data, $fieldConfig, $TSconfig, $table, $row, $field) {
295 switch ((
string)$fieldConfig[
'config'][
'type']) {
297 $data = $this->renderRecord_groupProc($data, $fieldConfig, $TSconfig, $table, $row, $field);
326 public function renderRecord_groupProc($data, $fieldConfig, $TSconfig, $table, $row, $field) {
327 switch ($fieldConfig[
'config'][
'internal_type']) {
328 case 'file_reference':
333 if ($fieldConfig[
'config'][
'MM']) {
335 $loadDB->start(
'',
'files', $fieldConfig[
'config'][
'MM'], $row[
'uid']);
337 foreach ($loadDB->itemArray as $value) {
344 foreach ($fileList as $value) {
351 $data = implode(
',', $dataAcc);
356 $loadDB->start($data, $fieldConfig[
'config'][
'allowed'], $fieldConfig[
'config'][
'MM'], $row[
'uid'], $table, $fieldConfig[
'config']);
357 $loadDB->getFromDB();
358 $data = $loadDB->readyForInterface();
385 if ((
int)$fieldConfig[
'config'][
'maxitems'] > 1 || $fieldConfig[
'config'][
'renderMode'] ===
'tree') {
387 if (!is_array($fieldConfig[
'config'][
'items'])) {
388 $fieldConfig[
'config'][
'items'] = array();
390 $fieldConfig[
'config'][
'items'] = $this->
procesItemArray($fieldConfig[
'config'][
'items'], $fieldConfig[
'config'], $TSconfig[$field], $table, $row, $field);
391 foreach ($fieldConfig[
'config'][
'items'] as $pvpv) {
392 foreach ($elements as $eKey => $value) {
393 if ((
string)$value === (
string)$pvpv[1]) {
394 $dataAcc[$eKey] = rawurlencode($pvpv[1]) .
'|' . rawurlencode($this->
sL($pvpv[0]));
399 if ($fieldConfig[
'config'][
'special']) {
400 $dataAcc = $this->
selectAddSpecial($dataAcc, $elements, $fieldConfig[
'config'][
'special']);
403 if (
$GLOBALS[
'TCA'][$fieldConfig[
'config'][
'foreign_table']]) {
404 $dataAcc = $this->
selectAddForeign($dataAcc, $elements, $fieldConfig, $field, $TSconfig, $row, $table);
410 if (
$GLOBALS[
'TCA'][$fieldConfig[
'config'][
'foreign_table']]) {
412 $dataIds = $this->
getDataIdList($elements, $fieldConfig, $row, $table);
413 if (!count($dataIds)) {
416 $dataAcc[] = $dataIds[0];
418 $dataAcc[] = $elements[0];
421 return implode(
',', $dataAcc);
441 if (!is_array($data)) {
444 $currentValueArray = $data;
446 if (is_array($currentValueArray)) {
450 if (is_array($dataStructArray)) {
452 $dataStructArray = $flexFormHelper->modifyFlexFormDS($dataStructArray, $table, $field, $row, $fieldConfig);
453 unset($flexFormHelper);
455 if (is_array($dataStructArray)) {
456 $currentValueArray[
'data'] = $this->
renderRecord_flexProc_procInData($currentValueArray[
'data'], $dataStructArray, array($data, $fieldConfig, $TSconfig, $table, $row, $field));
458 $data = $flexObj->flexArray2Xml($currentValueArray, TRUE);
477 foreach ($types_fieldConfig as $vconf) {
481 if (is_array($eFile)) {
482 if ($eFile[
'loadFromFileField'] && $totalRecordContent[$eFile[
'loadFromFileField']]) {
486 $parseHTML->init(
'',
'');
487 $totalRecordContent[$vconf[
'field']] = $parseHTML->getSubpart($SW_fileContent, $eFile[
'markerField'] && trim($totalRecordContent[$eFile[
'markerField']]) ? trim($totalRecordContent[$eFile[
'markerField']]) :
'###TYPO3_STATICFILE_EDIT###');
491 return $totalRecordContent;
517 $dataIds = $this->
getDataIdList($elements, $fieldConfig, $row, $table);
519 foreach ($dataIds as $theId) {
520 if ($fieldConfig[
'config'][
'MM'] || $fieldConfig[
'config'][
'foreign_field']) {
523 foreach ($elements as $eKey => $value) {
524 if ((
int)$theId === (
int)$value) {
525 $dataAcc[$eKey] = $theId;
530 return implode(
',', $dataAcc);
550 if (is_array($dataPart)) {
551 foreach ($dataPart as $sKey => $sheetDef) {
553 if (is_array($dataStruct) && $actualSheet == $sKey && is_array($sheetDef)) {
554 foreach ($sheetDef as $lKey => $lData) {
574 if (is_array($DSelements)) {
576 foreach ($DSelements as $key => $dsConf) {
578 if ($DSelements[$key][
'type'] ==
'array') {
579 if (is_array($dataValues[$key][
'el'])) {
580 if ($DSelements[$key][
'section']) {
581 foreach ($dataValues[$key][
'el'] as $ik => $el) {
584 if (is_array($dataValues[$key][
'el'][$ik][$theKey][
'el'])) {
590 if (!isset($dataValues[$key][
'el'])) {
591 $dataValues[$key][
'el'] = array();
597 if (is_array($dsConf[
'TCEforms'][
'config']) && isset($dataValues[$key]) && is_array($dataValues[$key])) {
598 foreach ($dataValues[$key] as $vKey => $data) {
600 list(, , $CVTSconfig, $CVtable, $CVrow, $CVfield) = $pParams;
602 if (!isset($dataValues[$key][$vKey])) {
603 $dataValues[$key][$vKey] = $dsConf[
'TCEforms'][
'config'][
'default'];
606 $dataValues[$key][$vKey] = $this->
renderRecord_SW($dataValues[$key][$vKey], $dsConf[
'TCEforms'], $CVTSconfig, $CVtable, $CVrow, $CVfield);
632 switch ((
string)$specialKey) {
634 $tNames = array_keys(
$GLOBALS[
'TCA']);
635 foreach ($tNames as $tableName) {
636 foreach ($elements as $eKey => $value) {
637 if ((
string)$tableName === (
string)$value) {
638 $dataAcc[$eKey] = rawurlencode($value) .
'|' . rawurlencode($this->
sL(
$GLOBALS[
'TCA'][$value][
'ctrl'][
'title']));
644 $theTypes =
$GLOBALS[
'TCA'][
'pages'][
'columns'][
'doktype'][
'config'][
'items'];
645 if (is_array($theTypes)) {
646 foreach ($theTypes as $theTypesArrays) {
647 foreach ($elements as $eKey => $value) {
648 if ((
string)$theTypesArrays[1] === (
string)$value) {
649 $dataAcc[$eKey] = rawurlencode($value) .
'|' . rawurlencode($this->
sL($theTypesArrays[0]));
657 if (is_array($theExcludeFields)) {
658 foreach ($theExcludeFields as $theExcludeFieldsArrays) {
659 foreach ($elements as $eKey => $value) {
660 if ((
string)$theExcludeFieldsArrays[1] === (
string)$value) {
661 $dataAcc[$eKey] = rawurlencode($value) .
'|' . rawurlencode(rtrim($theExcludeFieldsArrays[0],
':'));
667 case 'explicitValues':
669 foreach ($theTypes as $tableFieldKey => $theTypeArrays) {
670 if (is_array($theTypeArrays[
'items'])) {
671 foreach ($theTypeArrays[
'items'] as $itemValue => $itemContent) {
672 foreach ($elements as $eKey => $value) {
673 if (($tableFieldKey .
':' . $itemValue .
':' . $itemContent[0]) === (
string)$value) {
674 $dataAcc[$eKey] = rawurlencode($value) .
'|' . rawurlencode((
'[' . $itemContent[2] .
'] ' . $itemContent[1]));
683 foreach ($theLangs as $lCfg) {
684 foreach ($elements as $eKey => $value) {
685 if ((
string)$lCfg[1] === (
string)$value) {
686 $dataAcc[$eKey] = rawurlencode($value) .
'|' . rawurlencode($lCfg[0]);
692 $customOptions =
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'customPermOptions'];
693 if (is_array($customOptions)) {
694 foreach ($customOptions as $coKey => $coValue) {
695 if (is_array($coValue[
'items'])) {
697 foreach ($coValue[
'items'] as $itemKey => $itemCfg) {
698 foreach ($elements as $eKey => $value) {
699 if (($coKey .
':' . $itemKey) === (
string)$value) {
700 $dataAcc[$eKey] = rawurlencode($value) .
'|' . rawurlencode($this->
sL($itemCfg[0]));
711 if (!$this->loadModules) {
713 $this->loadModules->load(
$GLOBALS[
'TBE_MODULES']);
715 $modList = $specialKey ==
'modListUser' ? $this->loadModules->modListUser : $this->loadModules->modListGroup;
716 foreach ($modList as $theModName) {
717 foreach ($elements as $eKey => $value) {
720 $pp = explode(
'_', $value);
721 if (count($pp) > 1) {
722 $label .=
$GLOBALS[
'LANG']->moduleLabels[
'tabs'][($pp[0] .
'_tab')] .
'>';
725 $label .=
$GLOBALS[
'LANG']->moduleLabels[
'tabs'][$value .
'_tab'];
726 if ((
string)$theModName === (string)$value) {
727 $dataAcc[$eKey] = rawurlencode($value) .
'|' . rawurlencode($label);
751 public function selectAddForeign($dataAcc, $elements, $fieldConfig, $field, $TSconfig, $row, $table) {
753 $recordList = array();
756 while ($subrow =
$GLOBALS[
'TYPO3_DB']->sql_fetch_assoc($subres)) {
761 $GLOBALS[
'TYPO3_DB']->sql_free_result($subres);
763 if (is_array(
$GLOBALS[
'TCA'][$fieldConfig[
'config'][
'neg_foreign_table']])) {
765 while ($subrow =
$GLOBALS[
'TYPO3_DB']->sql_fetch_assoc($subres)) {
770 $GLOBALS[
'TYPO3_DB']->sql_free_result($subres);
774 $dataIds = $this->
getDataIdList($elements, $fieldConfig, $row, $table);
775 if ($fieldConfig[
'config'][
'MM']) {
780 foreach ($dataIds as $theId) {
781 if (isset($recordList[$theId])) {
782 $lPrefix = $this->
sL($fieldConfig[
'config'][($theId > 0 ?
'' :
'neg_') .
'foreign_table_prefix']);
783 if ($fieldConfig[
'config'][
'MM'] || $fieldConfig[
'config'][
'foreign_field']) {
786 foreach ($elements as $eKey => $value) {
787 if ((
int)$theId === (
int)$value) {
810 $recordId = $row[
'uid'];
812 if (empty($fieldConfig[
'config'][
'MM'])) {
816 $loadDB->registerNonTableValues = $fieldConfig[
'config'][
'allowNonIdValues'] ? 1 : 0;
817 $loadDB->start(implode(
',', $elements), $fieldConfig[
'config'][
'foreign_table'] .
',' . $fieldConfig[
'config'][
'neg_foreign_table'], $fieldConfig[
'config'][
'MM'], $recordId, $table, $fieldConfig[
'config']);
818 $idList = $loadDB->convertPosNeg($loadDB->getValueArray(), $fieldConfig[
'config'][
'foreign_table'], $fieldConfig[
'config'][
'neg_foreign_table']);
836 public function procesItemArray($selItems, $config, $fieldTSConfig, $table, $row, $field) {
837 $selItems = $this->
addItems($selItems, $fieldTSConfig[
'addItems.']);
838 if ($config[
'itemsProcFunc']) {
839 $selItems = $this->
procItems($selItems, $fieldTSConfig[
'itemsProcFunc.'], $config, $table, $row, $field);
855 if (is_array($iArray)) {
856 foreach ($iArray as $value => $label) {
857 $items[] = array($label, $value);
877 public function procItems($items, $itemsProcFuncTSconfig, $config, $table, $row, $field) {
879 $params[
'items'] = &$items;
880 $params[
'config'] = $config;
881 $params[
'TSconfig'] = $itemsProcFuncTSconfig;
882 $params[
'table'] = $table;
883 $params[
'row'] = $row;
884 $params[
'field'] = $field;
904 if ($this->lockRecords) {
921 public function regItem($table, $id, $field, $content) {
933 public function sL($in) {
947 if ($liveDefaultId === NULL) {
948 $liveDefaultId = $id;
950 return $liveDefaultId;
static getTCEFORM_TSconfig($table, $row)
static workspaceOL($table, &$row, $wsid=-99, $unsetMovePointers=FALSE)
static lockRecords($table='', $uid=0, $pid=0)
static makeInstance($className)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
static getFlexFormDS($conf, $row, $table, $fieldName='', $WSOL=TRUE, $newRecordPidValue=0)
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
static getTSCpid($table, $uid, $pid)
static getRecordTitle($table, $row, $prep=FALSE, $forceResult=TRUE)
static getLiveVersionIdOfRecord($table, $uid)
static getExcludeFields()
static resolveSheetDefInDS($dataStructArray, $sheet='sDEF')
static getUrl($url, $includeHeader=0, $requestHeaders=FALSE, &$report=NULL)
static getTCAtypes($table, $rec, $useFieldNameAsKey=0)
static fixed_lgd_cs($string, $chars, $appendString='...')
static fixVersioningPid($table, &$rr, $ignoreWorkspaceMatch=FALSE)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static getExplicitAuthFieldValues()
static exec_foreign_table_where_query($fieldValue, $field='', $TSconfig=array(), $prefix='')
static inList($list, $item)
static xml2array($string, $NSprefix='', $reportDocTag=FALSE)
static evalWriteFile($pArr, $currentRecord)
static getPagesTSconfig($id, $rootLine=NULL, $returnPartArray=FALSE)
static deleteClause($table, $tableAlias='')
static getSystemLanguages()