本文整理汇总了PHP中TYPO3\CMS\Backend\Template\ModuleTemplate::setForm方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleTemplate::setForm方法的具体用法?PHP ModuleTemplate::setForm怎么用?PHP ModuleTemplate::setForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Template\ModuleTemplate
的用法示例。
在下文中一共展示了ModuleTemplate::setForm方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initialization
*
* @return void
*/
public function init()
{
$this->MCONF['name'] = $this->moduleName;
$this->menuConfig();
$this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
$this->moduleTemplate->setForm('<form action="" method="post" name="' . $this->formName . '">');
}
示例2: init
/**
* Initialization
*
* @return void
*/
public function init()
{
$this->MCONF['name'] = $this->moduleName;
$this->menuConfig();
$this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
$this->moduleTemplate->setForm('<form action="" method="post" name="' . $this->formName . '">');
$this->moduleTemplate->addJavaScriptCode('jumpToUrl', '
function jumpToUrl(URL) {
window.location.href = URL;
return false;
}
');
}
示例3: main
/**
* Renders a FlexForm configuration form.
*
* @return void
*/
public function main()
{
$this->languageService->includeLLFile('EXT:image_autoresize/mod1/locallang.xlf');
$this->processData();
$formTag = '<form action="" method="post" name="editform">';
if (version_compare(TYPO3_version, '7.5.99', '>')) {
$this->moduleTemplate->setForm($formTag);
$this->content .= sprintf('<h3>%s</h3>', $this->languageService->getLL('title', true));
$this->addStatisticsAndSocialLink();
} else {
if (version_compare(TYPO3_version, '7.4.99', '<=')) {
$this->initTCEForms();
}
$this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->setModuleTemplate(ExtensionManagementUtility::extPath($this->extKey) . 'mod1/mod_template.html');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->form = $formTag;
$this->content .= $this->doc->header($this->languageService->getLL('title'));
$this->addStatisticsAndSocialLink();
$this->content .= $this->doc->spacer(5);
}
$row = $this->config;
if (version_compare(TYPO3_version, '7.5.0', '>=')) {
$this->fixRecordForFormEngine($row, array('file_types', 'usergroup'));
$this->moduleContent($row);
} else {
if ($row['rulesets']) {
/** @var $flexObj \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools */
$flexObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\FlexForm\\FlexFormTools');
$row['rulesets'] = $flexObj->flexArray2Xml($row['rulesets'], true);
}
$this->moduleContentLegacy($row);
}
// Compile document
if (version_compare(TYPO3_version, '7.5.99', '>')) {
$this->addToolbarButtons();
$this->moduleTemplate->setContent($this->content);
$content = $this->moduleTemplate->renderContent();
} else {
$markers = array('FUNC_MENU' => '', 'CONTENT' => $this->content);
// Build the <body> for the module
$docHeaderButtons = $this->getButtons();
$content = $this->doc->startPage($this->languageService->getLL('title'));
$content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markers);
$content .= $this->doc->endPage();
// Wrap result appropriately
$content = $this->doc->insertStylesAndJS($content);
}
// Replace module content with everything needed
$this->content = $content;
}
示例4: main
/**
* Main function of the module. Write the content to $this->content
*
* @return void
*/
public function main()
{
// Access check!
// The page will show only if user has admin rights
if ($this->getBackendUser()->isAdmin()) {
// Set the form
$this->moduleTemplate->setForm('<form name="tx_scheduler_form" id="tx_scheduler_form" method="post" action="">');
// Prepare main content
$this->content = '<h1>' . $this->getLanguageService()->getLL('function.' . $this->MOD_SETTINGS['function']) . '</h1>';
$this->content .= $this->getModuleContent();
} else {
// If no access, only display the module's title
$this->content = '<h1>' . $this->getLanguageService()->getLL('title.') . '</h1>';
$this->content .= $this->moduleTemplate->spacer(5);
}
$this->getButtons();
$this->getModuleMenu();
$this->content = $this->getFlashMessages() . $this->content;
}
示例5: 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->moduleTemplate->setForm('<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" 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();
} 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();
}
}
示例6: 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);
$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->moduleTemplate->setForm('<form action="' . htmlspecialchars(BackendUtility::getModuleUrl($this->moduleName)) . '" method="post" 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();
} else {
// If no access or if ID == zero
$this->content = $this->doc->header($this->languageService->getLL('title'));
}
}
示例7: main
/**
* Main module function
*
* @throws \BadFunctionCallException
* @throws \InvalidArgumentException
* @return void
*/
public function main()
{
$this->lang->includeLLFile('EXT:impexp/Resources/Private/Language/locallang.xlf');
// Start document template object:
// We keep this here, in case somebody relies on the old doc being here
$this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
$this->doc->bodyTagId = 'imp-exp-mod';
$this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
$this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
// Setting up the context sensitive menu:
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Impexp/ImportExport');
$this->moduleTemplate->addJavaScriptCode('ImpexpInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
$this->moduleTemplate->setForm('<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('xMOD_tximpexp')) . '" method="post" enctype="multipart/form-data">' . '<input type="hidden" name="id" value="' . $this->id . '" />');
// Input data grabbed:
$inData = GeneralUtility::_GP('tx_impexp');
$this->content .= $this->moduleTemplate->sectionHeader($this->lang->getLL('title_' . (string) $inData['action']));
$this->content .= '<div style="padding-top: 5px;"></div>';
$this->checkUpload();
switch ((string) $inData['action']) {
case 'export':
$this->shortcutName = $this->lang->getLL('title_export');
// Finally: If upload went well, set the new file as the thumbnail in the $inData array:
if (!empty($this->uploadedFiles[0])) {
$inData['meta']['thumbnail'] = $this->uploadedFiles[0]->getCombinedIdentifier();
}
// Call export interface
$this->exportData($inData);
break;
case 'import':
$this->shortcutName = $this->lang->getLL('title_import');
// Finally: If upload went well, set the new file as the import file:
if (!empty($this->uploadedFiles[0])) {
// Only allowed extensions....
if (GeneralUtility::inList('t3d,xml', $this->uploadedFiles[0]->getExtension())) {
$inData['file'] = $this->uploadedFiles[0]->getCombinedIdentifier();
}
}
// Call import interface:
$this->importData($inData);
break;
}
// Setting up the buttons and markers for docheader
$this->getButtons();
}
示例8: renderQuickEdit
/**
* Rendering the quick-edit view.
*
* @return string
*/
public function renderQuickEdit()
{
$databaseConnection = $this->getDatabaseConnection();
$beUser = $this->getBackendUser();
$lang = $this->getLanguageService();
// Alternative form tag; Quick Edit submits its content to tce_db.php.
$this->moduleTemplate->setForm('<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db', ['prErr' => 1, 'uPT' => 1])) . '" method="post" enctype="multipart/form-data" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">');
// 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 FormEngine
if (substr($edit_record, 0, 9) == '_EDIT_COL') {
$res = $databaseConnection->exec_SELECTquery('*', 'tt_content', 'pid=' . (int) $this->id . ' AND colPos=' . (int) substr($edit_record, 10) . ' AND sys_language_uid=' . (int) $this->current_sys_language . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : BackendUtility::BEenableFields('tt_content')) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'sorting');
$idListA = array();
while ($cRow = $databaseConnection->sql_fetch_assoc($res)) {
$idListA[] = $cRow['uid'];
}
$url = BackendUtility::getModuleUrl('record_edit', array('edit[tt_content][' . implode(',', $idListA) . ']' => 'edit', 'returnUrl' => $this->local_linkThisScript(array('edit_record' => ''))));
HttpUtility::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 = $databaseConnection->exec_SELECTquery('*', 'sys_log', 'userid=' . (int) $beUser->user['uid'] . ' AND NEWid=' . $databaseConnection->fullQuoteStr($this->new_unique_uid, 'sys_log'));
$sys_log_row = $databaseConnection->sql_fetch_assoc($res);
if (is_array($sys_log_row)) {
$edit_record = $sys_log_row['tablename'] . ':' . $sys_log_row['recuid'];
}
}
$edit_record = $this->makeQuickEditMenu($edit_record);
// Splitting the edit-record cmd value into table/uid:
$this->eRParts = explode(':', $edit_record);
$tableName = $this->eRParts[0];
// Delete-button flag?
$this->deleteButton = MathUtility::canBeInterpretedAsInteger($this->eRParts[1]) && $edit_record && ($tableName !== 'pages' && $this->EDIT_CONTENT || $tableName === 'pages' && $this->CALC_PERMS & Permission::PAGE_DELETE);
// If undo-button should be rendered (depends on available items in sys_history)
$this->undoButton = false;
$undoRes = $databaseConnection->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $databaseConnection->fullQuoteStr($tableName, 'sys_history') . ' AND recuid=' . (int) $this->eRParts[1], '', 'tstamp DESC', '1');
if ($this->undoButtonR = $databaseConnection->sql_fetch_assoc($undoRes)) {
$this->undoButton = true;
}
// Setting up the Return URL for coming back to THIS script (if links take the user to another script)
$R_URL_parts = parse_url(GeneralUtility::getIndpEnv('REQUEST_URI'));
$R_URL_getvars = GeneralUtility::_GET();
unset($R_URL_getvars['popView']);
unset($R_URL_getvars['new_unique_uid']);
$R_URL_getvars['edit_record'] = $edit_record;
$this->R_URI = $R_URL_parts['path'] . '?' . GeneralUtility::implodeArrayForUrl('', $R_URL_getvars);
// Creating editing form:
$content = '';
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') {
//.........这里部分代码省略.........
示例9: init
/**
* Initialization
*
* @return void
*/
public function init()
{
$this->menuConfig();
$this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
$this->moduleTemplate->setForm('<form action="" method="post">');
}
示例10: main
/**
* Main
*
* @return void
*/
public function main()
{
// Template markers
$markers = array('CSH' => '', 'FUNC_MENU' => '', 'CONTENT' => '');
// 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->access = is_array($this->pageinfo);
/** @var DocumentTemplate doc */
$this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
$this->moduleTemplate->getPageRenderer()->addCssFile(ExtensionManagementUtility::extRelPath('tstemplate') . 'Resources/Public/Css/styles.css');
$lang = $this->getLanguageService();
if ($this->id && $this->access) {
$urlParameters = array('id' => $this->id, 'template' => 'all');
$aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
$this->moduleTemplate->setForm('<form action="' . htmlspecialchars($aHref) . '" method="post" enctype="multipart/form-data" name="editForm" class="form">');
// JavaScript
$this->moduleTemplate->addJavaScriptCode('TSTemplateInlineJS', '
function uFormUrl(aname) {
document.forms[0].action = ' . GeneralUtility::quoteJSvalue($aHref . '#') . '+aname;
}
function brPoint(lnumber,t) {
window.location.href = ' . GeneralUtility::quoteJSvalue($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateObjectBrowserModuleFunctionController&SET[ts_browser_type]=') . '+(t?"setup":"const")+"&breakPointLN="+lnumber;
return false;
}
if (top.fsMod) top.fsMod.recentIds["web"] = ' . $this->id . ';
');
$this->moduleTemplate->getPageRenderer()->addCssInlineBlock('TSTemplateInlineStyle', '
TABLE#typo3-objectBrowser { width: 100%; margin-bottom: 24px; }
TABLE#typo3-objectBrowser A { text-decoration: none; }
TABLE#typo3-objectBrowser .comment { color: maroon; font-weight: bold; }
.ts-typoscript { width: 100%; }
.tsob-search-submit {margin-left: 3px; margin-right: 3px;}
.tst-analyzer-options { margin:5px 0; }
');
// Setting up the context sensitive menu:
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
// Build the module content
$this->content = $this->doc->header($lang->getLL('moduleTitle'));
$this->extObjContent();
// Setting up the buttons and markers for docheader
$this->getButtons();
$this->generateMenu();
} else {
// Template pages:
$records = $this->getDatabaseConnection()->exec_SELECTgetRows('pages.uid, count(*) AS count, max(sys_template.root) AS root_max_val, min(sys_template.root) AS root_min_val', 'pages,sys_template', 'pages.uid=sys_template.pid' . BackendUtility::deleteClause('pages') . BackendUtility::versioningPlaceholderClause('pages') . BackendUtility::deleteClause('sys_template') . BackendUtility::versioningPlaceholderClause('sys_template'), 'pages.uid', 'pages.pid, pages.sorting');
$pArray = array();
foreach ($records as $record) {
$this->setInPageArray($pArray, BackendUtility::BEgetRootLine($record['uid'], 'AND 1=1'), $record);
}
$table = '<div class="table-fit"><table class="table table-striped table-hover" id="ts-overview">' . '<thead>' . '<tr>' . '<th>' . $lang->getLL('pageName') . '</th>' . '<th>' . $lang->getLL('templates') . '</th>' . '<th>' . $lang->getLL('isRoot') . '</th>' . '<th>' . $lang->getLL('isExt') . '</th>' . '</tr>' . '</thead>' . '<tbody>' . implode('', $this->renderList($pArray)) . '</tbody>' . '</table></div>';
$this->content = $this->doc->header($lang->getLL('moduleTitle'));
$this->content .= $this->moduleTemplate->section('', '<p class="lead">' . $lang->getLL('overview') . '</p>' . $table);
// RENDER LIST of pages with templates, END
// Setting up the buttons and markers for docheader
$this->getButtons();
}
}