本文整理汇总了PHP中t3lib_BEfunc::getProcessedValue方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_BEfunc::getProcessedValue方法的具体用法?PHP t3lib_BEfunc::getProcessedValue怎么用?PHP t3lib_BEfunc::getProcessedValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_BEfunc
的用法示例。
在下文中一共展示了t3lib_BEfunc::getProcessedValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderItem_headerFields
/**
* 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;
}
示例2: createDiffView
/**
* 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>';
//.........这里部分代码省略.........
示例3: compareRecords
/**
* Compares two records, the current database record and the one from the import memory. Will return HTML code to show any differences between them!
*
* @param array Database record, all fields (new values)
* @param array Import memorys record for the same table/uid, all fields (old values)
* @param string The table name of the record
* @param boolean Inverse the diff view (switch red/green, needed for pre-update difference view)
* @return string HTML
*/
function compareRecords($databaseRecord, $importRecord, $table, $inverseDiff = FALSE)
{
global $TCA, $LANG;
// Initialize:
$output = array();
$t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff');
// Check if both inputs are records:
if (is_array($databaseRecord) && is_array($importRecord)) {
// Traverse based on database record
foreach ($databaseRecord as $fN => $value) {
if (is_array($TCA[$table]['columns'][$fN]) && $TCA[$table]['columns'][$fN]['config']['type'] != 'passthrough') {
if (isset($importRecord[$fN])) {
if (strcmp(trim($databaseRecord[$fN]), trim($importRecord[$fN]))) {
// Create diff-result:
$output[$fN] = $t3lib_diff_Obj->makeDiffDisplay(t3lib_BEfunc::getProcessedValue($table, $fN, !$inverseDiff ? $importRecord[$fN] : $databaseRecord[$fN], 0, 1, 1), t3lib_BEfunc::getProcessedValue($table, $fN, !$inverseDiff ? $databaseRecord[$fN] : $importRecord[$fN], 0, 1, 1));
}
unset($importRecord[$fN]);
} else {
// This will tell us if the field is not in the import file, but who cares? It is totally ok that the database contains fields that are not in the import, isn't it (extensions could be installed that added these fields!)?
#$output[$fN] = '<strong>Field missing</strong> in import file';
}
}
}
// Traverse remaining in import record:
foreach ($importRecord as $fN => $value) {
if (is_array($TCA[$table]['columns'][$fN]) && $TCA[$table]['columns'][$fN]['config']['type'] != 'passthrough') {
$output[$fN] = '<strong>Field missing</strong> in database';
}
}
// Create output:
if (count($output)) {
$tRows = array();
foreach ($output as $fN => $state) {
$tRows[] = '
<tr>
<td class="bgColor5">' . $LANG->sL($TCA[$table]['columns'][$fN]['label'], 1) . ' (' . htmlspecialchars($fN) . ')</td>
<td class="bgColor4">' . $state . '</td>
</tr>
';
}
$output = '<table border="0" cellpadding="0" cellspacing="1">' . implode('', $tRows) . '</table>';
} else {
$output = 'Match';
}
return '<strong class="nobr">[' . htmlspecialchars($table . ':' . $importRecord['uid'] . ' => ' . $databaseRecord['uid']) . ']:</strong> ' . $output;
}
return 'ERROR: One of the inputs were not an array!';
}
示例4: getProcessedValueForZeroStringIsZero
/**
* @test
*
* @see http://bugs.typo3.org/view.php?id=11875
*/
public function getProcessedValueForZeroStringIsZero()
{
$this->assertEquals('0', $this->fixture->getProcessedValue('tt_content', 'header', '0'));
}
示例5: getPageInfoBox
/**
* 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 . ' ' . 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"> ' . date('d', $nextMidNight - ($a + 1) * 24 * 3600) . ' </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"> ' . intval(date('H', $nextHour - ($a + 1) * 3600)) . ' </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>
//.........这里部分代码省略.........
示例6: ext_printOverview
//.........这里部分代码省略.........
$tsparser = t3lib_div::makeInstance('t3lib_TSparser');
$tsparser->lineNumberOffset = 0;
$out[$k] = $tsparser->doSyntaxHighlight($v, 0, 1);
break;
case 'explicit_allowdeny':
// Explode and flip values:
$nef = array_flip(explode(',', $v));
$pout = array();
$theTypes = t3lib_BEfunc::getExplicitAuthFieldValues();
// Icons:
$icons = array('ALLOW' => t3lib_iconWorks::getSpriteIcon('status-dialog-ok'), 'DENY' => t3lib_iconWorks::getSpriteIcon('status-dialog-error'));
// Traverse types:
foreach ($theTypes as $tableFieldKey => $theTypeArrays) {
if (is_array($theTypeArrays['items'])) {
$pout[] = '<strong>' . $theTypeArrays['tableFieldLabel'] . '</strong>';
// Traverse options for this field:
foreach ($theTypeArrays['items'] as $itemValue => $itemContent) {
$v = $tableFieldKey . ':' . $itemValue . ':' . $itemContent[0];
if (isset($nef[$v])) {
unset($nef[$v]);
$pout[] = $icons[$itemContent[0]] . '[' . $itemContent[2] . '] ' . $itemContent[1];
} else {
$pout[] = '<em style="color: #666666;">' . $icons[$itemContent[0] == 'ALLOW' ? 'DENY' : 'ALLOW'] . '[' . $itemContent[2] . '] ' . $itemContent[1] . '</em>';
}
}
$pout[] = '';
}
}
// Add remaining:
if (count($nef)) {
$pout = array_merge($pout, array_keys($nef));
}
// Implode for display:
$out[$k] = implode('<br />', $pout);
break;
case 'allowed_languages':
// Explode and flip values:
$nef = array_flip(explode(',', $v));
$pout = array();
// Get languages:
$items = t3lib_BEfunc::getSystemLanguages();
// Traverse values:
foreach ($items as $iCfg) {
if (isset($nef[$iCfg[1]])) {
unset($nef[$iCfg[1]]);
if (strpos($iCfg[2], '.gif') === FALSE) {
$icon = t3lib_iconWorks::getSpriteIcon($iCfg[2]) . ' ';
} elseif (strlen($iCfg[2])) {
$icon = '<img ' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/' . $iCfg[2]) . ' class="absmiddle" style="margin-right: 5px;" alt="" />';
} else {
$icon = '';
}
$pout[] = $icon . $iCfg[0];
}
}
// Add remaining:
if (count($nef)) {
$pout = array_merge($pout, array_keys($nef));
}
// Implode for display:
$out[$k] = implode('<br />', $pout);
break;
case 'workspace_perms':
$out[$k] = implode('<br/>', explode(', ', t3lib_BEfunc::getProcessedValue('be_users', 'workspace_perms', $v)));
break;
case 'workspace_membership':
$out[$k] = implode('<br/>', $this->ext_workspaceMembership());
break;
case 'custom_options':
// Explode and flip values:
$nef = array_flip(explode(',', $v));
$pout = array();
// Initialize:
$customOptions = $GLOBALS['TYPO3_CONF_VARS']['BE']['customPermOptions'];
if (is_array($customOptions)) {
foreach ($customOptions as $coKey => $coValue) {
if (is_array($coValue['items'])) {
// Traverse items:
foreach ($coValue['items'] as $itemKey => $itemCfg) {
$v = $coKey . ':' . $itemKey;
if (isset($nef[$v])) {
unset($nef[$v]);
$pout[] = $GLOBALS['LANG']->sl($coValue['header']) . ' / ' . $GLOBALS['LANG']->sl($itemCfg[0]);
}
}
}
}
}
// Add remaining:
if (count($nef)) {
$pout = array_merge($pout, array_keys($nef));
}
// Implode for display:
$out[$k] = implode('<br />', $pout);
break;
}
}
}
return $out;
}
示例7: getRowDetails
/**
* 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)));
}
示例8: renderDBInfo
/**
* 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']));
}
示例9: renderDefaultLanguageDiff
/**
* Renders the diff-view of default language record content compared with what the record was originally translated from.
* Will render content if any is found in the internal array, $this->defaultLanguageData, depending on registerDefaultLanguageData() being called prior to this.
*
* @param string Table name of the record being edited
* @param string Field name represented by $item
* @param array Record array of the record being edited
* @param string HTML of the form field. This is what we add the content to.
* @return string Item string returned again, possibly with the original value added to.
* @see getSingleField(), registerDefaultLanguageData()
*/
function renderDefaultLanguageDiff($table, $field, $row, $item)
{
if (is_array($this->defaultLanguageData_diff[$table . ':' . $row['uid']])) {
// Initialize:
$dLVal = array('old' => $this->defaultLanguageData_diff[$table . ':' . $row['uid']], 'new' => $this->defaultLanguageData[$table . ':' . $row['uid']]);
if (isset($dLVal['old'][$field])) {
// There must be diff-data:
if (strcmp($dLVal['old'][$field], $dLVal['new'][$field])) {
// Create diff-result:
$t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff');
$diffres = $t3lib_diff_Obj->makeDiffDisplay(t3lib_BEfunc::getProcessedValue($table, $field, $dLVal['old'][$field], 0, 1), t3lib_BEfunc::getProcessedValue($table, $field, $dLVal['new'][$field], 0, 1));
$item .= '<div class="typo3-TCEforms-diffBox">' . '<div class="typo3-TCEforms-diffBox-header">' . htmlspecialchars($this->getLL('l_changeInOrig')) . ':</div>' . $diffres . '</div>';
}
}
}
return $item;
}
示例10: dataFields
/**
* Adds content to all data fields in $out array
*
* @param array Array of fields to display. Each field name has a special feature which is that the field name can be specified as more field names. Eg. "field1,field2;field3". Field 2 and 3 will be shown in the same cell of the table separated by <br /> while field1 will have its own cell.
* @param string Table name
* @param array Record array
* @param array Array to which the data is added
* @param [type] $noEdit: ...
* @return array $out array returned after processing.
* @see makeOrdinaryList()
*/
function dataFields($fieldArr, $table, $row, $out = array(), $noEdit = FALSE)
{
global $TCA;
// Check table validity:
if ($TCA[$table]) {
t3lib_div::loadTCA($table);
$thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
$url = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'index.php';
$thumbsize = $this->lTSprop['imageSize'];
// Traverse fields:
foreach ($fieldArr as $fieldName) {
if ($TCA[$table]['columns'][$fieldName]) {
// Each field has its own cell (if configured in TCA)
if ($fieldName == $thumbsCol) {
// If the column is a thumbnail column:
if ($this->thumbs) {
$val = t3lib_BEfunc::thumbCode($row, $table, $fieldName, $this->backPath, $this->thumbScript, NULL, 0, '', $thumbsize);
} else {
$val = str_replace(',', ', ', basename($row[$fieldName]));
}
} else {
// ... otherwise just render the output:
$val = nl2br(htmlspecialchars(trim(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getProcessedValue($table, $fieldName, $row[$fieldName], 0, 0, 0, $row['uid']), 250))));
if ($this->lTSprop['clickTitleMode'] == 'view') {
if ($this->singlePid) {
$val = $this->linkSingleView($url, $val, $row['uid']);
}
} elseif ($this->lTSprop['clickTitleMode'] == 'edit') {
if (!$noEdit) {
$params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
$lTitle = ' title="' . $GLOBALS['LANG']->getLL('edit', 1) . '"';
$val = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath, $this->returnUrl)) . '"' . $lTitle . '>' . $val . '</a>';
}
}
}
$out[$fieldName] = $val;
} else {
// Each field is separated by <br /> and shown in the same cell (If not a TCA field, then explode the field name with ";" and check each value there as a TCA configured field)
$theFields = explode(';', $fieldName);
// Traverse fields, separated by ";" (displayed in a single cell).
foreach ($theFields as $fName2) {
if ($TCA[$table]['columns'][$fName2]) {
$out[$fieldName] .= '<b>' . $GLOBALS['LANG']->sL($TCA[$table]['columns'][$fName2]['label'], 1) . '</b>' . ' ' . htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getProcessedValue($table, $fName2, $row[$fName2], 0, 0, 0, $row['uid']), 25)) . '<br />';
}
}
}
// If no value, add a nbsp.
if (!$out[$fieldName]) {
$out[$fieldName] = ' ';
}
// Wrap in dimmed-span tags if record is "disabled"
if ($this->isDisabled($table, $row)) {
$out[$fieldName] = $GLOBALS['TBE_TEMPLATE']->dfw($out[$fieldName]);
}
}
}
return $out;
}
示例11: calculateChangePercentage
/**
* Calculates the percentage of changes between two records.
*
* @param string $table
* @param array $diffRecordOne
* @param array $diffRecordTwo
* @return integer
*/
public function calculateChangePercentage($table, array $diffRecordOne, array $diffRecordTwo)
{
global $TCA;
// Initialize:
$changePercentage = 0;
$changePercentageArray = array();
// Check that records are arrays:
if (is_array($diffRecordOne) && is_array($diffRecordTwo)) {
// Load full table description
t3lib_div::loadTCA($table);
$similarityPercentage = 0;
// Traversing the first record and process all fields which are editable:
foreach ($diffRecordOne as $fieldName => $fieldValue) {
if ($TCA[$table]['columns'][$fieldName] && $TCA[$table]['columns'][$fieldName]['config']['type'] != 'passthrough' && !t3lib_div::inList('t3ver_label', $fieldName)) {
if (strcmp(trim($diffRecordOne[$fieldName]), trim($diffRecordTwo[$fieldName])) && $TCA[$table]['columns'][$fieldName]['config']['type'] == 'group' && $TCA[$table]['columns'][$fieldName]['config']['internal_type'] == 'file') {
// Initialize:
$uploadFolder = $TCA[$table]['columns'][$fieldName]['config']['uploadfolder'];
$files1 = array_flip(t3lib_div::trimExplode(',', $diffRecordOne[$fieldName], 1));
$files2 = array_flip(t3lib_div::trimExplode(',', $diffRecordTwo[$fieldName], 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:
$diffRecordOne[$fieldName] = implode(' ', $files1);
$diffRecordTwo[$fieldName] = implode(' ', $files2);
}
// If there is a change of value:
if (strcmp(trim($diffRecordOne[$fieldName]), trim($diffRecordTwo[$fieldName]))) {
// Get the best visual presentation of the value to calculate differences:
$val1 = t3lib_BEfunc::getProcessedValue($table, $fieldName, $diffRecordOne[$fieldName], 0, 1);
$val2 = t3lib_BEfunc::getProcessedValue($table, $fieldName, $diffRecordTwo[$fieldName], 0, 1);
similar_text($val1, $val2, $similarityPercentage);
$changePercentageArray[] = $similarityPercentage > 0 ? abs($similarityPercentage - 100) : 0;
}
}
}
// Calculate final change percentage:
if (is_array($changePercentageArray)) {
$sumPctChange = 0;
foreach ($changePercentageArray as $singlePctChange) {
$sumPctChange += $singlePctChange;
}
count($changePercentageArray) > 0 ? $changePercentage = round($sumPctChange / count($changePercentageArray)) : ($changePercentage = 0);
}
}
return $changePercentage;
}
示例12: getTitleStr
function getTitleStr($row, $titleLen = 30)
{
// Generate title proper to label and label_alt
if (!$row['uid']) {
// For root
$title = $row['title'];
} else {
$title = t3lib_BEfunc::getProcessedValue($this->table, $GLOBALS['TCA'][$this->table]['ctrl']['label'], $row[$GLOBALS['TCA'][$this->table]['ctrl']['label']], 0, 0, false, $row['uid']);
if ($GLOBALS['TCA'][$this->table]['ctrl']['label_alt'] and ($GLOBALS['TCA'][$this->table]['ctrl']['label_alt_force'] or !strcmp($title, ''))) {
$altFields = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$this->table]['ctrl']['label_alt'], 1);
$titleAlt = array();
if (!empty($title)) {
$titleAlt[] = $title;
}
foreach ($altFields as $value) {
$title = trim(strip_tags($row[$value]));
if (strcmp($title, '')) {
$title = t3lib_BEfunc::getProcessedValue($this->table, $value, $title, 0, 0, false, $row['uid']);
if (!$GLOBALS['TCA'][$this->table]['ctrl']['label_alt_force']) {
break;
}
$titleAlt[] = $title;
}
}
if ($GLOBALS['TCA'][$this->table]['ctrl']['label_alt_force']) {
$title = implode(', ', $titleAlt);
}
}
}
$title = strlen(trim($title)) == 0 ? '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title', 1) . ']' : htmlspecialchars(t3lib_div::fixed_lgd_cs($title, $titleLen));
return $title;
}
示例13: renderTODisplay
//.........这里部分代码省略.........
$lpXML = $toObj['localprocessing'] ? t3lib_div::formatSize(strlen($toObj['localprocessing'])) . 'bytes' : '';
}
$lpXML .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_tmplobj][' . $toObj['uid'] . ']=edit&columnsOnly=localprocessing', $this->doc->backPath)) . '"><img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' alt="" class="absmiddle" /></a>';
// Compile info table:
$tableAttribs = ' border="0" cellpadding="1" cellspacing="1" width="98%" style="margin-top: 3px;" class="lrPadding"';
// Links:
$editLink = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_tmplobj][' . $toObj['uid'] . ']=edit', $this->doc->backPath)) . '"><img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' alt="" class="absmiddle" /></a>';
$toTitle = '<a href="' . htmlspecialchars($linkUrl) . '">' . htmlspecialchars($toObj['title']) . '</a>';
$fRWTOUres = array();
if (!$children) {
if ($this->MOD_SETTINGS['set_details']) {
$fRWTOUres = $this->findRecordsWhereTOUsed($toObj, $scope);
}
$content .= '
<table' . $tableAttribs . '>
<tr class="bgColor4-20">
<td colspan="3">' . $recordIcon . $toTitle . $editLink . '</td>
</tr>
<tr class="bgColor4">
<td rowspan="' . ($this->MOD_SETTINGS['set_details'] ? 7 : 4) . '" style="width: 100px; text-align: center;">' . $icon . '</td>
<td>File reference:</td>
<td>' . $fileRef . $fileMsg . '</td>
</tr>
<tr class="bgColor4">
<td>Description:</td>
<td>' . htmlspecialchars($toObj['description']) . '</td>
</tr>
<tr class="bgColor4">
<td>Mapping status:</td>
<td>' . $mappingStatus . '</td>
</tr>
<tr class="bgColor4">
<td>Local Processing:</td>
<td>' . $lpXML . '</td>
</tr>' . ($this->MOD_SETTINGS['set_details'] ? '
<tr class="bgColor4">
<td>Used by:</td>
<td>' . $fRWTOUres['HTML'] . '</td>
</tr>
<tr class="bgColor4">
<td>Created:</td>
<td>' . t3lib_BEfunc::datetime($toObj['crdate']) . ' by user [' . $toObj['cruser_id'] . ']</td>
</tr>
<tr class="bgColor4">
<td>Updated:</td>
<td>' . t3lib_BEfunc::datetime($toObj['tstamp']) . '</td>
</tr>' : '') . '
</table>
';
} else {
$content .= '
<table' . $tableAttribs . '>
<tr class="bgColor4-20">
<td colspan="3">' . $recordIcon . $toTitle . $editLink . '</td>
</tr>
<tr class="bgColor4">
<td>File reference:</td>
<td>' . $fileRef . $fileMsg . '</td>
</tr>
<tr class="bgColor4">
<td>Mapping status:</td>
<td>' . $mappingStatus . '</td>
</tr>
<tr class="bgColor4">
<td>Render Type:</td>
<td>' . t3lib_BEfunc::getProcessedValue('tx_templavoila_tmplobj', 'rendertype', $toObj['rendertype']) . '</td>
</tr>
<tr class="bgColor4">
<td>Language:</td>
<td>' . t3lib_BEfunc::getProcessedValue('tx_templavoila_tmplobj', 'sys_language_uid', $toObj['sys_language_uid']) . '</td>
</tr>
<tr class="bgColor4">
<td>Local Processing:</td>
<td>' . $lpXML . '</td>
</tr>' . ($this->MOD_SETTINGS['set_details'] ? '
<tr class="bgColor4">
<td>Created:</td>
<td>' . t3lib_BEfunc::datetime($toObj['crdate']) . ' by user [' . $toObj['cruser_id'] . ']</td>
</tr>
<tr class="bgColor4">
<td>Updated:</td>
<td>' . t3lib_BEfunc::datetime($toObj['tstamp']) . '</td>
</tr>' : '') . '
</table>
';
}
// Traverse template objects which are not children of anything:
if (!$children && is_array($toRecords[$toObj['uid']])) {
$TOchildrenContent = '';
foreach ($toRecords[$toObj['uid']] as $toIndex => $childToObj) {
$rTODres = $this->renderTODisplay($childToObj, $toRecords, $scope, 1);
$TOchildrenContent .= $rTODres['HTML'];
// Unset it so we can eventually see what is left:
unset($toRecords[$toObj['uid']][$toIndex]);
}
$content .= '<div style="margin-left: 102px;">' . $TOchildrenContent . '</div>';
}
// Return content
return array('HTML' => $content, 'mappingStatus' => $mappingStatus_index, 'usage' => $fRWTOUres['usage']);
}