2 namespace TYPO3\CMS\Frontend\ContentObject;
46 public function render($conf = array())
49 $this->itemArray = array();
50 $this->data = array();
53 $originalRec =
$GLOBALS[
'TSFE']->currentRecord;
57 ++
$GLOBALS[
'TSFE']->recordRegister[$originalRec];
60 $tables = isset($conf[
'tables.']) ? $this->cObj->stdWrap($conf[
'tables'], $conf[
'tables.']) : $conf[
'tables'];
64 if (is_array($conf[
'conf.'])) {
65 foreach ($conf[
'conf.'] as $key => $value) {
66 if (substr($key, -1) !=
'.' && !in_array($key, $tablesArray)) {
67 $tablesArray[] = $key;
74 $source = isset($conf[
'source.']) ? $this->cObj->stdWrap($conf[
'source'], $conf[
'source.']) : $conf[
'source'];
75 $categories = isset($conf[
'categories.']) ? $this->cObj->stdWrap($conf[
'categories'], $conf[
'categories.']) : $conf[
'categories'];
77 $this->collectRecordsFromSource($source, $tablesArray);
79 $relationField = isset($conf[
'categories.'][
'relation.']) ? $this->cObj->stdWrap($conf[
'categories.'][
'relation'], $conf[
'categories.'][
'relation.']) : $conf[
'categories.'][
'relation'];
82 $itemArrayCount = count($this->itemArray);
83 if ($itemArrayCount > 0) {
86 $cObj->setParent($this->cObj->data, $this->cObj->currentRecord);
87 $this->cObj->currentRecordNumber = 0;
88 $this->cObj->currentRecordTotal = $itemArrayCount;
89 foreach ($this->itemArray as $val) {
90 $row = $this->data[$val[
'table']][$val[
'id']];
94 $GLOBALS[
'TSFE']->sys_page->versionOL($val[
'table'], $row);
96 if (is_array($row) &&
$GLOBALS[
'TSFE']->sys_language_contentOL) {
97 if ($val[
'table'] ===
'pages') {
98 $row =
$GLOBALS[
'TSFE']->sys_page->getPageOverlay($row);
100 $row =
$GLOBALS[
'TSFE']->sys_page->getRecordOverlay($val[
'table'], $row,
$GLOBALS[
'TSFE']->sys_language_content,
$GLOBALS[
'TSFE']->sys_language_contentOL);
105 if (is_array($row)) {
106 $dontCheckPid = isset($conf[
'dontCheckPid.']) ? $this->cObj->stdWrap($conf[
'dontCheckPid'], $conf[
'dontCheckPid.']) : $conf[
'dontCheckPid'];
107 if (!$dontCheckPid) {
108 $row = $this->cObj->checkPid($row[
'pid']) ? $row :
'';
110 if ($row && !
$GLOBALS[
'TSFE']->recordRegister[($val[
'table'] .
':' . $val[
'id'])]) {
111 $renderObjName = $conf[
'conf.'][$val[
'table']] ?:
'<' . $val[
'table'];
112 $renderObjKey = $conf[
'conf.'][$val[
'table']] ?
'conf.' . $val[
'table'] :
'';
113 $renderObjConf = $conf[
'conf.'][$val[
'table'] .
'.'];
114 $this->cObj->currentRecordNumber++;
115 $cObj->parentRecordNumber = $this->cObj->currentRecordNumber;
116 $GLOBALS[
'TSFE']->currentRecord = $val[
'table'] .
':' . $val[
'id'];
117 $this->cObj->lastChanged($row[
'tstamp']);
118 $cObj->start($row, $val[
'table']);
119 $tmpValue =
$cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
120 $theValue .= $tmpValue;
126 $wrap = isset($conf[
'wrap.']) ? $this->cObj->stdWrap($conf[
'wrap'], $conf[
'wrap.']) : $conf[
'wrap'];
128 $theValue = $this->cObj->wrap($theValue, $wrap);
130 if (isset($conf[
'stdWrap.'])) {
131 $theValue = $this->cObj->stdWrap($theValue, $conf[
'stdWrap.']);
134 $GLOBALS[
'TSFE']->currentRecord = $originalRec;
136 --
$GLOBALS[
'TSFE']->recordRegister[$originalRec];
148 protected function collectRecordsFromSource($source, array $tables)
152 $loadDB->setFetchAllFields(
true);
153 $loadDB->start($source, implode(
',', $tables));
154 foreach ($loadDB->tableArray as $table => $v) {
155 if (isset(
$GLOBALS[
'TCA'][$table])) {
156 $loadDB->additionalWhere[$table] = $this->cObj->enableFields($table);
159 $this->data = $loadDB->getFromDB();
160 reset($loadDB->itemArray);
161 $this->itemArray = $loadDB->itemArray;
177 foreach ($tables as $table) {
180 $tableRecords = array();
181 $categoriesPerRecord = array();
182 foreach ($selectedCategories as $aCategory) {
190 if ($collection->count() > 0) {
192 foreach ($collection as $item) {
193 $tableRecords[$item[
'uid']] = $item;
195 if (!isset($categoriesPerRecord[$item[
'uid']])) {
196 $categoriesPerRecord[$item[
'uid']] = array();
198 $categoriesPerRecord[$item[
'uid']][] = $aCategory;
203 'Could not get records for category id %d. Error: %s (%d)',
212 if (!empty($tableRecords)) {
213 $this->data[$table] = array();
214 foreach ($tableRecords as $record) {
215 $this->itemArray[] = array(
216 'id' => $record[
'uid'],
220 $record[
'_categories'] = implode(
',', $categoriesPerRecord[$record[
'uid']]);
221 $this->data[$table][$record[
'uid']] = $record;