本文整理汇总了PHP中TYPO3\CMS\Backend\Template\ModuleTemplate::section方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleTemplate::section方法的具体用法?PHP ModuleTemplate::section怎么用?PHP ModuleTemplate::section使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Template\ModuleTemplate
的用法示例。
在下文中一共展示了ModuleTemplate::section方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Main function of the module. Write the content to $this->content
*
* @return void
*/
public function main()
{
$languageService = $this->getLanguageService();
$this->thisScript = BackendUtility::getModuleUrl($this->MCONF['name']);
// Clean up settings:
$this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->MCONF['name']);
// Draw the header
// DBAL page title:
$this->content .= '<h1>' . $languageService->getLL('title') . '</h1>';
$this->generateMenu();
// Debug log:
switch ($this->MOD_SETTINGS['function']) {
case 'info':
$this->content .= $this->moduleTemplate->section($languageService->getLL('Cached_info'), $this->printCachedInfo());
break;
case 'sqlcheck':
$this->content .= $this->moduleTemplate->section($languageService->getLL('SQL_check'), $this->printSqlCheck());
break;
case 0:
$this->content .= $this->moduleTemplate->section($languageService->getLL('Debug_log'), $this->printLogMgm());
break;
}
// ShortCut
$shortcutButton = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->makeShortcutButton()->setModuleName($this->MCONF['name'])->setGetVariables(['id']);
$this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->addButton($shortcutButton);
}
示例2: main
/**
* Initialize module header etc and call extObjContent function
*
* @return void
*/
public function main()
{
// We leave this here because of dependencies to submodules
$this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
// 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);
if ($this->pageinfo) {
$this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
}
$access = is_array($this->pageinfo);
if ($this->id && $access || $this->backendUser->user['admin'] && !$this->id) {
if ($this->backendUser->user['admin'] && !$this->id) {
$this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
}
// JavaScript
$this->moduleTemplate->addJavaScriptCode('WebFuncInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';
function jumpToUrl(URL) {
window.location.href = URL;
return false;
}
');
// Setting up the context sensitive menu:
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
$this->content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl($this->moduleName)) . '" method="post" id="InfoModuleController" name="webinfoForm" class="form-inline form-inline-spaced">';
$vContent = $this->moduleTemplate->getVersionSelector($this->id, 1);
if ($vContent) {
$this->content .= $this->moduleTemplate->section('', $vContent);
}
$this->extObjContent();
// Setting up the buttons and markers for docheader
$this->getButtons();
$this->generateMenu();
$this->content .= '</form>';
} else {
// If no access or if ID == zero
$this->content = $this->doc->header($this->languageService->getLL('title'));
}
}
示例3: 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);
$this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
$access = is_array($this->pageinfo);
// We keep this here, in case somebody relies on the old doc being here
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
// Main
if ($this->id && $access) {
// JavaScript
$this->moduleTemplate->addJavaScriptCode('WebFuncInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
// Setting up the context sensitive menu:
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
$this->content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" id="PageFunctionsController" method="post"><input type="hidden" name="id" value="' . htmlspecialchars($this->id) . '" />';
$vContent = $this->moduleTemplate->getVersionSelector($this->id, true);
if ($vContent) {
$this->content .= $this->moduleTemplate->section('', $vContent);
}
$this->extObjContent();
// Setting up the buttons and markers for docheader
$this->getButtons();
$this->generateMenu();
$this->content .= '</form>';
} 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
$this->getButtons();
}
}
示例4: getModuleContent
/**
* Generate the module's content
*
* @return string HTML of the module's main content
*/
protected function getModuleContent()
{
$content = '';
$sectionTitle = '';
// Get submitted data
$this->submittedData = GeneralUtility::_GPmerged('tx_scheduler');
$this->submittedData['uid'] = (int) $this->submittedData['uid'];
// If a save command was submitted, handle saving now
if ($this->CMD === 'save' || $this->CMD === 'saveclose' || $this->CMD === 'savenew') {
$previousCMD = GeneralUtility::_GP('previousCMD');
// First check the submitted data
$result = $this->preprocessData();
// If result is ok, proceed with saving
if ($result) {
$this->saveTask();
if ($this->CMD === 'saveclose') {
// Unset command, so that default screen gets displayed
unset($this->CMD);
} elseif ($this->CMD === 'save') {
// After saving a "add form", return to edit
$this->CMD = 'edit';
} elseif ($this->CMD === 'savenew') {
// Unset submitted data, so that empty form gets displayed
unset($this->submittedData);
// After saving a "add/edit form", return to add
$this->CMD = 'add';
} else {
// Return to edit form
$this->CMD = $previousCMD;
}
} else {
$this->CMD = $previousCMD;
}
}
// Handle chosen action
switch ((string) $this->MOD_SETTINGS['function']) {
case 'scheduler':
$this->executeTasks();
switch ($this->CMD) {
case 'add':
case 'edit':
try {
// Try adding or editing
$content .= $this->editTaskAction();
$sectionTitle = $this->getLanguageService()->getLL('action.' . $this->CMD);
} catch (\Exception $e) {
if ($e->getCode() === 1305100019) {
// Invalid controller class name exception
$this->addMessage($e->getMessage(), FlashMessage::ERROR);
}
// An exception may also happen when the task to
// edit could not be found. In this case revert
// to displaying the list of tasks
// It can also happen when attempting to edit a running task
$content .= $this->listTasksAction();
}
break;
case 'delete':
$this->deleteTask();
$content .= $this->listTasksAction();
break;
case 'stop':
$this->stopTask();
$content .= $this->listTasksAction();
break;
case 'toggleHidden':
$this->toggleDisableAction();
$content .= $this->listTasksAction();
break;
case 'list':
default:
$content .= $this->listTasksAction();
}
break;
// Setup check screen
// Setup check screen
case 'check':
// @todo move check to the report module
$content .= $this->checkScreenAction();
break;
// Information screen
// Information screen
case 'info':
$content .= $this->infoScreenAction();
break;
}
// Wrap the content in a section
return $this->moduleTemplate->section($sectionTitle, '<div class="tx_scheduler_mod1">' . $content . '</div>', false, true);
}
示例5: importData
//.........这里部分代码省略.........
</tr>';
}
$menuItems[] = array('label' => $this->lang->getLL('importdata_upload'), 'content' => '
<table border="0" cellpadding="1" cellspacing="1">
' . implode('
', $row) . '
</table>
');
}
// Perform import or preview depending:
$overviewContent = '';
$extensionInstallationMessage = '';
$inFile = $this->getFile($inData['file']);
if ($inFile !== null && $inFile->exists()) {
$trow = array();
if ($import->loadFile($inFile->getForLocalProcessing(false), 1)) {
// Check extension dependencies:
$extKeysToInstall = array();
if (is_array($import->dat['header']['extensionDependencies'])) {
foreach ($import->dat['header']['extensionDependencies'] as $extKey) {
if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey)) {
$extKeysToInstall[] = $extKey;
}
}
}
if (!empty($extKeysToInstall)) {
$extensionInstallationMessage = 'Before you can install this T3D file you need to install the extensions "' . implode('", "', $extKeysToInstall) . '".';
}
if ($inData['import_file']) {
if (empty($extKeysToInstall)) {
$import->importData($this->id);
BackendUtility::setUpdateSignal('updatePageTree');
}
}
$import->display_import_pid_record = $this->pageinfo;
$overviewContent = $import->displayContentOverview();
}
// Meta data output:
$trow[] = '<tr class="bgColor5">
<td colspan="2"><strong>' . $this->lang->getLL('importdata_metaData', true) . '</strong></td>
</tr>';
$trow[] = '<tr class="bgColor4">
<td><strong>' . $this->lang->getLL('importdata_title', true) . '</strong></td>
<td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['title'])) . '</td>
</tr>';
$trow[] = '<tr class="bgColor4">
<td><strong>' . $this->lang->getLL('importdata_description', true) . '</strong></td>
<td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['description'])) . '</td>
</tr>';
$trow[] = '<tr class="bgColor4">
<td><strong>' . $this->lang->getLL('importdata_notes', true) . '</strong></td>
<td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['notes'])) . '</td>
</tr>';
$trow[] = '<tr class="bgColor4">
<td><strong>' . $this->lang->getLL('importdata_packager', true) . '</strong></td>
<td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['packager_name'] . ' (' . $import->dat['header']['meta']['packager_username'] . ')')) . '<br/>
' . $this->lang->getLL('importdata_email', true) . ' ' . $import->dat['header']['meta']['packager_email'] . '</td>
</tr>';
// Thumbnail icon:
if (is_array($import->dat['header']['thumbnail'])) {
$pI = pathinfo($import->dat['header']['thumbnail']['filename']);
if (GeneralUtility::inList('gif,jpg,png,jpeg', strtolower($pI['extension']))) {
// Construct filename and write it:
$fileName = PATH_site . 'typo3temp/importthumb.' . $pI['extension'];
GeneralUtility::writeFile($fileName, $import->dat['header']['thumbnail']['content']);
// Check that the image really is an image and not a malicious PHP script...
if (getimagesize($fileName)) {
// Create icon tag:
$iconTag = '<img src="../' . PathUtility::stripPathSitePrefix($fileName) . '" ' . $import->dat['header']['thumbnail']['imgInfo'][3] . ' vspace="5" style="border: solid black 1px;" alt="" />';
$trow[] = '<tr class="bgColor4">
<td><strong>' . $this->lang->getLL('importdata_icon', true) . '</strong></td>
<td>' . $iconTag . '</td>
</tr>';
} else {
GeneralUtility::unlink_tempfile($fileName);
}
}
}
$menuItems[] = array('label' => $this->lang->getLL('importdata_metaData_1387'), 'content' => '
<table border="0" cellpadding="1" cellspacing="1">
' . implode('
', $trow) . '
</table>
');
}
// Print errors that might be:
$errors = $import->printErrorLog();
$menuItems[] = array('label' => $this->lang->getLL('importdata_messages'), 'content' => $errors, 'stateIcon' => $errors ? 2 : 0);
// Output tabs:
$content = $this->moduleTemplate->getDynamicTabMenu($menuItems, 'tx_impexp_import', 1, false, true, false);
if ($extensionInstallationMessage) {
$content = '<div style="border: 1px black solid; margin: 10px 10px 10px 10px; padding: 10px 10px 10px 10px;">' . $this->moduleTemplate->icons(1) . htmlspecialchars($extensionInstallationMessage) . '</div>' . $content;
}
$this->content .= $this->moduleTemplate->section('', $content, 0, 1);
// Print overview:
if ($overviewContent) {
$this->content .= $this->moduleTemplate->section($inData['import_file'] ? $this->lang->getLL('importdata_structureHasBeenImported', true) : $this->lang->getLL('filterpage_structureToBeImported', true), $overviewContent, 0, 1);
}
}
}
示例6: renderQuickEdit
//.........这里部分代码省略.........
if ($edit_record) {
// Splitting uid parts for special features, if new:
list($uidVal, $neighborRecordUid, $ex_colPos) = explode('/', $this->eRParts[1]);
if ($uidVal === 'new') {
$command = 'new';
// Page id of this new record
$theUid = $this->id;
if ($neighborRecordUid) {
$theUid = $neighborRecordUid;
}
} else {
$command = 'edit';
$theUid = $uidVal;
// Convert $uidVal to workspace version if any:
$draftRecord = BackendUtility::getWorkspaceVersionOfRecord($beUser->workspace, $tableName, $theUid, 'uid');
if ($draftRecord) {
$theUid = $draftRecord['uid'];
}
}
// @todo: Hack because DatabaseInitializeNewRow reads from _GP directly
$GLOBALS['_GET']['defVals'][$tableName] = array('colPos' => (int) $ex_colPos, 'sys_language_uid' => (int) $this->current_sys_language);
/** @var TcaDatabaseRecord $formDataGroup */
$formDataGroup = GeneralUtility::makeInstance(TcaDatabaseRecord::class);
/** @var FormDataCompiler $formDataCompiler */
$formDataCompiler = GeneralUtility::makeInstance(FormDataCompiler::class, $formDataGroup);
/** @var NodeFactory $nodeFactory */
$nodeFactory = GeneralUtility::makeInstance(NodeFactory::class);
try {
$formDataCompilerInput = ['tableName' => $tableName, 'vanillaUid' => (int) $theUid, 'command' => $command];
$formData = $formDataCompiler->compile($formDataCompilerInput);
if ($command !== 'new') {
BackendUtility::lockRecords($tableName, $formData['databaseRow']['uid'], $tableName === 'tt_content' ? $formData['databaseRow']['pid'] : 0);
}
$formData['renderType'] = 'outerWrapContainer';
$formResult = $nodeFactory->create($formData)->render();
$panel = $formResult['html'];
$formResult['html'] = '';
/** @var FormResultCompiler $formResultCompiler */
$formResultCompiler = GeneralUtility::makeInstance(FormResultCompiler::class);
$formResultCompiler->mergeResult($formResult);
$row = $formData['databaseRow'];
$new_unique_uid = '';
if ($command === 'new') {
$new_unique_uid = $row['uid'];
}
// Add hidden fields:
if ($uidVal == 'new') {
$panel .= '<input type="hidden" name="data[' . $tableName . '][' . $row['uid'] . '][pid]" value="' . $row['pid'] . '" />';
}
$redirect = $uidVal == 'new' ? BackendUtility::getModuleUrl($this->moduleName, ['id' => $this->id, 'new_unique_uid' => $new_unique_uid, 'returnUrl' => $this->returnUrl]) : $this->R_URI;
$panel .= '
<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />
<input type="hidden" name="edit_record" value="' . $edit_record . '" />
<input type="hidden" name="redirect" value="' . htmlspecialchars($redirect) . '" />
';
// Add JavaScript as needed around the form:
$content = $formResultCompiler->JStop() . $panel . $formResultCompiler->printNeededJSFunctions();
// Display "is-locked" message:
if ($command === 'edit') {
$lockInfo = BackendUtility::isRecordLocked($tableName, $formData['databaseRow']['uid']);
if ($lockInfo) {
/** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class, htmlspecialchars($lockInfo['msg']), '', FlashMessage::WARNING);
/** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
/** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
$defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
$defaultFlashMessageQueue->enqueue($flashMessage);
}
}
} catch (AccessDeniedException $e) {
// If no edit access, print error message:
$content = $this->moduleTemplate->section($lang->getLL('noAccess'), $lang->getLL('noAccess_msg') . '<br /><br />' . ($beUser->errorMsg ? 'Reason: ' . $beUser->errorMsg . '<br /><br />' : ''), 0, 1);
}
} else {
// If no edit access, print error message:
$content = $this->moduleTemplate->section($lang->getLL('noAccess'), $lang->getLL('noAccess_msg'), 0, 1);
}
// Element selection matrix:
if ($tableName === 'tt_content' && MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) {
$content .= '<h2>' . $lang->getLL('CEonThisPage') . '</h2>';
// PositionMap
$posMap = GeneralUtility::makeInstance(ContentLayoutPagePositionMap::class);
$posMap->cur_sys_language = $this->current_sys_language;
$content .= $posMap->printContentElementColumns($this->id, $this->eRParts[1], $this->colPosList, $this->MOD_SETTINGS['tt_content_showHidden'], $this->R_URI);
// Toggle hidden ContentElements
$numberOfHiddenElements = $this->getNumberOfHiddenElements();
if ($numberOfHiddenElements) {
$content .= '<div class="checkbox">';
$content .= '<label for="checkTt_content_showHidden">';
$content .= BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], '', '', 'id="checkTt_content_showHidden"');
$content .= !$numberOfHiddenElements ? '<span class="text-muted">' . $lang->getLL('hiddenCE', true) . '</span>' : $lang->getLL('hiddenCE', true) . ' (' . $numberOfHiddenElements . ')';
$content .= '</label>';
$content .= '</div>';
}
// CSH
$content .= BackendUtility::cshItem($this->descrTable, 'quickEdit_selElement');
}
return $content;
}
示例7: noTemplate
/**
* No template
*
* @param int $newStandardTemplate
* @return string
*/
public function noTemplate($newStandardTemplate = 0)
{
// Defined global here!
/** @var ExtendedTemplateService $tmpl */
$tmpl = GeneralUtility::makeInstance(ExtendedTemplateService::class);
$GLOBALS['tmpl'] = $tmpl;
// Do not log time-performance information
$tmpl->tt_track = false;
$tmpl->init();
$lang = $this->getLanguageService();
$title = $lang->getLL('noTemplate');
$message = '<p>' . $lang->getLL('noTemplateDescription') . '<br />' . $lang->getLL('createTemplateToEditConfiguration') . '</p>';
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:tstemplate/Resources/Private/Templates/InfoBox.html'));
$view->assignMultiple(array('title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO));
$theOutput = $view->render();
// New standard?
if ($newStandardTemplate) {
// Hook to change output, implemented for statictemplates
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][TypoScriptTemplateModuleController::class]['newStandardTemplateView'])) {
$selector = '';
$staticsText = '';
$reference = array('selectorHtml' => &$selector, 'staticsText' => &$staticsText);
GeneralUtility::callUserFunction($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][TypoScriptTemplateModuleController::class]['newStandardTemplateView'], $reference, $this);
$selector = $reference['selectorHtml'];
$staticsText = $reference['staticsText'];
} else {
$selector = '<input type="hidden" name="createStandard" value="" />';
$staticsText = '';
}
// Extension?
$theOutput .= $this->moduleTemplate->section($lang->getLL('newWebsite') . $staticsText, '<p>' . $lang->getLL('newWebsiteDescription') . '</p>' . $selector . '<input class="btn btn-primary" type="submit" name="newWebsite" value="' . $lang->getLL('newWebsiteAction') . '" />', 0, 1);
}
// Extension?
$theOutput .= $this->moduleTemplate->section($lang->getLL('extTemplate'), '<p>' . $lang->getLL('extTemplateDescription') . '</p>' . '<input class="btn btn-default" type="submit" name="createExtension" value="' . $lang->getLL('extTemplateAction') . '" />', 0, 1);
// Go to first appearing...
$first = $tmpl->ext_prevPageWithTemplate($this->id, $this->perms_clause);
if ($first) {
$urlParameters = array('id' => $first['uid']);
$aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
$theOutput .= $this->moduleTemplate->section($lang->getLL('goToClosest'), sprintf('<p>' . $lang->getLL('goToClosestDescription') . '</p>%s' . $lang->getLL('goToClosestAction') . '%s', htmlspecialchars($first['title']), $first['uid'], '<a class="btn btn-default" href="' . htmlspecialchars($aHref) . '">', '</a>'), 0, 1);
}
return $theOutput;
}