/**
	 * (non-PHPdoc)
	 * @see classes/preview/tx_templavoila_preview_type_text#render_previewContent($row, $table, $output, $alreadyRendered, $ref)
	 */
	public function render_previewContent ($row, $table, $output, $alreadyRendered, &$ref) {

		$this->parentObj = $ref;

		$uploadDir = $GLOBALS['TCA']['tt_content']['columns']['image']['config']['internal_type'] == 'file_reference' ? '' : NULL;

		$thumbnail = '<strong>'.$GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','image'),1).'</strong><br />';
		$thumbnail .= t3lib_BEfunc::thumbCode($row, 'tt_content', 'image', $ref->doc->backPath, '', $uploadDir);

		$label = $this->getPreviewLabel();
		$data = $this->getPreviewData($row);

		if ($ref->currentElementBelongsToCurrentPage) {
			$text = $ref->link_edit('<strong>'. $label .'</strong> ' . $data ,'tt_content',$row['uid']);
		} else {
			$text = '<strong>'. $label .'</strong> ' . $data;
		}

		return '
		<table>
			<tr>
				<td valign="top">' . $text . '</td>
				<td valign="top">' . $thumbnail . '</td>
			</tr>
		</table>';
	}
    /**
     * Create visual difference view of two records. Using t3lib_diff library
     *
     * @param	string		Table name
     * @param	array		New version record (green)
     * @param	array		Old version record (red)
     * @return	array		Array with two keys (0/1) with HTML content / percentage integer (if -1, then it means N/A) indicating amount of change
     */
    function createDiffView($table, $diff_1_record, $diff_2_record)
    {
        global $TCA, $LANG;
        // Initialize:
        $pctChange = 'N/A';
        // Check that records are arrays:
        if (is_array($diff_1_record) && is_array($diff_2_record)) {
            // Load full table description and initialize diff-object:
            t3lib_div::loadTCA($table);
            $t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff');
            // Add header row:
            $tRows = array();
            $tRows[] = '
				<tr class="bgColor5 tableheader">
					<td>' . $LANG->getLL('diffview_label_field_name') . '</td>
					<td width="98%" nowrap="nowrap">' . $LANG->getLL('diffview_label_colored_diff_view') . '</td>
				</tr>
			';
            // Initialize variables to pick up string lengths in:
            $allStrLen = 0;
            $diffStrLen = 0;
            // Traversing the first record and process all fields which are editable:
            foreach ($diff_1_record as $fN => $fV) {
                if ($TCA[$table]['columns'][$fN] && $TCA[$table]['columns'][$fN]['config']['type'] != 'passthrough' && !t3lib_div::inList('t3ver_label', $fN)) {
                    // Check if it is files:
                    $isFiles = FALSE;
                    if (strcmp(trim($diff_1_record[$fN]), trim($diff_2_record[$fN])) && $TCA[$table]['columns'][$fN]['config']['type'] == 'group' && $TCA[$table]['columns'][$fN]['config']['internal_type'] == 'file') {
                        // Initialize:
                        $uploadFolder = $TCA[$table]['columns'][$fN]['config']['uploadfolder'];
                        $files1 = array_flip(t3lib_div::trimExplode(',', $diff_1_record[$fN], 1));
                        $files2 = array_flip(t3lib_div::trimExplode(',', $diff_2_record[$fN], 1));
                        // Traverse filenames and read their md5 sum:
                        foreach ($files1 as $filename => $tmp) {
                            $files1[$filename] = @is_file(PATH_site . $uploadFolder . '/' . $filename) ? md5(t3lib_div::getUrl(PATH_site . $uploadFolder . '/' . $filename)) : $filename;
                        }
                        foreach ($files2 as $filename => $tmp) {
                            $files2[$filename] = @is_file(PATH_site . $uploadFolder . '/' . $filename) ? md5(t3lib_div::getUrl(PATH_site . $uploadFolder . '/' . $filename)) : $filename;
                        }
                        // Implode MD5 sums and set flag:
                        $diff_1_record[$fN] = implode(' ', $files1);
                        $diff_2_record[$fN] = implode(' ', $files2);
                        $isFiles = TRUE;
                    }
                    // If there is a change of value:
                    if (strcmp(trim($diff_1_record[$fN]), trim($diff_2_record[$fN]))) {
                        // Get the best visual presentation of the value and present that:
                        $val1 = t3lib_BEfunc::getProcessedValue($table, $fN, $diff_2_record[$fN], 0, 1);
                        $val2 = t3lib_BEfunc::getProcessedValue($table, $fN, $diff_1_record[$fN], 0, 1);
                        // Make diff result and record string lenghts:
                        $diffres = $t3lib_diff_Obj->makeDiffDisplay($val1, $val2, $isFiles ? 'div' : 'span');
                        $diffStrLen .= $t3lib_diff_Obj->differenceLgd;
                        $allStrLen .= strlen($val1 . $val2);
                        // If the compared values were files, substituted MD5 hashes:
                        if ($isFiles) {
                            $allFiles = array_merge($files1, $files2);
                            foreach ($allFiles as $filename => $token) {
                                if (strlen($token) == 32 && strstr($diffres, $token)) {
                                    $filename = t3lib_BEfunc::thumbCode(array($fN => $filename), $table, $fN, $this->doc->backPath) . $filename;
                                    $diffres = str_replace($token, $filename, $diffres);
                                }
                            }
                        }
                        ############# new hook for post processing of DAM images
                        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/user/ws/class.wslib_gui.php']['postProcessDiffView'])) {
                            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/user/ws/class.wslib_gui.php']['postProcessDiffView'] as $classRef) {
                                $hookObject =& t3lib_div::getUserObj($classRef);
                                if (method_exists($hookObject, 'postProcessDiffView')) {
                                    $diffres = $hookObject->postProcessDiffView($table, $fN, $diff_2_record, $diff_1_record, $diffres, $this);
                                }
                            }
                        }
                        #############
                        // Add table row with result:
                        $tRows[] = '
							<tr class="bgColor4">
								<td>' . htmlspecialchars($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table, $fN))) . '</td>
								<td width="98%">' . $diffres . '</td>
							</tr>
						';
                    } else {
                        // Add string lengths even if value matched - in this was the change percentage is not high if only a single field is changed:
                        $allStrLen += strlen($diff_1_record[$fN] . $diff_2_record[$fN]);
                    }
                }
            }
            // Calculate final change percentage:
            $pctChange = $allStrLen ? ceil($diffStrLen * 100 / $allStrLen) : -1;
            // Create visual representation of result:
            if (count($tRows) > 1) {
                $content .= '<table border="0" cellpadding="1" cellspacing="1" class="diffTable">' . implode('', $tRows) . '</table>';
            } else {
                $content .= '<span class="nobr">' . $this->doc->icons(1) . $LANG->getLL('diffview_complete_match') . '</span>';
            }
        } else {
            $content .= $this->doc->icons(3) . $LANG->getLL('diffview_cannot_find_records');
        }
        // Return value:
        return array($content, $pctChange);
    }
 /**
  * @return string
  */
 protected function getPreviewLabel()
 {
     return $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content', $this->previewField), 1);
 }
    /**
     * Creates the listing of records from a single table
     *
     * @param	string		Table name
     * @param	integer		Page id
     * @param	string		List of fields to show in the listing. Pseudo fields will be added including the record header.
     * @return	string		HTML table with the listing for the record.
     */
    function getTable($table, $rowlist)
    {
        global $TCA, $BACK_PATH, $LANG;
        // Loading all TCA details for this table:
        t3lib_div::loadTCA($table);
        // Init
        $addWhere = '';
        $titleCol = $TCA[$table]['ctrl']['label'];
        $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
        $l10nEnabled = $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'];
        $selFieldList = $this->getSelFieldList($table, $rowlist);
        $dbCount = 0;
        if ($this->pointer->countTotal and $this->res) {
            $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($this->res);
        }
        $shEl = $this->showElements;
        $out = '';
        if ($dbCount) {
            // half line is drawn
            $theData = array();
            if (!$this->table && !$rowlist) {
                $theData[$titleCol] = '<img src="clear.gif" width="' . ($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel'] ? '230' : '350') . '" height="1">';
                if (in_array('_CONTROL_', $this->fieldArray)) {
                    $theData['_CONTROL_'] = '';
                }
            }
            #			$out.=$this->addelement('', $theData);
            // Header line is drawn
            $theData = array();
            #			$theData[$titleCol] = '<b>'.$GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'],1).'</b> ('.$this->resCount.')';
            $theUpIcon = '&nbsp;';
            // todo csh
            #			$theData[$titleCol].= t3lib_BEfunc::cshItem($table,'',$this->backPath,'',FALSE,'margin-bottom:0px; white-space: normal;');
            #			$out.=$this->addelement($theUpIcon, $theData, '', '', 'background-color:'.$this->headLineCol.'; border-bottom:1px solid #000');
            // Fixing a order table for sortby tables
            $this->currentTable = array();
            $currentIdList = array();
            $doSort = $TCA[$table]['ctrl']['sortby'] && !$this->sortField;
            $prevUid = 0;
            $prevPrevUid = 0;
            $accRows = array();
            // Accumulate rows here
            while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($this->res)) {
                $accRows[] = $row;
                $currentIdList[] = $row['uid'];
                if ($doSort) {
                    if ($prevUid) {
                        $this->currentTable['prev'][$row['uid']] = $prevPrevUid;
                        $this->currentTable['next'][$prevUid] = '-' . $row['uid'];
                        $this->currentTable['prevUid'][$row['uid']] = $prevUid;
                    }
                    $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
                    $prevUid = $row['uid'];
                }
            }
            $GLOBALS['TYPO3_DB']->sql_free_result($this->res);
            // items
            $itemContentTRows = '';
            $this->duplicateStack = array();
            $this->eCounter = $this->pointer->firstItemNum;
            $cc = 0;
            $itemContentTRows .= $this->fwd_rwd_nav('rwd');
            foreach ($accRows as $row) {
                $this->alternateBgColors = false;
                $cc++;
                $row_bgColor = $this->alternateBgColors ? $cc % 2 ? ' class="item"' : ' class="item" bgColor="' . t3lib_div::modifyHTMLColor($GLOBALS['SOBE']->doc->bgColor4, +10, +10, +10) . '"' : ' class="item"';
                // Initialization
                $iconfile = t3lib_iconWorks::getIcon($table, $row);
                $alttext = t3lib_BEfunc::getRecordIconAltText($row, $table);
                $recTitle = t3lib_BEfunc::getRecordTitle($table, $row, 1);
                // The icon with link
                $theIcon = '<img src="' . $this->backPath . $iconfile . '" width="18" height="16" border="0" title="' . $alttext . '" />';
                $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon, $table, $row['uid']);
                $thumbImg = '';
                if ($this->thumbs) {
                    $thumbImg = '<div style="margin:2px 0 2px 0;">' . $this->getThumbNail(tx_dam::path_makeAbsolute($row['file_path']) . $row['file_name']) . '</div>';
                }
                // 	Preparing and getting the data-array
                $theData = array();
                reset($this->fieldArray);
                while (list(, $fCol) = each($this->fieldArray)) {
                    if ($fCol == $titleCol) {
                        $theData[$fCol] = $this->linkWrapItems($table, $row['uid'], $recTitle, $row) . $thumbImg;
                    } elseif ($fCol == 'pid') {
                        $theData[$fCol] = $row[$fCol];
                    } elseif ($fCol == '_CONTROL_') {
                        $theData[$fCol] = $this->makeControl($table, $row);
                    } else {
                        $theData[$fCol] = t3lib_BEfunc::getProcessedValueExtra($table, $fCol, $row[$fCol], 100);
                    }
                }
                $actionIcon = '';
                $itemContentTRows .= $this->addElement($theIcon, $theData, $actionIcon, $row_bgColor, '', true);
                // Thumbsnails?
                //				if ($this->thumbs && trim($row[$thumbsCol]))	{
                //					$itemContentTRows.=$this->addelement('', Array($titleCol=>$this->thumbCode($row,$table,$thumbsCol)), '', $row_bgColor);
                //				}
                $this->eCounter++;
            }
            if ($this->eCounter > $this->pointer->firstItemNum) {
                $itemContentTRows .= $this->fwd_rwd_nav('fwd');
            }
            // field header line is drawn:
            $theData = array();
            foreach ($this->fieldArray as $fCol) {
                $permsEdit = $this->calcPerms & ($table == 'pages' ? 2 : 16);
                if ($fCol == '_CONTROL_') {
                    if (!$TCA[$table]['ctrl']['readOnly']) {
                        if ($permsEdit && $this->table && is_array($currentIdList) && in_array('editRec', $shEl)) {
                            $editIdList = implode(',', $currentIdList);
                            $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $this->fieldArray) . '&disHelp=1';
                            $content = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' vspace="2" border="0" align="top" title="' . $GLOBALS['LANG']->getLL('editShownColumns') . '" />';
                            $theData[$fCol] .= $this->wrapEditLink($content, $params);
                        }
                    }
                } else {
                    $theData[$fCol] = '';
                    #					$theData[$fCol].='&nbsp;';
                    if ($this->table && is_array($currentIdList) && in_array('editRec', $shEl)) {
                        if (!$TCA[$table]['ctrl']['readOnly'] && $permsEdit && $TCA[$table]['columns'][$fCol]) {
                            $editIdList = implode(',', $currentIdList);
                            $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol . '&disHelp=1';
                            $content = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' vspace="2" border="0" align="top" title="' . sprintf($GLOBALS['LANG']->getLL('editThisColumn'), preg_replace("/:\$/", '', trim($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table, $fCol))))) . '" />';
                            $theData[$fCol] .= $this->wrapEditLink($content, $params);
                        }
                    } else {
                        #						$theData[$fCol].='&nbsp;';
                    }
                    $theData[$fCol] .= $this->addSortLink($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table, $fCol, '&nbsp;<i>[|]</i>&nbsp;')), $fCol, $table);
                }
            }
            $out .= $this->addelement($theUpIcon, $theData, '', ' class="c-headLine"', 'border-bottom:1px solid #888');
            // The list of records is added after the header:
            $out .= $itemContentTRows;
            $out .= $this->addelement('', array(), '', '', 'border-top:1px solid #888');
            #TODO
            $LOISmode = false;
            // ... and it is all wrapped in a table:
            $out = '

			<!--
				DB listing of elements:	"' . htmlspecialchars($table) . '"
			-->
				<table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist' . ($LOISmode ? ' typo3-dblist-overview' : '') . '">
					' . $out . '
				</table>';
        }
        // Return content:
        return $out;
    }
    /**
     * Renders the header fields menu item.
     * It iss possible to define a list of fields (currently only from the pages table) which should appear
     * as a header above the content zones while editing the content of a page. This function renders those fields.
     * The fields to be displayed are defined in the page's datastructure.
     *
     * @param	$pObj:		Reference to the parent object ($this)
     * @return	string		HTML output
     * @access	private
     */
    function renderItem_headerFields(&$pObj)
    {
        global $LANG, $TCA;
        $output = '';
        if ($pObj->rootElementTable != 'pages') {
            return '';
        }
        t3lib_div::loadTCA('pages');
        $conf = $TCA['pages']['columns']['tx_templavoila_flex']['config'];
        $dataStructureArr = t3lib_BEfunc::getFlexFormDS($conf, $pObj->rootElementRecord, 'pages');
        if (is_array($dataStructureArr) && is_array($dataStructureArr['ROOT']['tx_templavoila']['pageModule'])) {
            $headerTablesAndFieldNames = t3lib_div::trimExplode(chr(10), str_replace(chr(13), '', $dataStructureArr['ROOT']['tx_templavoila']['pageModule']['displayHeaderFields']), 1);
            if (is_array($headerTablesAndFieldNames)) {
                $fieldNames = array();
                $headerFieldRows = array();
                $headerFields = array();
                foreach ($headerTablesAndFieldNames as $tableAndFieldName) {
                    list($table, $field) = explode('.', $tableAndFieldName);
                    $fieldNames[$table][] = $field;
                    $headerFields[] = array('table' => $table, 'field' => $field, 'label' => $LANG->sL(t3lib_BEfunc::getItemLabel('pages', $field)), 'value' => t3lib_BEfunc::getProcessedValue('pages', $field, $pObj->rootElementRecord[$field], 200));
                }
                if (count($headerFields)) {
                    foreach ($headerFields as $headerFieldArr) {
                        if ($headerFieldArr['table'] == 'pages') {
                            $onClick = t3lib_BEfunc::editOnClick('&edit[pages][' . $pObj->id . ']=edit&columnsOnly=' . implode(',', $fieldNames['pages']), $this->doc->backPath);
                            $linkedValue = '<a style="text-decoration: none;" href="#" onclick="' . htmlspecialchars($onClick) . '">' . htmlspecialchars($headerFieldArr['value']) . '</a>';
                            $linkedLabel = '<a style="text-decoration: none;" href="#" onclick="' . htmlspecialchars($onClick) . '">' . htmlspecialchars($headerFieldArr['label']) . '</a>';
                            $headerFieldRows[] = '
								<tr>
									<td class="bgColor4-20" style="width: 10%; vertical-align:top">' . $linkedLabel . '</td><td class="bgColor4" style="vertical-align:top"><em>' . $linkedValue . '</em></td>
								</tr>
							';
                        }
                    }
                    $output = '
						<table border="0" cellpadding="0" cellspacing="1" width="100%" class="lrPadding">
							<tr>
								<td colspan="2" class="bgColor4-20">' . $LANG->getLL('pagerelatedinformation') . ':</td>
							</tr>
							' . implode('', $headerFieldRows) . '
						</table>
					';
                }
            }
        }
        return $output;
    }
    /**
     * Creates an info-box for the current page (identified by input record).
     *
     * @param	array		Page record
     * @param	boolean		If set, there will be shown an edit icon, linking to editing of the page properties.
     * @return	string		HTML for the box.
     */
    function getPageInfoBox($rec, $edit = 0)
    {
        global $LANG;
        // If editing of the page properties is allowed:
        if ($edit) {
            $params = '&edit[pages][' . $rec['uid'] . ']=edit';
            $editIcon = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';
        } else {
            $editIcon = $this->noEditIcon('noEditPage');
        }
        // Setting page icon, link, title:
        $outPutContent = t3lib_iconWorks::getSpriteIconForRecord('pages', $rec, array('title' => t3lib_BEfunc::titleAttribForPages($rec))) . $editIcon . '&nbsp;' . htmlspecialchars($rec['title']);
        // Init array where infomation is accumulated as label/value pairs.
        $lines = array();
        // Owner user/group:
        if ($this->pI_showUser) {
            // User:
            $users = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
            $groupArray = explode(',', $GLOBALS['BE_USER']->user['usergroup_cached_list']);
            $users = t3lib_BEfunc::blindUserNames($users, $groupArray);
            $lines[] = array($LANG->getLL('pI_crUser') . ':', htmlspecialchars($users[$rec['cruser_id']]['username']) . ' (' . $users[$rec['cruser_id']]['realName'] . ')');
        }
        // Created:
        $lines[] = array($LANG->getLL('pI_crDate') . ':', t3lib_BEfunc::datetime($rec['crdate']) . ' (' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $rec['crdate'], $this->agePrefixes) . ')');
        // Last change:
        $lines[] = array($LANG->getLL('pI_lastChange') . ':', t3lib_BEfunc::datetime($rec['tstamp']) . ' (' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $rec['tstamp'], $this->agePrefixes) . ')');
        // Last change of content:
        if ($rec['SYS_LASTCHANGED']) {
            $lines[] = array($LANG->getLL('pI_lastChangeContent') . ':', t3lib_BEfunc::datetime($rec['SYS_LASTCHANGED']) . ' (' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $rec['SYS_LASTCHANGED'], $this->agePrefixes) . ')');
        }
        // Spacer:
        $lines[] = '';
        // Display contents of certain page fields, if any value:
        $dfields = explode(',', 'alias,target,hidden,starttime,endtime,fe_group,no_cache,cache_timeout,newUntil,lastUpdated,subtitle,keywords,description,abstract,author,author_email');
        foreach ($dfields as $fV) {
            if ($rec[$fV]) {
                $lines[] = array($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('pages', $fV)), t3lib_BEfunc::getProcessedValue('pages', $fV, $rec[$fV]));
            }
        }
        // Page hits (depends on "sys_stat" extension)
        if ($this->pI_showStat && t3lib_extMgm::isLoaded('sys_stat')) {
            // Counting total hits:
            $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'sys_stat', 'page_id=' . intval($rec['uid']));
            if ($count) {
                // Get min/max
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('min(tstamp) AS min,max(tstamp) AS max', 'sys_stat', 'page_id=' . intval($rec['uid']));
                $rrow2 = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
                $lines[] = '';
                $lines[] = array($LANG->getLL('pI_hitsPeriod') . ':', t3lib_BEfunc::date($rrow2[0]) . ' - ' . t3lib_BEfunc::date($rrow2[1]) . ' (' . t3lib_BEfunc::calcAge($rrow2[1] - $rrow2[0], $this->agePrefixes) . ')');
                $lines[] = array($LANG->getLL('pI_hitsTotal') . ':', $rrow[0]);
                // Last 10 days
                $nextMidNight = mktime(0, 0, 0) + 1 * 3600 * 24;
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*), FLOOR((' . $nextMidNight . '-tstamp)/(24*3600)) AS day', 'sys_stat', 'page_id=' . intval($rec['uid']) . ' AND tstamp>' . ($nextMidNight - 10 * 24 * 3600), 'day');
                $days = array();
                while ($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
                    $days[$rrow[1]] = $rrow[0];
                }
                $headerH = array();
                $contentH = array();
                for ($a = 9; $a >= 0; $a--) {
                    $headerH[] = '
							<td class="bgColor5" nowrap="nowrap">&nbsp;' . date('d', $nextMidNight - ($a + 1) * 24 * 3600) . '&nbsp;</td>';
                    $contentH[] = '
							<td align="center">' . ($days[$a] ? intval($days[$a]) : '-') . '</td>';
                }
                // Compile first hit-table (last 10 days)
                $hitTable = '
					<table border="0" cellpadding="0" cellspacing="1" class="typo3-page-hits">
						<tr>' . implode('', $headerH) . '</tr>
						<tr>' . implode('', $contentH) . '</tr>
					</table>';
                $lines[] = array($LANG->getLL('pI_hits10days') . ':', $hitTable, 1);
                // Last 24 hours
                $nextHour = mktime(date('H'), 0, 0) + 3600;
                $hours = 16;
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*), FLOOR((' . $nextHour . '-tstamp)/3600) AS hours', 'sys_stat', 'page_id=' . intval($rec['uid']) . ' AND tstamp>' . ($nextHour - $hours * 3600), 'hours');
                $days = array();
                while ($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
                    $days[$rrow[1]] = $rrow[0];
                }
                $headerH = array();
                $contentH = array();
                for ($a = $hours - 1; $a >= 0; $a--) {
                    $headerH[] = '
							<td class="bgColor5" nowrap="nowrap">&nbsp;' . intval(date('H', $nextHour - ($a + 1) * 3600)) . '&nbsp;</td>';
                    $contentH[] = '
							<td align="center">' . ($days[$a] ? intval($days[$a]) : '-') . '</td>';
                }
                // Compile second hit-table (last 24 hours)
                $hitTable = '
					<table border="0" cellpadding="0" cellspacing="1" class="typo3-page-stat">
						<tr>' . implode('', $headerH) . '</tr>
						<tr>' . implode('', $contentH) . '</tr>
					</table>';
                $lines[] = array($LANG->getLL('pI_hits24hours') . ':', $hitTable, 1);
            }
        }
        // Finally, wrap the elements in the $lines array in table cells/rows
        foreach ($lines as $fV) {
            if (is_array($fV)) {
                if (!$fV[2]) {
                    $fV[1] = htmlspecialchars($fV[1]);
                }
                $out .= '
				<tr>
					<td class="bgColor4" nowrap="nowrap"><strong>' . htmlspecialchars($fV[0]) . '&nbsp;&nbsp;</strong></td>
					<td class="bgColor4">' . $fV[1] . '</td>
				</tr>';
            } else {
                $out .= '
				<tr>
					<td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
				</tr>';
            }
        }
        // Wrap table tags around...
        $outPutContent .= '



			<!--
				Page info box:
			-->
			<table border="0" cellpadding="0" cellspacing="1" id="typo3-page-info">
				' . $out . '
			</table>';
        // ... and return it.
        return $outPutContent;
    }
예제 #7
0
    /**
     * Main function. Will generate the information to display for the item set internally.
     *
     * @return	void
     */
    function renderDBInfo()
    {
        global $TCA;
        // Print header, path etc:
        $code = $this->doc->getHeader($this->table, $this->row, $this->pageinfo['_thePath'], 1) . '<br />';
        $this->content .= $this->doc->section('', $code);
        // Initialize variables:
        $tableRows = array();
        $i = 0;
        // Traverse the list of fields to display for the record:
        $fieldList = t3lib_div::trimExplode(',', $TCA[$this->table]['interface']['showRecordFieldList'], 1);
        foreach ($fieldList as $name) {
            $name = trim($name);
            if ($TCA[$this->table]['columns'][$name]) {
                if (!$TCA[$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name)) {
                    $i++;
                    $tableRows[] = '
						<tr>
							<td class="t3-col-header">' . $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($this->table, $name), 1) . '</td>
							<td>' . htmlspecialchars(t3lib_BEfunc::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $this->row['uid'])) . '</td>
						</tr>';
                }
            }
        }
        // Create table from the information:
        $tableCode = '
					<table border="0" cellpadding="0" cellspacing="0" id="typo3-showitem" class="t3-table-info">
						' . implode('', $tableRows) . '
					</table>';
        $this->content .= $this->doc->section('', $tableCode);
        // Add path and table information in the bottom:
        $code = '';
        $code .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'], -48) . '<br />';
        $code .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.table') . ': ' . $GLOBALS['LANG']->sL($TCA[$this->table]['ctrl']['title']) . ' (' . $this->table . ') - UID: ' . $this->uid . '<br />';
        $this->content .= $this->doc->section('', $code);
        // References:
        $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem'), $this->makeRef($this->table, $this->row['uid']));
        // References:
        $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesFromThisItem'), $this->makeRefFrom($this->table, $this->row['uid']));
    }
예제 #8
0
 /**
  * Fetch futher information to current selected worspace record.
  *
  * @param object $parameter
  * @return array $data
  */
 public function getRowDetails($parameter)
 {
     global $TCA, $BE_USER;
     $diffReturnArray = array();
     $liveReturnArray = array();
     $t3lib_diff = t3lib_div::makeInstance('t3lib_diff');
     $stagesService = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
     $liveRecord = t3lib_BEfunc::getRecord($parameter->table, $parameter->t3ver_oid);
     $versionRecord = t3lib_BEfunc::getRecord($parameter->table, $parameter->uid);
     $icon_Live = t3lib_iconWorks::mapRecordTypeToSpriteIconClass($parameter->table, $liveRecord);
     $icon_Workspace = t3lib_iconWorks::mapRecordTypeToSpriteIconClass($parameter->table, $versionRecord);
     $stagePosition = $stagesService->getPositionOfCurrentStage($parameter->stage);
     $fieldsOfRecords = array_keys($liveRecord);
     // get field list from TCA configuration, if available
     if ($TCA[$parameter->table]) {
         if ($TCA[$parameter->table]['interface']['showRecordFieldList']) {
             $fieldsOfRecords = $TCA[$parameter->table]['interface']['showRecordFieldList'];
             $fieldsOfRecords = t3lib_div::trimExplode(',', $fieldsOfRecords, 1);
         }
     }
     foreach ($fieldsOfRecords as $fieldName) {
         // check for exclude fields
         if ($GLOBALS['BE_USER']->isAdmin() || $TCA[$parameter->table]['columns'][$fieldName]['exclude'] == 0 || t3lib_div::inList($BE_USER->groupData['non_exclude_fields'], $parameter->table . ':' . $fieldName)) {
             // call diff class only if there is a difference
             if (strcmp($liveRecord[$fieldName], $versionRecord[$fieldName]) !== 0) {
                 // Select the human readable values before diff
                 $liveRecord[$fieldName] = t3lib_BEfunc::getProcessedValue($parameter->table, $fieldName, $liveRecord[$fieldName], 0, 1);
                 $versionRecord[$fieldName] = t3lib_BEfunc::getProcessedValue($parameter->table, $fieldName, $versionRecord[$fieldName], 0, 1);
                 $fieldTitle = $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($parameter->table, $fieldName));
                 if ($TCA[$parameter->table]['columns'][$fieldName]['config']['type'] == 'group' && $TCA[$parameter->table]['columns'][$fieldName]['config']['internal_type'] == 'file') {
                     $versionThumb = t3lib_BEfunc::thumbCode($versionRecord, $parameter->table, $fieldName, '');
                     $liveThumb = t3lib_BEfunc::thumbCode($liveRecord, $parameter->table, $fieldName, '');
                     $diffReturnArray[] = array('label' => $fieldTitle, 'content' => $versionThumb);
                     $liveReturnArray[] = array('label' => $fieldTitle, 'content' => $liveThumb);
                 } else {
                     $diffReturnArray[] = array('label' => $fieldTitle, 'content' => $t3lib_diff->makeDiffDisplay($liveRecord[$fieldName], $versionRecord[$fieldName]));
                     $liveReturnArray[] = array('label' => $fieldTitle, 'content' => $liveRecord[$fieldName]);
                 }
             }
         }
     }
     $commentsForRecord = $this->getCommentsForRecord($parameter->uid, $parameter->table);
     return array('total' => 1, 'data' => array(array('diff' => $diffReturnArray, 'live_record' => $liveReturnArray, 'path_Live' => $parameter->path_Live, 'label_Stage' => $parameter->label_Stage, 'stage_position' => $stagePosition['position'], 'stage_count' => $stagePosition['count'], 'comments' => $commentsForRecord, 'icon_Live' => $icon_Live, 'icon_Workspace' => $icon_Workspace)));
 }
 /**
  * Creates the column control panel for the header.
  *
  * @param 	string 	$field Column key
  * @return	string		control panel (unless disabled)
  */
 function getHeaderColumnControl($field)
 {
     $content = '';
     if ($this->isEditableColumn($field) and is_array($this->currentTable['idList']) and $this->showControls) {
         $editIdList = implode(',', $this->currentTable['idList']);
         $params = '&edit[' . $this->table . '][' . $editIdList . ']=edit&columnsOnly=' . $field . '&disHelp=1';
         $iTitle = sprintf($GLOBALS['LANG']->getLL('editThisColumn'), preg_replace('#:$#', '', trim($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($this->table, $field)))));
         $content = '<img ' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/edit2.gif', 'width="11" height="12"') . ' title="' . htmlspecialchars($iTitle) . '" alt="" />';
         $onClick = t3lib_BEfunc::editOnClick($params, $GLOBALS['BACK_PATH'], -1);
         $content = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $content . '</a>';
     }
     return $content;
 }
 /**
  * Returns an HTMLized preview of a certain content element. If you'd like to register a new content type, you can easily use the hook
  * provided at the beginning of the function.
  *
  * @param	array		$row: The row of tt_content containing the content element record.
  * @return	string		HTML preview content
  * @access protected
  * @see		getContentTree(), render_localizationInfoTable()
  */
 function render_previewContent($row)
 {
     global $TYPO3_CONF_VARS, $LANG, $LANGPLUGIN, $TCA;
     $hookObjectsArr = $this->hooks_prepareObjectsArray('renderPreviewContentClass');
     $alreadyRendered = FALSE;
     $output = '';
     // ELIO@GOSIGN 13/08/09: For LFEditor Link
     $langFile = '';
     // Hook: renderPreviewContent_preProcess. Set 'alreadyRendered' to true if you provided a preview content for the current cType !
     reset($hookObjectsArr);
     while (list(, $hookObj) = each($hookObjectsArr)) {
         if (method_exists($hookObj, 'renderPreviewContent_preProcess')) {
             $output .= $hookObj->renderPreviewContent_preProcess($row, 'tt_content', $alreadyRendered, $this);
         }
     }
     if (!$alreadyRendered) {
         // Preview content for non-flexible content elements:
         switch ($row['CType']) {
             case 'table':
                 //	Table
                 $output = '<strong>' . $LANG->getLL($row['CType'] . '.field.text', 1) . '</strong>: <br />' . nl2br($row['bodytext']) . '<br />' . $this->getPiName($LANGPLUGIN->getLL('common_6_title'));
                 break;
             case 'splash':
                 //	Textbox
                 $thumbnail = '<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'image'), 1) . '</strong><br />';
                 $thumbnail .= t3lib_BEfunc::thumbCode($row, 'tt_content', 'image', $this->doc->backPath);
                 $text = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'bodytext'), 1) . '</strong> ' . htmlspecialchars(t3lib_div::fixed_lgd_cs(trim(strip_tags($row['bodytext'])), 2000)), 'tt_content', $row['uid']);
                 $output = '<table><tr><td valign="top">' . $text . '</td><td valign="top">' . $thumbnail . '</td></tr></table>' . '<br />';
                 break;
             case 'list':
                 //	Insert Plugin
                 switch ($row['list_type']) {
                     case '9':
                         $html = $this->getTTNews($row);
                         break;
                     case 'rwe_feuseradmin_pi1':
                         $html = '<strong>' . $LANG->getLL($row['list_type'] . '.field.hinweis', 1) . '</strong>: <br />' . $LANG->getLL($row['list_type'] . '.field.hinweis.content', 1) . '<br />' . $this->getPiName($LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'list_type', $row['list_type'])));
                         break;
                     case 'th_mailformplus_pi1':
                         $html = '<strong>' . $LANG->getLL($row['list_type'] . '.field.hinweis', 1) . '</strong>: <br />' . $LANG->getLL($row['list_type'] . '.field.hinweis.content', 1) . '<br />' . '<br /><br /><strong style="margin:2px;padding:2px;border:1px solid #bfbfbf; background-color:#FFFFFF;">' . $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'list_type', $row['list_type'])) . '</strong><br /><br />';
                         // ELIO@GOSIGN 13/08/09 START
                         // LFE-Link: we have to set the langfile like this for this plugin
                         $typoscript = $this->loadTS($row['pid']);
                         $langFile = $typoscript->setup['plugin.']['tx_thmailformplus_pi1.']['langFile'];
                         // ELIO@GOSIGN 13/08/09 END
                         break;
                 }
                 if ($html) {
                     $output = $this->link_edit($html, 'tt_content', $row['uid']) . '<br />';
                 } else {
                     $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'list_type')) . '</strong> ' . htmlspecialchars($LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'list_type', $row['list_type']))) . ' &ndash; ' . htmlspecialchars($extraInfo ? $extraInfo : $row['list_type']), 'tt_content', $row['uid']) . '<br />';
                 }
                 break;
             case 'div':
                 //	Divider
             //	Divider
             case 'templavoila_pi1':
                 //	Flexible Content Element: Rendered directly in getContentTree*()
                 switch ($row['tx_templavoila_to']) {
                     default:
                         // Render the Rest Flexform Elements
                         $html = $this->renderFlex($row);
                         break;
                 }
                 $output = $html;
                 break;
             default:
                 // Render the Rest CType Elements
                 $output = $this->renderPi($row);
         }
     }
     // ELIO@GOSIGN 13/08/09 START
     // Add LFEditor link
     if ($row['CType'] == 'list' && !empty($row['list_type'])) {
         //  if this is a plugin
         $output .= $this->addLFEditLink($row['list_type'], $langFile);
     } elseif ($row['CType'] != 'list') {
         // if this is a normal CType
         $output .= $this->addLFEditLink($row['CType'], $langFile);
     }
     // ELIO@GOSIGN 13/08/09 END
     return $output;
 }
    /**
     * Draws the preview content for a content element
     *
     * @param	string		Content element
     * @param	boolean		Set if the RTE link can be created.
     * @return	string		HTML
     */
    function tt_content_drawItem($row, $isRTE = FALSE)
    {
        global $TCA;
        $out = '';
        $outHeader = '';
        // Make header:
        if ($row['header'] && $row['header_layout'] != 100) {
            $infoArr = array();
            $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
            $outHeader = ($row['date'] ? htmlspecialchars($this->itemLabels['date'] . ' ' . t3lib_BEfunc::date($row['date'])) . '<br />' : '') . $this->infoGif($infoArr) . '<b>' . $this->linkEditContent($this->renderText($row['header']), $row) . '</b><br />';
        }
        // Make content:
        $infoArr = array();
        switch ($row['CType']) {
            case 'header':
                if ($row['subheader']) {
                    $this->getProcessedValue('tt_content', 'layout', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
                }
                break;
            case 'text':
            case 'textpic':
            case 'image':
                if ($row['CType'] == 'text' || $row['CType'] == 'textpic') {
                    if ($row['bodytext']) {
                        $this->getProcessedValue('tt_content', 'text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
                        $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                    }
                }
                if ($row['CType'] == 'textpic' || $row['CType'] == 'image') {
                    if ($row['image']) {
                        $infoArr = array();
                        $this->getProcessedValue('tt_content', 'imageorient,imagecols,image_noRows,imageborder,imageheight,image_link,image_zoom,image_compression,image_effects,image_frames', $row, $infoArr);
                        $out .= $this->infoGif($infoArr) . $this->thumbCode($row, 'tt_content', 'image') . '<br />';
                        if ($row['imagecaption']) {
                            $infoArr = array();
                            $this->getProcessedValue('tt_content', 'imagecaption_position', $row, $infoArr);
                            $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
                        }
                    }
                    ###########
                    if ($row['tx_damttcontent_files']) {
                        require_once PATH_txdam . 'lib/class.tx_dam_image.php';
                        require_once PATH_txdam . 'lib/class.tx_dam_tcefunc.php';
                        require_once PATH_txdam . 'lib/class.tx_dam_guifunc.php';
                        $config = $TCA['tt_content']['columns']['tx_damttcontent_files']['config'];
                        if ($GLOBALS['BE_USER']->workspace !== 0) {
                            $workspaceRecord = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, 'tt_content', $row['uid']);
                            if ($workspaceRecord) {
                                $row = $workspaceRecord;
                            }
                        }
                        $filesArray = tx_dam_db::getReferencedFiles('tt_content', $row['uid'], $config['MM_match_fields'], $config['MM'], 'tx_dam.*');
                        foreach ($filesArray['rows'] as $rowDAM) {
                            $caption = tx_dam_guiFunc::meta_compileInfoData($rowDAM, '_caption:truncate:100', 'value-string');
                            #$imgAttributes['title'] = tx_dam_guiFunc::meta_compileHoverText($rowDAM);
                            #$thumb = tx_dam_image::previewImgTag($rowDAM, '', $imgAttributes);
                            $thumb = tx_dam_guiFunc::thumbnail($rowDAM);
                            $thumb = '<div style="float:left;width:56px; overflow:auto; margin: 2px 5px 2px 0; padding: 5px; background-color:#fff; border:solid 1px #ccc;">' . $thumb . '</div>';
                            $thumb = '<div>' . $thumb . $caption . '</div><div style="clear:both"></div>';
                            $out .= $thumb;
                        }
                    }
                    #############
                }
                break;
            case 'bullets':
                if ($row['bodytext']) {
                    $this->getProcessedValue('tt_content', 'layout,text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
            case 'table':
                if ($row['bodytext']) {
                    $this->getProcessedValue('tt_content', 'table_bgColor,table_border,table_cellspacing,cols,layout,text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
            case 'uploads':
                if ($row['media']) {
                    $this->getProcessedValue('tt_content', 'media,select_key,layout,filelink_size,table_bgColor,table_border,table_cellspacing', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
            case 'multimedia':
                if ($row['multimedia']) {
                    $out .= $this->renderText($row['multimedia']) . '<br />';
                    $out .= $this->renderText($row['parameters']) . '<br />';
                }
                break;
            case 'mailform':
                if ($row['bodytext']) {
                    $this->getProcessedValue('tt_content', 'pages,subheader', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
            case 'splash':
                if ($row['bodytext']) {
                    $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                if ($row['image']) {
                    $infoArr = array();
                    $this->getProcessedValue('tt_content', 'imagewidth', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->thumbCode($row, 'tt_content', 'image') . '<br />';
                }
                break;
            case 'menu':
                if ($row['pages']) {
                    $this->getProcessedValue('tt_content', 'menu_type', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($row['pages'], $row) . '<br />';
                }
                break;
            case 'shortcut':
                if ($row['records']) {
                    $this->getProcessedValue('tt_content', 'layout', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($row['shortcut'], $row) . '<br />';
                }
                break;
            case 'list':
                $this->getProcessedValue('tt_content', 'layout', $row, $infoArr);
                $out .= $this->infoGif($infoArr) . $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content', 'list_type'), 1) . ' ' . $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'list_type', $row['list_type']), 1) . '<br />';
                $out .= $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content', 'select_key'), 1) . ' ' . $row['select_key'] . '<br />';
                $infoArr = array();
                $this->getProcessedValue('tt_content', 'recursive', $row, $infoArr);
                $out .= $this->infoGif($infoArr) . $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'pages', $row['pages']), 1) . '<br />';
                break;
            case 'script':
                $out .= $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content', 'select_key'), 1) . ' ' . $row['select_key'] . '<br />';
                $out .= '<br />' . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                $out .= '<br />' . $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
                break;
            default:
                if ($row['bodytext']) {
                    $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
        }
        // Wrap span-tags:
        $out = '
			<span class="exampleContent">' . $out . '</span>';
        // Add header:
        $out = $outHeader . $out;
        // Add RTE button:
        if ($isRTE) {
            $out .= $this->linkRTEbutton($row);
        }
        // Return values:
        if ($this->isDisabled('tt_content', $row)) {
            return $GLOBALS['TBE_TEMPLATE']->dfw($out);
        } else {
            return $out;
        }
    }
예제 #12
0
 /**
  * Returns an HTMLized preview of a certain content element. If you'd like to register a new content type, you can easily use the hook
  * provided at the beginning of the function.
  *
  * @param	array		$row: The row of tt_content containing the content element record.
  * @return	string		HTML preview content
  * @access protected
  * @see		getContentTree(), render_localizationInfoTable()
  */
 function render_previewContent($row)
 {
     global $TYPO3_CONF_VARS, $LANG;
     $hookObjectsArr = $this->hooks_prepareObjectsArray('renderPreviewContentClass');
     $alreadyRendered = FALSE;
     $output = '';
     // Hook: renderPreviewContent_preProcess. Set 'alreadyRendered' to true if you provided a preview content for the current cType !
     reset($hookObjectsArr);
     while (list(, $hookObj) = each($hookObjectsArr)) {
         if (method_exists($hookObj, 'renderPreviewContent_preProcess')) {
             $output .= $hookObj->renderPreviewContent_preProcess($row, 'tt_content', $alreadyRendered, $this);
         }
     }
     if (!$alreadyRendered) {
         // Preview content for non-flexible content elements:
         switch ($row['CType']) {
             case 'text':
                 //	Text
             //	Text
             case 'table':
                 //	Table
             //	Table
             case 'mailform':
                 //	Form
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'bodytext'), 1) . '</strong> ' . htmlspecialchars(t3lib_div::fixed_lgd_cs(trim(strip_tags($row['bodytext'])), 2000)), 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'image':
                 //	Image
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'image'), 1) . '</strong><br /> ', 'tt_content', $row['uid']) . t3lib_BEfunc::thumbCode($row, 'tt_content', 'image', $this->doc->backPath) . '<br />';
                 break;
             case 'textpic':
                 //	Text w/image
             //	Text w/image
             case 'splash':
                 //	Textbox
                 $thumbnail = '<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'image'), 1) . '</strong><br />';
                 $thumbnail .= t3lib_BEfunc::thumbCode($row, 'tt_content', 'image', $this->doc->backPath);
                 $text = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'bodytext'), 1) . '</strong> ' . htmlspecialchars(t3lib_div::fixed_lgd_cs(trim(strip_tags($row['bodytext'])), 2000)), 'tt_content', $row['uid']);
                 $output = '<table><tr><td valign="top">' . $text . '</td><td valign="top">' . $thumbnail . '</td></tr></table>' . '<br />';
                 break;
             case 'bullets':
                 //	Bullets
                 $htmlBullets = '';
                 $bulletsArr = explode("\n", t3lib_div::fixed_lgd_cs($row['bodytext'], 2000));
                 if (is_array($bulletsArr)) {
                     foreach ($bulletsArr as $listItem) {
                         $htmlBullets .= htmlspecialchars(trim(strip_tags($listItem))) . '<br />';
                     }
                 }
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'bodytext'), 1) . '</strong><br />' . $htmlBullets, 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'uploads':
                 //	Filelinks
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'media'), 1) . '</strong><br />' . str_replace(',', '<br />', htmlspecialchars(t3lib_div::fixed_lgd_cs(trim(strip_tags($row['media'])), 2000))), 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'multimedia':
                 //	Multimedia
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'multimedia'), 1) . '</strong><br />' . str_replace(',', '<br />', htmlspecialchars(t3lib_div::fixed_lgd_cs(trim(strip_tags($row['multimedia'])), 2000))), 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'menu':
                 //	Menu / Sitemap
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'menu_type')) . '</strong> ' . $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'menu_type', $row['menu_type'])) . '<br />' . '<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'pages')) . '</strong> ' . $row['pages'], 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'list':
                 //	Insert Plugin
                 $extraInfo = $this->render_previewContent_extraPluginInfo($row);
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'list_type')) . '</strong> ' . htmlspecialchars($LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'list_type', $row['list_type']))) . ' &ndash; ' . htmlspecialchars($extraInfo ? $extraInfo : $row['list_type']), 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'html':
                 //	HTML
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'bodytext'), 1) . '</strong> ' . htmlspecialchars(t3lib_div::fixed_lgd_cs(trim($row['bodytext']), 2000)), 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'header':
                 // Header
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'header'), 1) . '</strong> ' . htmlspecialchars(t3lib_div::fixed_lgd_cs(trim(strip_tags($row['header'])), 2000)), 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'search':
                 //	Search Box
             //	Search Box
             case 'login':
                 //	Login Box
             //	Login Box
             case 'shortcut':
                 //	Insert records
             //	Insert records
             case 'div':
                 //	Divider
             //	Divider
             case 'templavoila_pi1':
                 //	Flexible Content Element: Rendered directly in getContentTree*()
                 break;
             default:
                 // return CType name for unhandled CType
                 $output = '<strong>' . htmlspecialchars($row['CType']) . '</strong><br />';
         }
     }
     return $output;
 }