本文整理汇总了PHP中t3lib_BEfunc::workspaceOL方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_BEfunc::workspaceOL方法的具体用法?PHP t3lib_BEfunc::workspaceOL怎么用?PHP t3lib_BEfunc::workspaceOL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_BEfunc
的用法示例。
在下文中一共展示了t3lib_BEfunc::workspaceOL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContentTree_getLocalizationInfoForElement
/**
* Returns information about localization of traditional content elements (non FCEs).
* It will be added to the content tree by getContentTree().
*
* @param array $contentTreeArr: Part of the content tree of the element to create the localization information for.
* @param array $tt_content_elementRegister: Array of sys_language UIDs with some information as the value
* @return array Localization information
* @access protected
* @see getContentTree_element()
*/
function getContentTree_getLocalizationInfoForElement($contentTreeArr, &$tt_content_elementRegister)
{
global $TYPO3_DB;
$localizationInfoArr = array();
if ($contentTreeArr['el']['table'] == 'tt_content' && $contentTreeArr['el']['sys_language_uid'] <= 0) {
// Finding translations of this record and select overlay record:
$fakeElementRow = array('uid' => $contentTreeArr['el']['uid'], 'pid' => $contentTreeArr['el']['pid']);
t3lib_beFunc::fixVersioningPID('tt_content', $fakeElementRow);
$res = $TYPO3_DB->exec_SELECTquery('*', 'tt_content', 'pid=' . $fakeElementRow['pid'] . ' AND sys_language_uid>0' . ' AND l18n_parent=' . intval($contentTreeArr['el']['uid']) . t3lib_BEfunc::deleteClause('tt_content'));
$attachedLocalizations = array();
while (TRUE == ($olrow = $TYPO3_DB->sql_fetch_assoc($res))) {
t3lib_BEfunc::workspaceOL('tt_content', $olrow);
if (!isset($attachedLocalizations[$olrow['sys_language_uid']])) {
$attachedLocalizations[$olrow['sys_language_uid']] = $olrow['uid'];
}
}
$TYPO3_DB->sql_free_result($res);
// Traverse the available languages of the page (not default and [All])
if (is_array($this->allSystemWebsiteLanguages) && is_array($this->allSystemWebsiteLanguages['rows'])) {
foreach (array_keys($this->allSystemWebsiteLanguages['rows']) as $sys_language_uid) {
if ($sys_language_uid > 0) {
if (isset($attachedLocalizations[$sys_language_uid])) {
$localizationInfoArr[$sys_language_uid] = array();
$localizationInfoArr[$sys_language_uid]['mode'] = 'exists';
$localizationInfoArr[$sys_language_uid]['localization_uid'] = $attachedLocalizations[$sys_language_uid];
$tt_content_elementRegister[$attachedLocalizations[$sys_language_uid]]++;
} elseif ($contentTreeArr['el']['CType'] != 'templavoila_pi1') {
// Only localize content elements with "Default" langauge set
if ((int) $contentTreeArr['el']['sys_language_uid'] === 0) {
$localizationInfoArr[$sys_language_uid] = array();
$localizationInfoArr[$sys_language_uid]['mode'] = 'localize';
}
} elseif (!$contentTreeArr['ds_meta']['langDisable'] && ((int) $contentTreeArr['el']['sys_language_uid'] === -1 || (int) $contentTreeArr['el']['sys_language_uid'] === 0)) {
$localizationInfoArr[$sys_language_uid] = array();
$localizationInfoArr[$sys_language_uid]['mode'] = 'localizedFlexform';
} else {
$localizationInfoArr[$sys_language_uid] = array();
$localizationInfoArr[$sys_language_uid]['mode'] = 'no_localization';
}
}
}
}
}
return $localizationInfoArr;
}
示例2: main
/**
* Main function creating the content for the module.
*
* @return string HTML content for the module, actually a "section" made through the parent object in $this->pObj
*/
function main()
{
global $SOBE, $LANG;
$theCode = '';
$this->tsConfig = t3lib_BEfunc::getPagesTSconfig($this->pObj->id);
$this->pagesTsConfig = isset($this->tsConfig['TCEFORM.']['pages.']) ? $this->tsConfig['TCEFORM.']['pages.'] : array();
// Create loremIpsum code:
if (t3lib_extMgm::isLoaded('lorem_ipsum')) {
$this->loremIpsumObject = t3lib_div::getUserObj('EXT:lorem_ipsum/class.tx_loremipsum_wiz.php:tx_loremipsum_wiz');
}
$m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(8);
// create new pages here?
$pRec = t3lib_BEfunc::getRecord('pages', $this->pObj->id, 'uid', ' AND ' . $m_perms_clause);
$sys_pages = t3lib_div::makeInstance('t3lib_pageSelect');
$menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
if (is_array($pRec)) {
$data = t3lib_div::_GP('data');
if (is_array($data['pages'])) {
if (t3lib_div::_GP('createInListEnd')) {
$endI = end($menuItems);
$thePid = -intval($endI['uid']);
if (!$thePid) {
$thePid = $this->pObj->id;
}
} else {
$thePid = $this->pObj->id;
}
$firstRecord = true;
$previousIdentifier = '';
foreach ($data['pages'] as $identifier => $dat) {
if (!trim($dat['title'])) {
unset($data['pages'][$identifier]);
} else {
$data['pages'][$identifier]['hidden'] = t3lib_div::_GP('hidePages') ? 1 : 0;
if ($firstRecord) {
$firstRecord = false;
$data['pages'][$identifier]['pid'] = $thePid;
} else {
$data['pages'][$identifier]['pid'] = '-' . $previousIdentifier;
}
$previousIdentifier = $identifier;
}
}
if (count($data['pages'])) {
reset($data);
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$tce->stripslashes_values = 0;
// set default TCA values specific for the user
$TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
if (is_array($TCAdefaultOverride)) {
$tce->setDefaultsFromUserTS($TCAdefaultOverride);
}
$tce->start($data, array());
$tce->process_datamap();
t3lib_BEfunc::setUpdateSignal('updatePageTree');
$flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_create'));
} else {
$flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_noCreate'), t3lib_FlashMessage::ERROR);
}
$theCode .= $flashMessage->render();
// Display result:
$menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
$lines = array();
foreach ($menuItems as $rec) {
t3lib_BEfunc::workspaceOL('pages', $rec);
if (is_array($rec)) {
$lines[] = '<nobr>' . t3lib_iconWorks::getSpriteIconForRecord('pages', $rec, array('title' => t3lib_BEfunc::titleAttribForPages($rec, '', FALSE))) . htmlspecialchars(t3lib_div::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</nobr>';
}
}
$theCode .= '<h4>' . $LANG->getLL('wiz_newPages_currentMenu') . '</h4>' . implode('<br />', $lines);
} else {
// Display create form
$lines = array();
for ($a = 0; $a < 9; $a++) {
$lines[] = $this->getFormLine($a);
}
$theCode .= '<h4>' . $LANG->getLL('wiz_newPages') . ':</h4>' . '<div id="formFieldContainer">' . implode('', $lines) . '</div>' . '<br class="clearLeft" />' . '<input type="button" id="createNewFormFields" value="' . $LANG->getLL('wiz_newPages_addMoreLines') . '" />' . '<br /><br />
<input type="checkbox" name="createInListEnd" id="createInListEnd" value="1" /> <label for="createInListEnd">' . $LANG->getLL('wiz_newPages_listEnd') . '</label><br />
<input type="checkbox" name="hidePages" id="hidePages" value="1" /> <label for="hidePages">' . $LANG->getLL('wiz_newPages_hidePages') . '</label><br /><br />
<input type="submit" name="create" value="' . $LANG->getLL('wiz_newPages_lCreate') . '" onclick="return confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('wiz_newPages_lCreate_msg1')) . ')" /> <input type="reset" value="' . $LANG->getLL('wiz_newPages_lReset') . '" /><br />';
// Add ExtJS inline code
$extCode = '
var tpl = "' . addslashes(str_replace(array(LF, TAB), array('', ''), $this->getFormLine('#'))) . '", i, line, div, bg, label;
var lineCounter = 9;
Ext.get("createNewFormFields").on("click", function() {
div = Ext.get("formFieldContainer");
for (i = 0; i < 5; i++) {
label = lineCounter + i + 1;
bg = label % 2 === 0 ? 6 : 4;
line = String.format(tpl, (lineCounter + i), label, bg);
div.insertHtml("beforeEnd", line);
}
lineCounter += 5;
});
';
//.........这里部分代码省略.........
示例3: versionOL
/**
* Creating versioning overlay of a sys_template record. This will use either frontend or backend overlay functionality depending on environment.
*
* @param array Row to overlay.
* @return void Row is passed by reference.
*/
function versionOL(&$row)
{
if (is_object($GLOBALS['TSFE'])) {
// Frontend:
$GLOBALS['TSFE']->sys_page->versionOL('sys_template', $row);
} else {
// Backend:
t3lib_BEfunc::workspaceOL('sys_template', $row);
}
}
示例4: getAvailableLanguages
/**
* Returns an array of available languages (to use for FlexForms)
*
* @param integer $id: If zero, the query will select all sys_language records from root level. If set to another value, the query will select all sys_language records that has a pages_language_overlay record on that page (and is not hidden, unless you are admin user)
* @param boolean $onlyIsoCoded: If set, only languages which are paired with a static_info_table / static_language record will be returned.
* @param boolean $setDefault: If set, an array entry for a default language is set.
* @param boolean $setMulti: If set, an array entry for "multiple languages" is added (uid -1)
* @return array
* @access protected
*/
function getAvailableLanguages($id = 0, $onlyIsoCoded = true, $setDefault = true, $setMulti = false)
{
global $LANG, $TYPO3_DB, $BE_USER, $TCA, $BACK_PATH;
t3lib_div::loadTCA('sys_language');
$output = array();
$excludeHidden = $BE_USER->isAdmin() ? '1=1' : 'sys_language.hidden=0';
if ($id) {
$excludeHidden .= ' AND pages_language_overlay.deleted=0';
$res = $TYPO3_DB->exec_SELECTquery('DISTINCT sys_language.*, pages_language_overlay.hidden as PLO_hidden, pages_language_overlay.title as PLO_title', 'pages_language_overlay,sys_language', 'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid=' . intval($id) . ' AND ' . $excludeHidden, '', 'sys_language.title');
} else {
$res = $TYPO3_DB->exec_SELECTquery('sys_language.*', 'sys_language', $excludeHidden, '', 'sys_language.title');
}
if ($setDefault) {
$output[0] = array('uid' => 0, 'title' => strlen($this->modSharedTSconfig['properties']['defaultLanguageLabel']) ? $this->modSharedTSconfig['properties']['defaultLanguageLabel'] : $LANG->getLL('defaultLanguage'), 'ISOcode' => 'DEF', 'flagIcon' => strlen($this->modSharedTSconfig['properties']['defaultLanguageFlag']) ? $this->modSharedTSconfig['properties']['defaultLanguageFlag'] : null);
}
if ($setMulti) {
$output[-1] = array('uid' => -1, 'title' => $LANG->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => 'multiple');
}
while (TRUE == ($row = $TYPO3_DB->sql_fetch_assoc($res))) {
t3lib_BEfunc::workspaceOL('sys_language', $row);
if ($id) {
$table = 'pages_language_overlay';
$enableFields = t3lib_BEfunc::BEenableFields($table);
if (trim($enableFields) == 'AND') {
$enableFields = '';
}
$enableFields .= t3lib_BEfunc::deleteClause($table);
// Selecting overlay record:
$resP = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages_language_overlay', 'pid=' . intval($id) . '
AND sys_language_uid=' . intval($row['uid']), '', '', '1');
$pageRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resP);
$GLOBALS['TYPO3_DB']->sql_free_result($resP);
t3lib_BEfunc::workspaceOL('pages_language_overlay', $pageRow);
$row['PLO_hidden'] = $pageRow['hidden'];
$row['PLO_title'] = $pageRow['title'];
}
$output[$row['uid']] = $row;
if ($row['static_lang_isocode']) {
$staticLangRow = t3lib_BEfunc::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2');
if ($staticLangRow['lg_iso_2']) {
$output[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
}
}
if (strlen($row['flag'])) {
$output[$row['uid']]['flagIcon'] = $row['flag'];
}
if ($onlyIsoCoded && !$output[$row['uid']]['ISOcode']) {
unset($output[$row['uid']]);
}
$disableLanguages = t3lib_div::trimExplode(',', $this->modSharedTSconfig['properties']['disableLanguages'], 1);
foreach ($disableLanguages as $language) {
// $language is the uid of a sys_language
unset($output[$language]);
}
}
return $output;
}
示例5: getRecordProperties
/**
* Returns an array with record properties, like header and pid
* No check for deleted or access is done!
* For versionized records, pid is resolved to its live versions pid.
* Used for loggin
*
* @param string Table name
* @param integer Uid of record
* @param boolean If set, no workspace overlay is performed
* @return array Properties of record
*/
function getRecordProperties($table, $id, $noWSOL = FALSE)
{
$row = $table == 'pages' && !$id ? array('title' => '[root-level]', 'uid' => 0, 'pid' => 0) : $this->recordInfo($table, $id, '*');
if (!$noWSOL) {
t3lib_BEfunc::workspaceOL($table, $row);
}
return $this->getRecordPropertiesFromRow($table, $row);
}
示例6: singleRecordLines
/**
* Add entries for a single record
*
* @param string Table name
* @param integer Record uid
* @param array Output lines array (is passed by reference and modified)
* @param string Pre-HTML code
* @param boolean If you want import validation, you can set this so it checks if the import can take place on the specified page.
* @return void
*/
function singleRecordLines($table, $uid, &$lines, $preCode, $checkImportInPidRecord = 0)
{
global $TCA, $BE_USER, $LANG;
// Get record:
$record = $this->dat['header']['records'][$table][$uid];
unset($this->remainHeader['records'][$table][$uid]);
if (!is_array($record) && !($table === 'pages' && !$uid)) {
$this->error('MISSING RECORD: ' . $table . ':' . $uid, 1);
}
// Begin to create the line arrays information record, pInfo:
$pInfo = array();
$pInfo['ref'] = $table . ':' . $uid;
if ($table === '_SOFTREF_') {
// Unknown table name:
$pInfo['preCode'] = $preCode;
$pInfo['title'] = '<em>' . $LANG->getLL('impexpcore_singlereco_softReferencesFiles', 1) . '</em>';
} elseif (!isset($TCA[$table])) {
// Unknown table name:
$pInfo['preCode'] = $preCode;
$pInfo['msg'] = "UNKNOWN TABLE '" . $pInfo['ref'] . "'";
$pInfo['title'] = '<em>' . htmlspecialchars($record['title']) . '</em>';
} else {
// Otherwise, set table icon and title.
// Import Validation (triggered by $this->display_import_pid_record) will show messages if import is not possible of various items.
if (is_array($this->display_import_pid_record)) {
if ($checkImportInPidRecord) {
if (!$BE_USER->doesUserHaveAccess($this->display_import_pid_record, $table == 'pages' ? 8 : 16)) {
$pInfo['msg'] .= "'" . $pInfo['ref'] . "' cannot be INSERTED on this page! ";
}
if (!$this->checkDokType($table, $this->display_import_pid_record['doktype']) && !$TCA[$table]['ctrl']['rootLevel']) {
$pInfo['msg'] .= "'" . $table . "' cannot be INSERTED on this page type (change page type to 'Folder'.) ";
}
}
if (!$BE_USER->check('tables_modify', $table)) {
$pInfo['msg'] .= "You are not allowed to CREATE '" . $table . "' tables! ";
}
if ($TCA[$table]['ctrl']['readOnly']) {
$pInfo['msg'] .= "TABLE '" . $table . "' is READ ONLY! ";
}
if ($TCA[$table]['ctrl']['adminOnly'] && !$BE_USER->isAdmin()) {
$pInfo['msg'] .= "TABLE '" . $table . "' is ADMIN ONLY! ";
}
if ($TCA[$table]['ctrl']['is_static']) {
$pInfo['msg'] .= "TABLE '" . $table . "' is a STATIC TABLE! ";
}
if ($TCA[$table]['ctrl']['rootLevel']) {
$pInfo['msg'] .= "TABLE '" . $table . "' will be inserted on ROOT LEVEL! ";
}
$diffInverse = FALSE;
if ($this->update) {
$diffInverse = TRUE;
// In case of update-PREVIEW we swap the diff-sources.
$recInf = $this->doesRecordExist($table, $uid, $this->showDiff ? '*' : '');
$pInfo['updatePath'] = $recInf ? htmlspecialchars($this->getRecordPath($recInf['pid'])) : '<strong>NEW!</strong>';
// Mode selector:
$optValues = array();
$optValues[] = $recInf ? $LANG->getLL('impexpcore_singlereco_update') : $LANG->getLL('impexpcore_singlereco_insert');
if ($recInf) {
$optValues['as_new'] = $LANG->getLL('impexpcore_singlereco_importAsNew');
}
if ($recInf) {
if (!$this->global_ignore_pid) {
$optValues['ignore_pid'] = $LANG->getLL('impexpcore_singlereco_ignorePid');
} else {
$optValues['respect_pid'] = $LANG->getLL('impexpcore_singlereco_respectPid');
}
}
if (!$recInf && $GLOBALS['BE_USER']->isAdmin()) {
$optValues['force_uid'] = sprintf($LANG->getLL('impexpcore_singlereco_forceUidSAdmin'), $uid);
}
$optValues['exclude'] = $LANG->getLL('impexpcore_singlereco_exclude');
$pInfo['updateMode'] = $this->renderSelectBox('tx_impexp[import_mode][' . $table . ':' . $uid . ']', $this->import_mode[$table . ':' . $uid], $optValues);
}
// Diff vieiw:
if ($this->showDiff) {
// For IMPORTS, get new id:
if ($newUid = $this->import_mapId[$table][$uid]) {
$diffInverse = FALSE;
$recInf = $this->doesRecordExist($table, $newUid, '*');
t3lib_BEfunc::workspaceOL($table, $recInf);
}
if (is_array($recInf)) {
$pInfo['showDiffContent'] = $this->compareRecords($recInf, $this->dat['records'][$table . ':' . $uid]['data'], $table, $diffInverse);
}
}
}
$pInfo['preCode'] = $preCode . t3lib_iconworks::getSpriteIconForRecord($table, (array) $this->dat['records'][$table . ':' . $uid]['data'], array('title' => htmlspecialchars($table . ':' . $uid)));
$pInfo['title'] = htmlspecialchars($record['title']);
// View page:
if ($table === 'pages') {
//.........这里部分代码省略.........
示例7: _calculateInternalAccumulatedInformationsArray
/** set internal _accumulatedInformations array. Is called from constructor and uses the given tree, lang and l10ncfg
* @return void
**/
function _calculateInternalAccumulatedInformationsArray()
{
global $TCA;
$tree = $this->tree;
$l10ncfg = $this->l10ncfg;
$accum = array();
$sysLang = $this->sysLang;
// FlexForm Diff data:
$flexFormDiff = unserialize($l10ncfg['flexformdiff']);
$flexFormDiff = $flexFormDiff[$sysLang];
$excludeIndex = array_flip(t3lib_div::trimExplode(',', $l10ncfg['exclude'], 1));
$tableUidConstraintIndex = array_flip(t3lib_div::trimExplode(',', $l10ncfg['tableUidConstraint'], 1));
// Init:
$t8Tools = t3lib_div::makeInstance('tx_l10nmgr_tools');
$t8Tools->verbose = FALSE;
// Otherwise it will show records which has fields but none editable.
if ($l10ncfg['incfcewithdefaultlanguage'] == 1) {
$t8Tools->includeFceWithDefaultLanguage = TRUE;
}
// Set preview language (only first one in list is supported):
if ($this->forcedPreviewLanguage != '') {
$previewLanguage = $this->forcedPreviewLanguage;
} else {
$previewLanguage = current(t3lib_div::intExplode(',', $GLOBALS['BE_USER']->getTSConfigVal('options.additionalPreviewLanguages')));
}
if ($previewLanguage) {
$t8Tools->previewLanguages = array($previewLanguage);
}
// Traverse tree elements:
foreach ($tree->tree as $treeElement) {
$pageId = $treeElement['row']['uid'];
if (!isset($excludeIndex['pages:' . $pageId]) && !in_array($treeElement['row']['doktype'], $this->disallowDoktypes)) {
$accum[$pageId]['header']['title'] = $treeElement['row']['title'];
$accum[$pageId]['header']['icon'] = $treeElement['HTML'];
$accum[$pageId]['header']['prevLang'] = $previewLanguage;
$accum[$pageId]['items'] = array();
// Traverse tables:
foreach ($TCA as $table => $cfg) {
// Only those tables we want to work on:
if (t3lib_div::inList($l10ncfg['tablelist'], $table)) {
if ($table === 'pages') {
$accum[$pageId]['items'][$table][$pageId] = $t8Tools->translationDetails('pages', t3lib_BEfunc::getRecordWSOL('pages', $pageId), $sysLang, $flexFormDiff);
$this->_increaseInternalCounters($accum[$pageId]['items'][$table][$pageId]['fields']);
} else {
$allRows = $t8Tools->getRecordsToTranslateFromTable($table, $pageId);
if (is_array($allRows)) {
if (count($allRows)) {
// Now, for each record, look for localization:
foreach ($allRows as $row) {
t3lib_BEfunc::workspaceOL($table, $row);
if (is_array($row) && count($tableUidConstraintIndex) > 0) {
if (is_array($row) && isset($tableUidConstraintIndex[$table . ':' . $row['uid']])) {
$accum[$pageId]['items'][$table][$row['uid']] = $t8Tools->translationDetails($table, $row, $sysLang, $flexFormDiff);
$this->_increaseInternalCounters($accum[$pageId]['items'][$table][$row['uid']]['fields']);
}
} else {
if (is_array($row) && !isset($excludeIndex[$table . ':' . $row['uid']])) {
$accum[$pageId]['items'][$table][$row['uid']] = $t8Tools->translationDetails($table, $row, $sysLang, $flexFormDiff);
$this->_increaseInternalCounters($accum[$pageId]['items'][$table][$row['uid']]['fields']);
}
}
}
}
}
}
}
}
}
}
$includeIndex = array_unique(t3lib_div::trimExplode(',', $l10ncfg['include'], 1));
foreach ($includeIndex as $recId) {
list($table, $uid) = explode(':', $recId);
$row = t3lib_BEfunc::getRecordWSOL($table, $uid);
if (count($row)) {
$accum[-1]['items'][$table][$row['uid']] = $t8Tools->translationDetails($table, $row, $sysLang, $flexFormDiff);
$this->_increaseInternalCounters($accum[-1]['items'][$table][$row['uid']]['fields']);
}
}
# debug($accum);
$this->_accumulatedInformations = $accum;
}
开发者ID:rafu1987,项目名称:t3bootstrap-project,代码行数:84,代码来源:class.tx_l10nmgr_l10nAccumulatedInformations.php
示例8: getResult
/**
* Traverse the result pointer given, adding each record to array and setting some internal values at the same time.
*
* @param pointer SQL result pointer for select query.
* @param string Table name defaulting to tt_content
* @return array The selected rows returned in this array.
*/
function getResult($result, $table = 'tt_content')
{
// Initialize:
$editUidList = '';
$recs = array();
$nextTree = $this->nextThree;
$c = 0;
$output = array();
// Traverse the result:
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
t3lib_BEfunc::workspaceOL($table, $row, -99, TRUE);
if ($row) {
// Add the row to the array:
$output[] = $row;
// Set an internal register:
$recs[$c] = $row['uid'];
// Create the list of the next three ids (for editing links...)
for ($a = 0; $a < $nextTree; $a++) {
if (isset($recs[$c - $a])) {
$this->tt_contentData['nextThree'][$recs[$c - $a]] .= $row['uid'] . ',';
}
}
// Set next/previous ids:
if (isset($recs[$c - 1])) {
if (isset($recs[$c - 2])) {
$this->tt_contentData['prev'][$row['uid']] = -$recs[$c - 2];
} else {
$this->tt_contentData['prev'][$row['uid']] = $row['pid'];
}
$this->tt_contentData['next'][$recs[$c - 1]] = -$row['uid'];
}
$c++;
}
}
// Return selected records
return $output;
}
示例9: makeOrdinaryList
/**
* Creates a standard list of elements from a table.
*
* @param string Table name
* @param integer Page id.
* @param string Comma list of fields to display
* @param boolean If true, icon is shown
* @param string Additional WHERE-clauses.
* @return string HTML table
*/
function makeOrdinaryList($table, $id, $fList, $icon = 0, $addWhere = '')
{
// Initialize:
$out = '';
$queryParts = $this->makeQueryArray($table, $id, $addWhere);
$this->setTotalItems($queryParts);
// $dbCount = 0;
$this->eCounter = 0;
// Make query for records if there were any records found in the count operation:
if ($this->totalItems) {
$result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
// $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
}
// If records were found, render the list:
if ($this->totalItems) {
// Set fields
$this->fieldArray = explode(',', $fList);
// Header line is drawn
$theData = array();
$theData = $this->headerFields($this->fieldArray, $table, $theData);
if ($this->doEdit) {
$newRecIcon = $this->getNewRecordButton($table);
}
$out .= $this->addelement(1, $newRecIcon, $theData, ' class="c-headLineTable"');
$checkCategories = false;
if (count($this->includeCats) || count($this->excludeCats)) {
$checkCategories = true;
}
// Render Items
$this->eCounter = $this->firstElementNumber;
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
t3lib_BEfunc::workspaceOL($table, $row);
if (is_array($row)) {
// list($flag,$code) = $this->fwd_rwd_nav();
// $out.= $code;
if (1) {
$Nrow = array();
$NrowIcon = '';
$noEdit = $this->checkRecordPerms($row, $checkCategories);
// Setting icons/edit links:
if ($icon) {
$NrowIcon = $this->getIcon($table, $row, $noEdit);
}
if (!$noEdit) {
$params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
$NrowIcon .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath, $this->returnUrl)) . '">' . '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' title="' . $GLOBALS['LANG']->getLL('edit', 1) . '" alt="" />' . '</a>';
} else {
$NrowIcon .= $this->noEditIcon($noEdit);
}
// Get values:
$Nrow = $this->dataFields($this->fieldArray, $table, $row, $Nrow, $noEdit);
$tdparams = $this->eCounter % 2 ? ' class="bgColor4"' : ' class="bgColor4-20"';
$out .= $this->addelement(1, $NrowIcon, $Nrow, $tdparams);
}
$this->eCounter++;
}
}
// Wrap it all in a table:
$out = '
<table border="0" cellpadding="1" cellspacing="1" class="typo3-dblist">
' . $out . '
</table>';
// Record navigation is added to the beginning and end of the table if in single table mode
if ($table) {
$pageNavigation = $this->renderListNavigation();
$out = $pageNavigation . $out . $pageNavigation;
}
}
return $out;
}
示例10: getContextIndependentWorkspaceOverlay
/**
* This method returns an overlay of a record, independent from
* a frontend or backend context
*
* @param string $table
* @param string $olrow
* @return array
*/
protected function getContextIndependentWorkspaceOverlay($table, $olrow)
{
if (is_object($GLOBALS['TSFE']->sys_page)) {
$GLOBALS['TSFE']->sys_page->versionOL($table, $olrow);
} else {
t3lib_BEfunc::workspaceOL($table, $olrow);
}
return $olrow;
}
示例11: getLangStatus
/**
* Get an alternative language record for a specific page / language
*
* @param integer Page ID to look up for.
* @param integer Language UID to select for.
* @return array pages_languages_overlay record
*/
function getLangStatus($pageId, $langId)
{
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages_language_overlay', 'pid=' . intval($pageId) . ' AND sys_language_uid=' . intval($langId) . t3lib_BEfunc::deleteClause('pages_language_overlay') . t3lib_BEfunc::versioningPlaceholderClause('pages_language_overlay'));
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
t3lib_BEfunc::workspaceOL('pages_language_overlay', $row);
if (is_array($row)) {
$row['_COUNT'] = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
$row['_HIDDEN'] = $row['hidden'] || intval($row['endtime']) > 0 && intval($row['endtime']) < $GLOBALS['EXEC_TIME'] || $GLOBALS['EXEC_TIME'] < intval($row['starttime']);
}
return $row;
}
示例12: handlePageEditing
/**
* Checking if the "&edit" variable was sent so we can open it for editing the page.
* Code based on code from "alt_shortcut.php"
*
* @return void
*/
protected function handlePageEditing()
{
if (!t3lib_extMgm::isLoaded('cms')) {
return;
}
// EDIT page:
$editId = preg_replace('/[^[:alnum:]_]/', '', t3lib_div::_GET('edit'));
$editRecord = '';
if ($editId) {
// Looking up the page to edit, checking permissions:
$where = ' AND (' . $GLOBALS['BE_USER']->getPagePermsClause(2) . ' OR ' . $GLOBALS['BE_USER']->getPagePermsClause(16) . ')';
if (t3lib_div::testInt($editId)) {
$editRecord = t3lib_BEfunc::getRecordWSOL('pages', $editId, '*', $where);
} else {
$records = t3lib_BEfunc::getRecordsByField('pages', 'alias', $editId, $where);
if (is_array($records)) {
reset($records);
$editRecord = current($records);
t3lib_BEfunc::workspaceOL('pages', $editRecord);
}
}
// If the page was accessible, then let the user edit it.
if (is_array($editRecord) && $GLOBALS['BE_USER']->isInWebMount($editRecord['uid'])) {
// Setting JS code to open editing:
$this->js .= '
// Load page to edit:
window.setTimeout("top.loadEditId(' . intval($editRecord['uid']) . ');", 500);
';
// "Shortcuts" have been renamed to "Bookmarks"
// @deprecated remove shortcuts code in TYPO3 4.7
$shortcutSetPageTree = $GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree');
$bookmarkSetPageTree = $GLOBALS['BE_USER']->getTSConfigVal('options.bookmark_onEditId_dontSetPageTree');
if ($shortcutSetPageTree !== '') {
t3lib_div::deprecationLog('options.shortcut_onEditId_dontSetPageTree - since TYPO3 4.5, will be removed in TYPO3 4.7 - use options.bookmark_onEditId_dontSetPageTree instead');
}
// Checking page edit parameter:
if (!$shortcutSetPageTree && !$bookmarkSetPageTree) {
$shortcutKeepExpanded = $GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded');
$bookmarkKeepExpanded = $GLOBALS['BE_USER']->getTSConfigVal('options.bookmark_onEditId_keepExistingExpanded');
$keepExpanded = $shortcutKeepExpanded || $bookmarkKeepExpanded;
// Expanding page tree:
t3lib_BEfunc::openPageTree(intval($editRecord['pid']), !$keepExpanded);
if ($shortcutKeepExpanded) {
t3lib_div::deprecationLog('options.shortcut_onEditId_keepExistingExpanded - since TYPO3 4.5, will be removed in TYPO3 4.7 - use options.bookmark_onEditId_keepExistingExpanded instead');
}
}
} else {
$this->js .= '
// Warning about page editing:
alert(' . $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('noEditPage'), $editId)) . ');
';
}
}
}
示例13: renderQuickEdit
/**
* Rendering the quick-edit view.
*
* @return void
*/
function renderQuickEdit()
{
global $LANG, $BE_USER, $BACK_PATH;
// Alternative template
$this->doc->setModuleTemplate('templates/db_layout_quickedit.html');
// Alternative form tag; Quick Edit submits its content to tce_db.php.
$this->doc->form = '<form action="' . htmlspecialchars($BACK_PATH . 'tce_db.php?&prErr=1&uPT=1') . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
// Setting up the context sensitive menu:
$this->doc->getContextMenuCode();
// Set the edit_record value for internal use in this function:
$edit_record = $this->edit_record;
// If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php:
if (substr($edit_record, 0, 9) == '_EDIT_COL') {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND colPos=' . intval(substr($edit_record, 10)) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')) . t3lib_BEfunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'sorting');
$idListA = array();
while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$idListA[] = $cRow['uid'];
}
$url = $BACK_PATH . 'alt_doc.php?edit[tt_content][' . implode(',', $idListA) . ']=edit&returnUrl=' . rawurlencode($this->local_linkThisScript(array('edit_record' => '')));
t3lib_utility_Http::redirect($url);
}
// If the former record edited was the creation of a NEW record, this will look up the created records uid:
if ($this->new_unique_uid) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'userid=' . intval($BE_USER->user['uid']) . ' AND NEWid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid, 'sys_log'));
$sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
if (is_array($sys_log_row)) {
$edit_record = $sys_log_row['tablename'] . ':' . $sys_log_row['recuid'];
}
}
// Creating the selector box, allowing the user to select which element to edit:
$opt = array();
$is_selected = 0;
$languageOverlayRecord = '';
if ($this->current_sys_language) {
list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $this->id, 'AND sys_language_uid=' . intval($this->current_sys_language));
}
if (is_array($languageOverlayRecord)) {
$inValue = 'pages_language_overlay:' . $languageOverlayRecord['uid'];
$is_selected += intval($edit_record == $inValue);
$opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $LANG->getLL('editLanguageHeader', 1) . ' ]</option>';
} else {
$inValue = 'pages:' . $this->id;
$is_selected += intval($edit_record == $inValue);
$opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $LANG->getLL('editPageProperties', 1) . ' ]</option>';
}
// Selecting all content elements from this language and allowed colPos:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ' AND colPos IN (' . $this->colPosList . ')' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')) . t3lib_Befunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'colPos,sorting');
$colPos = '';
$first = 1;
$prev = $this->id;
// Page is the pid if no record to put this after.
while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
t3lib_BEfunc::workspaceOL('tt_content', $cRow);
if (is_array($cRow)) {
if ($first) {
if (!$edit_record) {
$edit_record = 'tt_content:' . $cRow['uid'];
}
$first = 0;
}
if (strcmp($cRow['colPos'], $colPos)) {
$colPos = $cRow['colPos'];
$opt[] = '<option value=""></option>';
$opt[] = '<option value="_EDIT_COL:' . $colPos . '">__' . $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'colPos', $colPos), 1) . ':__</option>';
}
$inValue = 'tt_content:' . $cRow['uid'];
$is_selected += intval($edit_record == $inValue);
$opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>' . htmlspecialchars(t3lib_div::fixed_lgd_cs($cRow['header'] ? $cRow['header'] : '[' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.no_title') . '] ' . strip_tags($cRow['bodytext']), $BE_USER->uc['titleLen'])) . '</option>';
$prev = -$cRow['uid'];
}
}
// If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element:
if (!$edit_record) {
$edit_record = 'tt_content:new/' . $prev . '/' . $colPos;
$inValue = 'tt_content:new/' . $prev . '/' . $colPos;
$is_selected += intval($edit_record == $inValue);
$opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $LANG->getLL('newLabel', 1) . ' ]</option>';
}
// If none is yet selected...
if (!$is_selected) {
$opt[] = '<option value=""></option>';
$opt[] = '<option value="' . $edit_record . '" selected="selected">[ ' . $LANG->getLL('newLabel', 1) . ' ]</option>';
}
// Splitting the edit-record cmd value into table/uid:
$this->eRParts = explode(':', $edit_record);
// Delete-button flag?
$this->deleteButton = t3lib_div::testInt($this->eRParts[1]) && $edit_record && ($this->eRParts[0] != 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] == 'pages' && $this->CALC_PERMS & 4);
// If undo-button should be rendered (depends on available items in sys_history)
$this->undoButton = 0;
$undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->eRParts[0], 'sys_history') . ' AND recuid=' . intval($this->eRParts[1]), '', 'tstamp DESC', '1');
if ($this->undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
$this->undoButton = 1;
}
// Setting up the Return URL for coming back to THIS script (if links take the user to another script)
$R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
//.........这里部分代码省略.........
示例14: getRecordPath
/**
* Returns the path (visually) of a page $uid, fx. "/First page/Second page/Another subpage"
* Each part of the path will be limited to $titleLimit characters
* Deleted pages are filtered out.
*
* @param integer Page uid for which to create record path
* @param string $clause is additional where clauses, eg. "
* @param integer Title limit
* @param integer Title limit of Full title (typ. set to 1000 or so)
* @return mixed Path of record (string) OR array with short/long title if $fullTitleLimit is set.
*/
public static function getRecordPath($uid, $clause = '', $titleLimit = 1000, $fullTitleLimit = 0)
{
$loopCheck = 100;
$output = $fullOutput = '/';
while ($uid != 0 && $loopCheck > 0) {
$loopCheck--;
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,title,deleted,t3ver_oid,t3ver_wsid,t3ver_swapmode', 'pages', 'uid=' . intval($uid) . (strlen(trim($clause)) ? ' AND ' . $clause : ''));
if (is_resource($res)) {
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
t3lib_BEfunc::workspaceOL('pages', $row);
if (is_array($row)) {
t3lib_BEfunc::fixVersioningPid('pages', $row);
if ($row['_ORIG_pid'] && $row['t3ver_swapmode'] > 0) {
// Branch points
$output = ' [#VEP#]' . $output;
// Adding visual token - Versioning Entry Point - that tells that THIS position was where the versionized branch got connected to the main tree. I will have to find a better name or something...
}
$uid = $row['pid'];
$output = '/' . t3lib_div::fixed_lgd_cs(strip_tags($row['title']), $titleLimit) . $output;
if ($row['deleted']) {
$output = '<span class="deletedPath">' . $output . '</span>';
}
if ($fullTitleLimit) {
$fullOutput = '/' . t3lib_div::fixed_lgd_cs(strip_tags($row['title']), $fullTitleLimit) . $fullOutput;
}
} else {
break;
}
} else {
break;
}
}
if ($fullTitleLimit) {
return array($output, $fullOutput);
} else {
return $output;
}
}
示例15: findPageIdsForVersionStateChange
/**
* Finds page UIDs for the element from table <code>$table</code> with UIDs from <code>$idList</code>
*
* @param string $table Table to search
* @param array $idList List of records' UIDs
* @param integer $workspaceId Workspace ID. We need this parameter because user can be in LIVE but he still can publisg DRAFT from ws module!
* @param array $pageIdList List of found page UIDs
* @param array $elementList List of found element UIDs. Key is table name, value is list of UIDs
* @return void
*/
public function findPageIdsForVersionStateChange($table, array $idList, $workspaceId, array &$pageIdList, array &$elementList)
{
if ($workspaceId != 0) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('DISTINCT B.pid', $table . ' A,' . $table . ' B', 'A.pid=-1' . ' AND A.t3ver_wsid=' . $workspaceId . ' AND A.uid IN (' . implode(',', $idList) . ') AND A.t3ver_oid=B.uid' . t3lib_BEfunc::deleteClause($table, 'A') . t3lib_BEfunc::deleteClause($table, 'B'));
while (FALSE !== ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res))) {
$pageIdList[] = $row[0];
// Find ws version
// Note: cannot use t3lib_BEfunc::getRecordWSOL()
// here because it does not accept workspace id!
$rec = t3lib_BEfunc::getRecord('pages', $row[0]);
t3lib_BEfunc::workspaceOL('pages', $rec, $workspaceId);
if ($rec['_ORIG_uid']) {
$elementList['pages'][$row[0]] = $rec['_ORIG_uid'];
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
// The line below is necessary even with DISTINCT
// because several elements can be passed by caller
$pageIdList = array_unique($pageIdList);
}
}