/** * 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); $lang = $this->getLanguageService(); if ($this->id && $this->access) { $urlParameters = array('id' => $this->id, 'template' => 'all'); $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters); // 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 = '<form action="' . htmlspecialchars($aHref) . '" method="post" enctype="multipart/form-data" id="TypoScriptTemplateModuleController" name="editForm" class="form">'; $this->content .= $this->moduleTemplate->header($lang->getLL('moduleTitle')); $this->extObjContent(); // Setting up the buttons and markers for docheader $this->getButtons(); $this->generateMenu(); $this->content .= '</form>'; } 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->moduleTemplate->header($lang->getLL('moduleTitle')); $this->content .= '<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(); } }
/** * 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 .= '<div>' . $vContent . '</div>'; } $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->moduleTemplate->header($this->languageService->getLL('title')); } }