Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 160 lines (155 sloc) 6.897 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
<?php
namespace TYPO3\CMS\Frontend\ContentObject;

/***************************************************************
* Copyright notice
*
* (c) 2010-2013 Xavier Perseguers <typo3@perseguers.ch>
* (c) 2010-2013 Steffen Kamper <steffen@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the text file GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Contains CONTENT class object.
*
* @author Xavier Perseguers <typo3@perseguers.ch>
* @author Steffen Kamper <steffen@typo3.org>
*/
class ContentContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractContentObject {

/**
* Rendering the cObject, CONTENT
*
* @param array $conf Array of TypoScript properties
* @return string Output
*/
public function render($conf = array()) {
$theValue = '';
$originalRec = $GLOBALS['TSFE']->currentRecord;
// If the currentRecord is set, we register, that this record has invoked this function.
// It's should not be allowed to do this again then!!
if ($originalRec) {
++$GLOBALS['TSFE']->recordRegister[$originalRec];
}
$conf['table'] = isset($conf['table.']) ? trim($this->cObj->stdWrap($conf['table'], $conf['table.'])) : trim($conf['table']);
$renderObjName = $conf['renderObj'] ?: '<' . $conf['table'];
$renderObjKey = $conf['renderObj'] ? 'renderObj' : '';
$renderObjConf = $conf['renderObj.'];
$slide = isset($conf['slide.']) ? (int)$this->cObj->stdWrap($conf['slide'], $conf['slide.']) : (int)$conf['slide'];
if (!$slide) {
$slide = 0;
}
$slideCollect = isset($conf['slide.']['collect.']) ? (int)$this->cObj->stdWrap($conf['slide.']['collect'], $conf['slide.']['collect.']) : (int)$conf['slide.']['collect'];
if (!$slideCollect) {
$slideCollect = 0;
}
$slideCollectReverse = isset($conf['slide.']['collectReverse.']) ? (int)$this->cObj->stdWrap($conf['slide.']['collectReverse'], $conf['slide.']['collectReverse.']) : (int)$conf['slide.']['collectReverse'];
$slideCollectReverse = $slideCollectReverse ? TRUE : FALSE;
$slideCollectFuzzy = isset($conf['slide.']['collectFuzzy.']) ? (int)$this->cObj->stdWrap($conf['slide.']['collectFuzzy'], $conf['slide.']['collectFuzzy.']) : (int)$conf['slide.']['collectFuzzy'];
if ($slideCollectFuzzy) {
$slideCollectFuzzy = TRUE;
} else {
$slideCollectFuzzy = FALSE;
}
if (!$slideCollect) {
$slideCollectFuzzy = TRUE;
}
$again = FALSE;
do {
$res = $this->cObj->exec_getQuery($conf['table'], $conf['select.']);
if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
$GLOBALS['TT']->setTSlogMessage($error, 3);
} else {
$this->cObj->currentRecordTotal = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
$GLOBALS['TT']->setTSlogMessage('NUMROWS: ' . $GLOBALS['TYPO3_DB']->sql_num_rows($res));
/** @var $cObj \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer */
$cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$cObj->setParent($this->cObj->data, $this->cObj->currentRecord);
$this->cObj->currentRecordNumber = 0;
$cobjValue = '';
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
// Versioning preview:
$GLOBALS['TSFE']->sys_page->versionOL($conf['table'], $row, TRUE);
// Language overlay:
if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
if ($conf['table'] == 'pages') {
$row = $GLOBALS['TSFE']->sys_page->getPageOverlay($row);
} else {
$row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
}
}
// Might be unset in the sys_language_contentOL
if (is_array($row)) {
// Call hook for possible manipulation of database row for cObj->data
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content_content.php']['modifyDBRow'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content_content.php']['modifyDBRow'] as $_classRef) {
$_procObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
$_procObj->modifyDBRow($row, $conf['table']);
}
}
if ($GLOBALS['TYPO3_CONF_VARS']['FE']['activateContentAdapter']) {
\TYPO3\CMS\Core\Resource\Service\FrontendContentAdapterService::modifyDBRow($row, $conf['table']);
}
if (!$GLOBALS['TSFE']->recordRegister[($conf['table'] . ':' . $row['uid'])]) {
$this->cObj->currentRecordNumber++;
$cObj->parentRecordNumber = $this->cObj->currentRecordNumber;
$GLOBALS['TSFE']->currentRecord = $conf['table'] . ':' . $row['uid'];
$this->cObj->lastChanged($row['tstamp']);
$cObj->start($row, $conf['table']);
$tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
$cobjValue .= $tmpValue;
}
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
if ($slideCollectReverse) {
$theValue = $cobjValue . $theValue;
} else {
$theValue .= $cobjValue;
}
if ($slideCollect > 0) {
$slideCollect--;
}
if ($slide) {
if ($slide > 0) {
$slide--;
}
$conf['select.']['pidInList'] = $this->cObj->getSlidePids($conf['select.']['pidInList'], $conf['select.']['pidInList.']);
if (isset($conf['select.']['pidInList.'])) {
unset($conf['select.']['pidInList.']);
}
$again = strlen($conf['select.']['pidInList']) ? TRUE : FALSE;
}
} while ($again && ($slide && !strlen($tmpValue) && $slideCollectFuzzy || $slide && $slideCollect));

$wrap = isset($conf['wrap.']) ? $this->cObj->stdWrap($conf['wrap'], $conf['wrap.']) : $conf['wrap'];
if ($wrap) {
$theValue = $this->cObj->wrap($theValue, $wrap);
}
if (isset($conf['stdWrap.'])) {
$theValue = $this->cObj->stdWrap($theValue, $conf['stdWrap.']);
}
// Restore
$GLOBALS['TSFE']->currentRecord = $originalRec;
if ($originalRec) {
--$GLOBALS['TSFE']->recordRegister[$originalRec];
}
return $theValue;
}

}
Something went wrong with that request. Please try again.