本文整理汇总了PHP中TYPO3\CMS\Backend\Template\DocumentTemplate::getVersionSelector方法的典型用法代码示例。如果您正苦于以下问题:PHP DocumentTemplate::getVersionSelector方法的具体用法?PHP DocumentTemplate::getVersionSelector怎么用?PHP DocumentTemplate::getVersionSelector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Template\DocumentTemplate
的用法示例。
在下文中一共展示了DocumentTemplate::getVersionSelector方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Initialize module header etc and call extObjContent function
*
* @return void
*/
public function main()
{
// Access check...
// The page will show only if there is a valid page and if this page may be viewed by the user
$this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
$access = is_array($this->pageinfo);
// Template markers
$markers = array('CSH' => '', 'FUNC_MENU' => '', 'CONTENT' => '');
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->setModuleTemplate('EXT:func/Resources/Private/Templates/func.html');
// Main
if ($this->id && $access) {
// JavaScript
$this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
// Setting up the context sensitive menu:
$this->doc->getContextMenuCode();
$this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" method="post"><input type="hidden" name="id" value="' . htmlspecialchars($this->id) . '" />';
$vContent = $this->doc->getVersionSelector($this->id, TRUE);
if ($vContent) {
$this->content .= $this->doc->section('', $vContent);
}
$this->extObjContent();
// Setting up the buttons and markers for docheader
$docHeaderButtons = $this->getButtons();
$markers['CSH'] = $docHeaderButtons['csh'];
$markers['FUNC_MENU'] = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
$markers['CONTENT'] = $this->content;
} else {
// If no access or if ID == zero
$title = $this->getLanguageService()->getLL('title');
$message = $this->getLanguageService()->getLL('clickAPage_content');
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:func/Resources/Private/Templates/InfoBox.html'));
$view->assignMultiple(array('title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO));
$this->content = $view->render();
// Setting up the buttons and markers for docheader
$docHeaderButtons = $this->getButtons();
$markers['CSH'] = $docHeaderButtons['csh'];
$markers['CONTENT'] = $this->content;
}
// Build the <body> for the module
$this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
// Renders the module page
$this->content = $this->doc->render($this->getLanguageService()->getLL('title'), $this->content);
}
示例2: main
/**
* Initialize module header etc and call extObjContent function
*
* @return void
*/
public function main()
{
// Access check...
// The page will show only if there is a valid page and if this page may be viewed by the user
$this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
$access = is_array($this->pageinfo);
if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) {
$this->CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($this->pageinfo);
if ($GLOBALS['BE_USER']->user['admin'] && !$this->id) {
$this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
}
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->setModuleTemplate('EXT:info/Resources/Private/Templates/info.html');
$this->doc->tableLayout = array('0' => array('0' => array('<td valign="top"><strong>', '</strong></td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>', '</strong></td>')), 'defRow' => array('0' => array('<td valign="top">', '</td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top">', '</td>')));
// JavaScript
$this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
// Setting up the context sensitive menu:
$this->doc->getContextMenuCode();
$this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_info')) . '" method="post" name="webinfoForm">';
$vContent = $this->doc->getVersionSelector($this->id, 1);
if ($vContent) {
$this->content .= $this->doc->section('', $vContent);
}
$this->extObjContent();
// Setting up the buttons and markers for docheader
$docHeaderButtons = $this->getButtons();
$markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $this->content);
// Build the <body> for the module
$this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
} else {
// If no access or if ID == zero
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->content = $this->doc->header($GLOBALS['LANG']->getLL('title'));
$this->content .= $this->doc->spacer(5);
$this->content .= $this->doc->spacer(10);
}
// Renders the module page
$this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content);
}
示例3: main
/**
* Main function, creating the content for the access editing forms/listings
*
* @return void
*/
public function main()
{
// Access check...
// The page will show only if there is a valid page and if this page may be viewed by the user
$this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
$access = is_array($this->pageinfo);
// Checking access:
if ($this->id && $access || $GLOBALS['BE_USER']->isAdmin() && !$this->id) {
if ($GLOBALS['BE_USER']->isAdmin() && !$this->id) {
$this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
}
// This decides if the editform can and will be drawn:
$this->editingAllowed = $this->pageinfo['perms_userid'] == $GLOBALS['BE_USER']->user['uid'] || $GLOBALS['BE_USER']->isAdmin();
$this->edit = $this->edit && $this->editingAllowed;
// If $this->edit then these functions are called in the end of the page...
if ($this->edit) {
$this->doc->postCode .= $this->doc->wrapScriptTags('
setCheck("check[perms_user]", "data[pages][' . $this->id . '][perms_user]");
setCheck("check[perms_group]", "data[pages][' . $this->id . '][perms_group]");
setCheck("check[perms_everybody]", "data[pages][' . $this->id . '][perms_everybody]");
');
}
// Draw the HTML page header.
$this->content .= $this->doc->header($GLOBALS['LANG']->getLL('permissions') . ($this->edit ? ': ' . $GLOBALS['LANG']->getLL('Edit') : ''));
$this->content .= $this->doc->spacer(5);
$vContent = $this->doc->getVersionSelector($this->id, 1);
if ($vContent) {
$this->content .= $this->doc->section('', $vContent);
}
// Main function, branching out:
if (!$this->edit) {
$this->notEdit();
} else {
$this->doEdit();
}
$docHeaderButtons = $this->getButtons();
$markers['CSH'] = $this->docHeaderButtons['csh'];
$markers['FUNC_MENU'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode']);
$markers['CONTENT'] = $this->content;
// Build the <body> for the module
$this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
} else {
// If no access or if ID == zero
$this->content = $this->doc->header($GLOBALS['LANG']->getLL('permissions'));
}
// Renders the module page
$this->content = $this->doc->render($GLOBALS['LANG']->getLL('permissions'), $this->content);
}
示例4: main
//.........这里部分代码省略.........
// Save the clipboard content
$dblist->clipObj->endClipboard();
// This flag will prevent the clipboard panel in being shown.
// It is set, if the clickmenu-layer is active AND the extended view is not enabled.
$dblist->dontShowClipControlPanels = !$this->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current == 'normal' && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers'];
// If there is access to the page or root page is used for searching, then render the list contents and set up the document template object:
if ($access || $this->id === 0 && $this->search_levels > 0 && strlen($this->search_field) > 0) {
// Deleting records...:
// Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table.
if ($this->cmd == 'delete') {
$items = $dblist->clipObj->cleanUpCBC(GeneralUtility::_POST('CBC'), $this->cmd_table, 1);
if (count($items)) {
$cmd = array();
foreach ($items as $iK => $value) {
$iKParts = explode('|', $iK);
$cmd[$iKParts[0]][$iKParts[1]]['delete'] = 1;
}
$tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
$tce->stripslashes_values = 0;
$tce->start(array(), $cmd);
$tce->process_cmdmap();
if (isset($cmd['pages'])) {
BackendUtility::setUpdateSignal('updatePageTree');
}
$tce->printLogErrorMessages(GeneralUtility::getIndpEnv('REQUEST_URI'));
}
}
// Initialize the listing object, dblist, for rendering the list:
$this->pointer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
$dblist->start($this->id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
$dblist->setDispFields();
// Render versioning selector:
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version')) {
$dblist->HTMLcode .= $this->doc->getVersionSelector($this->id);
}
// Render the list of tables:
$dblist->generateList();
$listUrl = substr($dblist->listURL(), strlen($GLOBALS['BACK_PATH']));
// Add JavaScript functions to the page:
$this->doc->JScode = $this->doc->wrapScriptTags('
function jumpExt(URL,anchor) { //
var anc = anchor?anchor:"";
window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc;
return false;
}
function jumpSelf(URL) { //
window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:"");
return false;
}
function setHighlight(id) { //
top.fsMod.recentIds["web"]=id;
top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank; // For highlighting
if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
top.content.nav_frame.refresh_nav();
}
}
' . $this->doc->redirectUrls($listUrl) . '
' . $dblist->CBfunctions() . '
function editRecords(table,idList,addParams,CBflag) { //
window.location.href="' . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams;
}
function editList(table,idList) { //
var list="";
示例5: renderListContent
/**
* Rendering all other listings than QuickEdit
*
* @return string
*/
public function renderListContent()
{
/** @var $dbList \TYPO3\CMS\Backend\View\PageLayoutView */
$dbList = GeneralUtility::makeInstance(PageLayoutView::class);
$dbList->backPath = $GLOBALS['BACK_PATH'];
$dbList->thumbs = $this->imagemode;
$dbList->no_noWrap = 1;
$dbList->descrTable = $this->descrTable;
$this->pointer = MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
$dbList->script = BackendUtility::getModuleUrl('web_layout');
$dbList->showIcon = 0;
$dbList->setLMargin = 0;
$dbList->doEdit = $this->EDIT_CONTENT;
$dbList->ext_CALC_PERMS = $this->CALC_PERMS;
$dbList->agePrefixes = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears');
$dbList->id = $this->id;
$dbList->nextThree = MathUtility::forceIntegerInRange($this->modTSconfig['properties']['editFieldsAtATime'], 0, 10);
$dbList->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
$dbList->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0;
if (!$dbList->nextThree) {
$dbList->nextThree = 1;
}
$dbList->externalTables = $this->externalTables;
// Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!)
// also fills $dbList->activeTables
$dbList->getTableMenu($this->id);
// Initialize other variables:
$h_func = '';
$tableOutput = array();
$tableJSOutput = array();
$CMcounter = 0;
// Traverse the list of table names which has records on this page (that array is populated
// by the $dblist object during the function getTableMenu()):
foreach ($dbList->activeTables as $table => $value) {
$h_func_b = '';
if (!isset($dbList->externalTables[$table])) {
$q_count = $this->getNumberOfHiddenElements();
if ($q_count > 0) {
$h_func_b = '<div class="checkbox">' . '<label for="checkTt_content_showHidden">' . '<input type="checkbox" id="checkTt_content_showHidden" class="checkbox" name="SET[tt_content_showHidden]" value="1" ' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? 'checked="checked"' : '') . ' />' . $this->getLanguageService()->getLL('hiddenCE', TRUE) . ' (<span class="t3js-hidden-counter">' . $q_count . '</span>)' . '</label>' . '</div>';
}
// Boolean: Display up/down arrows and edit icons for tt_content records
$dbList->tt_contentConfig['showCommands'] = 1;
// Boolean: Display info-marks or not
$dbList->tt_contentConfig['showInfo'] = 1;
// Setting up the tt_content columns to show:
if (is_array($GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'])) {
$colList = array();
$tcaItems = GeneralUtility::callUserFunction(BackendLayoutView::class . '->getColPosListItemsParsed', $this->id, $this);
foreach ($tcaItems as $temp) {
$colList[] = $temp[1];
}
} else {
// ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
$colList = array('1', '0', '2', '3');
}
if ($this->colPosList !== '') {
$colList = array_intersect(GeneralUtility::intExplode(',', $this->colPosList), $colList);
}
// The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
$dbList->tt_contentConfig['cols'] = implode(',', $colList);
$dbList->tt_contentConfig['activeCols'] = $this->activeColPosList;
$dbList->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
$dbList->tt_contentConfig['sys_language_uid'] = (int) $this->current_sys_language;
// If the function menu is set to "Language":
if ($this->MOD_SETTINGS['function'] == 2) {
$dbList->tt_contentConfig['languageMode'] = 1;
$dbList->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
$dbList->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
}
} else {
if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) {
$h_func = BackendUtility::getFuncMenu($this->id, 'SET[' . $table . ']', $this->MOD_SETTINGS[$table], $this->MOD_MENU[$table], '', '');
} else {
$h_func = '';
}
}
// Start the dblist object:
$dbList->itemsLimitSingleTable = 1000;
$dbList->start($this->id, $table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
$dbList->counter = $CMcounter;
$dbList->ext_function = $this->MOD_SETTINGS['function'];
// Render versioning selector:
$dbList->HTMLcode .= $this->doc->getVersionSelector($this->id);
// Generate the list of elements here:
$dbList->generateList();
// Adding the list content to the tableOutput variable:
$tableOutput[$table] = ($h_func ? $h_func . '<br /><img src="clear.gif" width="1" height="4" alt="" /><br />' : '') . $dbList->HTMLcode . ($h_func_b ? '<img src="clear.gif" width="1" height="10" alt="" /><br />' . $h_func_b : '');
// ... and any accumulated JavaScript goes the same way!
$tableJSOutput[$table] = $dbList->JScode;
// Increase global counter:
$CMcounter += $dbList->counter;
// Reset variables after operation:
$dbList->HTMLcode = '';
$dbList->JScode = '';
$h_func = '';
//.........这里部分代码省略.........
示例6: renderListContent
//.........这里部分代码省略.........
if ($this->MOD_SETTINGS['function'] == 4) {
// Grid view
$dblist->tt_contentConfig['showAsGrid'] = 1;
}
// Setting up the tt_content columns to show:
if (is_array($GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'])) {
$colList = array();
$tcaItems = GeneralUtility::callUserFunction('TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getColPosListItemsParsed', $this->id, $this);
foreach ($tcaItems as $temp) {
$colList[] = $temp[1];
}
} else {
// ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
$colList = array('1', '0', '2', '3');
}
if ($this->colPosList !== '') {
$colList = array_intersect(GeneralUtility::intExplode(',', $this->colPosList), $colList);
}
// If only one column found, display the single-column view.
if (count($colList) === 1 && !$this->MOD_SETTINGS['function'] === 4) {
// Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol']
// is shown in the total width of the page
$dblist->tt_contentConfig['single'] = 1;
// The column(s) to show if single mode (under each other)
$dblist->tt_contentConfig['showSingleCol'] = current($colList);
}
// The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
$dblist->tt_contentConfig['cols'] = implode(',', $colList);
$dblist->tt_contentConfig['activeCols'] = $this->activeColPosList;
$dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
$dblist->tt_contentConfig['sys_language_uid'] = (int) $this->current_sys_language;
// If the function menu is set to "Language":
if ($this->MOD_SETTINGS['function'] == 2) {
$dblist->tt_contentConfig['single'] = 0;
$dblist->tt_contentConfig['languageMode'] = 1;
$dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
$dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
}
} else {
if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) {
$h_func = BackendUtility::getFuncMenu($this->id, 'SET[' . $table . ']', $this->MOD_SETTINGS[$table], $this->MOD_MENU[$table], 'db_layout.php', '');
} else {
$h_func = '';
}
}
// Start the dblist object:
$dblist->itemsLimitSingleTable = 1000;
$dblist->start($this->id, $table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
$dblist->counter = $CMcounter;
$dblist->ext_function = $this->MOD_SETTINGS['function'];
// Render versioning selector:
$dblist->HTMLcode .= $this->doc->getVersionSelector($this->id);
// Generate the list of elements here:
$dblist->generateList();
// Adding the list content to the tableOutput variable:
$tableOutput[$table] = ($h_func ? $h_func . '<br /><img src="clear.gif" width="1" height="4" alt="" /><br />' : '') . $dblist->HTMLcode . ($h_func_b ? '<img src="clear.gif" width="1" height="10" alt="" /><br />' . $h_func_b : '');
// ... and any accumulated JavaScript goes the same way!
$tableJSOutput[$table] = $dblist->JScode;
// Increase global counter:
$CMcounter += $dblist->counter;
// Reset variables after operation:
$dblist->HTMLcode = '';
$dblist->JScode = '';
$h_func = '';
$h_func_b = '';
}
// END: traverse tables
// For Context Sensitive Menus:
$this->doc->getContextMenuCode();
// Init the content
$content = '';
// Additional header content
$headerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'];
if (is_array($headerContentHook)) {
foreach ($headerContentHook as $hook) {
$params = array();
$content .= GeneralUtility::callUserFunction($hook, $params, $this);
}
}
// Add the content for each table we have rendered (traversing $tableOutput variable)
foreach ($tableOutput as $table => $output) {
$content .= $this->doc->section('', $output, TRUE, TRUE, 0, TRUE);
$content .= $this->doc->spacer(15);
$content .= $this->doc->sectionEnd();
}
// Making search form:
if (!$this->modTSconfig['properties']['disableSearchBox'] && count($tableOutput)) {
$sectionTitle = BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.search', TRUE));
$content .= $this->doc->section($sectionTitle, $dblist->getSearchBox(0), FALSE, TRUE, FALSE, TRUE);
}
// Additional footer content
$footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawFooterHook'];
if (is_array($footerContentHook)) {
foreach ($footerContentHook as $hook) {
$params = array();
$content .= GeneralUtility::callUserFunction($hook, $params, $this);
}
}
return $content;
}