TYPO3 CMS  TYPO3_6-2
ContentContentObject.php
Go to the documentation of this file.
1 <?php
3 
23 
30  public function render($conf = array()) {
31  if (!empty($conf['if.']) && !$this->cObj->checkIf($conf['if.'])) {
32  return '';
33  }
34 
35  $theValue = '';
36  $originalRec = $GLOBALS['TSFE']->currentRecord;
37  // If the currentRecord is set, we register, that this record has invoked this function.
38  // It's should not be allowed to do this again then!!
39  if ($originalRec) {
40  ++$GLOBALS['TSFE']->recordRegister[$originalRec];
41  }
42  $conf['table'] = isset($conf['table.']) ? trim($this->cObj->stdWrap($conf['table'], $conf['table.'])) : trim($conf['table']);
43  $renderObjName = $conf['renderObj'] ?: '<' . $conf['table'];
44  $renderObjKey = $conf['renderObj'] ? 'renderObj' : '';
45  $renderObjConf = $conf['renderObj.'];
46  $slide = isset($conf['slide.']) ? (int)$this->cObj->stdWrap($conf['slide'], $conf['slide.']) : (int)$conf['slide'];
47  if (!$slide) {
48  $slide = 0;
49  }
50  $slideCollect = isset($conf['slide.']['collect.']) ? (int)$this->cObj->stdWrap($conf['slide.']['collect'], $conf['slide.']['collect.']) : (int)$conf['slide.']['collect'];
51  if (!$slideCollect) {
52  $slideCollect = 0;
53  }
54  $slideCollectReverse = isset($conf['slide.']['collectReverse.']) ? (int)$this->cObj->stdWrap($conf['slide.']['collectReverse'], $conf['slide.']['collectReverse.']) : (int)$conf['slide.']['collectReverse'];
55  $slideCollectReverse = $slideCollectReverse ? TRUE : FALSE;
56  $slideCollectFuzzy = isset($conf['slide.']['collectFuzzy.']) ? (int)$this->cObj->stdWrap($conf['slide.']['collectFuzzy'], $conf['slide.']['collectFuzzy.']) : (int)$conf['slide.']['collectFuzzy'];
57  if ($slideCollectFuzzy) {
58  $slideCollectFuzzy = TRUE;
59  } else {
60  $slideCollectFuzzy = FALSE;
61  }
62  if (!$slideCollect) {
63  $slideCollectFuzzy = TRUE;
64  }
65  $again = FALSE;
66  do {
67  $res = $this->cObj->exec_getQuery($conf['table'], $conf['select.']);
68  if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
69  $GLOBALS['TT']->setTSlogMessage($error, 3);
70  } else {
71  $this->cObj->currentRecordTotal = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
72  $GLOBALS['TT']->setTSlogMessage('NUMROWS: ' . $GLOBALS['TYPO3_DB']->sql_num_rows($res));
74  $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
75  $cObj->setParent($this->cObj->data, $this->cObj->currentRecord);
76  $this->cObj->currentRecordNumber = 0;
77  $cobjValue = '';
78  while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
79  // Versioning preview:
80  $GLOBALS['TSFE']->sys_page->versionOL($conf['table'], $row, TRUE);
81  // Language overlay:
82  if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
83  if ($conf['table'] == 'pages') {
84  $row = $GLOBALS['TSFE']->sys_page->getPageOverlay($row);
85  } else {
86  $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
87  }
88  }
89  // Might be unset in the sys_language_contentOL
90  if (is_array($row)) {
91  // Call hook for possible manipulation of database row for cObj->data
92  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content_content.php']['modifyDBRow'])) {
93  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content_content.php']['modifyDBRow'] as $_classRef) {
95  $_procObj->modifyDBRow($row, $conf['table']);
96  }
97  }
98  if ($GLOBALS['TYPO3_CONF_VARS']['FE']['activateContentAdapter']) {
99  \TYPO3\CMS\Core\Resource\Service\FrontendContentAdapterService::modifyDBRow($row, $conf['table']);
100  }
101  if (!$GLOBALS['TSFE']->recordRegister[($conf['table'] . ':' . $row['uid'])]) {
102  $this->cObj->currentRecordNumber++;
103  $cObj->parentRecordNumber = $this->cObj->currentRecordNumber;
104  $GLOBALS['TSFE']->currentRecord = $conf['table'] . ':' . $row['uid'];
105  $this->cObj->lastChanged($row['tstamp']);
106  $cObj->start($row, $conf['table']);
107  $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
108  $cobjValue .= $tmpValue;
109  }
110  }
111  }
112  $GLOBALS['TYPO3_DB']->sql_free_result($res);
113  }
114  if ($slideCollectReverse) {
115  $theValue = $cobjValue . $theValue;
116  } else {
117  $theValue .= $cobjValue;
118  }
119  if ($slideCollect > 0) {
120  $slideCollect--;
121  }
122  if ($slide) {
123  if ($slide > 0) {
124  $slide--;
125  }
126  $conf['select.']['pidInList'] = $this->cObj->getSlidePids($conf['select.']['pidInList'], $conf['select.']['pidInList.']);
127  if (isset($conf['select.']['pidInList.'])) {
128  unset($conf['select.']['pidInList.']);
129  }
130  $again = strlen($conf['select.']['pidInList']) ? TRUE : FALSE;
131  }
132  } while ($again && ($slide && !strlen($theValue) && $slideCollectFuzzy || $slide && $slideCollect));
133 
134  $wrap = isset($conf['wrap.']) ? $this->cObj->stdWrap($conf['wrap'], $conf['wrap.']) : $conf['wrap'];
135  if ($wrap) {
136  $theValue = $this->cObj->wrap($theValue, $wrap);
137  }
138  if (isset($conf['stdWrap.'])) {
139  $theValue = $this->cObj->stdWrap($theValue, $conf['stdWrap.']);
140  }
141  // Restore
142  $GLOBALS['TSFE']->currentRecord = $originalRec;
143  if ($originalRec) {
144  --$GLOBALS['TSFE']->recordRegister[$originalRec];
145  }
146  return $theValue;
147  }
148 
149 }
static getUserObj($classRef, $checkPrefix='', $silent=FALSE)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]