/** * 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; }
/** * 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 .= $this->moduleTemplate->spacer(5); $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(); }