コード例 #1
0
 /**
  * Injects the request object for the current request or subrequest
  * Then checks for module functions that have hooked in, and renders menu etc.
  *
  * @param ServerRequestInterface $request the current request
  * @param ResponseInterface $response
  * @return ResponseInterface the response with the content
  */
 public function mainAction(ServerRequestInterface $request, ResponseInterface $response)
 {
     $GLOBALS['SOBE'] = $this;
     $this->init();
     // Checking for first level external objects
     $this->checkExtObj();
     // Checking second level external objects
     $this->checkSubExtObj();
     $this->main();
     $this->moduleTemplate->setContent($this->content);
     $response->getBody()->write($this->moduleTemplate->renderContent());
     return $response;
 }
コード例 #2
0
 /**
  * @return void
  */
 public function main()
 {
     if (!$this->access) {
         return;
     }
     $content = '';
     // render type by user func
     $typeRendered = false;
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'] as $classRef) {
             $typeRenderObj = GeneralUtility::getUserObj($classRef);
             if (is_object($typeRenderObj) && method_exists($typeRenderObj, 'isValid') && method_exists($typeRenderObj, 'render')) {
                 if ($typeRenderObj->isValid($this->type, $this)) {
                     $content .= $typeRenderObj->render($this->type, $this);
                     $typeRendered = true;
                     break;
                 }
             }
         }
     }
     if (!$typeRendered) {
         $content .= $this->renderPageTitle();
         $content .= $this->renderPreview();
         $content .= $this->renderPropertiesAsTable();
         $content .= $this->renderReferences();
         $content .= $this->renderBackButton();
     }
     $this->moduleTemplate->setContent($content);
 }
コード例 #3
0
 /**
  * @return void
  */
 public function main()
 {
     if (!$this->access) {
         return;
     }
     $content = '';
     // render type by user func
     $typeRendered = false;
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'] as $classRef) {
             $typeRenderObj = GeneralUtility::getUserObj($classRef);
             if (is_object($typeRenderObj) && method_exists($typeRenderObj, 'isValid') && method_exists($typeRenderObj, 'render')) {
                 if ($typeRenderObj->isValid($this->type, $this)) {
                     $content .= $typeRenderObj->render($this->type, $this);
                     $typeRendered = true;
                     break;
                 }
             }
         }
     }
     if (!$typeRendered) {
         // Rendering of the output via fluid
         $view = GeneralUtility::makeInstance(StandaloneView::class);
         $view->setTemplateRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates')]);
         $view->setPartialRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Partials')]);
         $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/ContentElement/ElementInformation.html'));
         $view->assignMultiple($this->getPageTitle());
         $view->assignMultiple($this->getPreview());
         $view->assignMultiple($this->getPropertiesForTable());
         $view->assignMultiple($this->getReferences());
         $view->assignMultiple($this->getBackButton());
         $content .= $view->render();
     }
     $this->moduleTemplate->setContent($content);
 }
コード例 #4
0
 /**
  * Injects the request object for the current request or subrequest
  * Simply calls main() and writes the content to the response
  *
  * @param ServerRequestInterface $request the current request
  * @param ResponseInterface $response
  * @return ResponseInterface the response with the content
  */
 public function mainAction(ServerRequestInterface $request, ResponseInterface $response)
 {
     $GLOBALS['SOBE'] = $this;
     $this->main();
     $this->moduleTemplate->setContent($this->content);
     $response->getBody()->write($this->moduleTemplate->renderContent());
     return $response;
 }
コード例 #5
0
 /**
  * Main function, rendering the folder tree
  *
  * @return void
  */
 public function main()
 {
     // Produce browse-tree:
     $tree = $this->foldertree->getBrowsableTree();
     // Outputting page tree:
     $this->moduleTemplate->setContent($tree);
     // Setting up the buttons
     $this->getButtons();
     // Build the <body> for the module
     $this->moduleTemplate->setTitle('TYPO3 Folder Tree');
     $this->content = $this->moduleTemplate->renderContent();
 }
コード例 #6
0
ファイル: index.php プロジェクト: girardiv/image_autoresize
 /**
  * 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;
 }
コード例 #7
0
 /**
  * Main function.
  * Creates some general objects and calls other functions for the main rendering of module content.
  *
  * @return void
  */
 public function main()
 {
     $lang = $this->getLanguageService();
     // Access check...
     // The page will show only if there is a valid page and if this page may be viewed by the user
     $access = is_array($this->pageinfo) ? 1 : 0;
     // Content
     $content = '';
     if ($this->id && $access) {
         // Initialize permission settings:
         $this->CALC_PERMS = $this->getBackendUser()->calcPerms($this->pageinfo);
         $this->EDIT_CONTENT = $this->pageIsNotLockedForEditors();
         $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
         // override the default jumpToUrl
         $this->moduleTemplate->addJavaScriptCode('jumpToUrl', '
             function jumpToUrl(URL,formEl) {
                 if (document.editform && TBE_EDITOR.isFormChanged)  {   // Check if the function exists... (works in all browsers?)
                     if (!TBE_EDITOR.isFormChanged()) {
                         window.location.href = URL;
                     } else if (formEl) {
                         if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
                     }
                 } else {
                     window.location.href = URL;
                 }
             }
         ');
         $this->moduleTemplate->addJavaScriptCode('mainJsFunctions', '
             if (top.fsMod) {
                 top.fsMod.recentIds["web"] = ' . (int) $this->id . ';
                 top.fsMod.navFrameHighlightedID["web"] = "pages' . (int) $this->id . '_"+top.fsMod.currentBank; ' . (int) $this->id . ';
             }
             ' . ($this->popView ? BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id)) : '') . '
             function deleteRecord(table,id,url) {   //
                 if (confirm(' . GeneralUtility::quoteJSvalue($lang->getLL('deleteWarning')) . ')) {
                     window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[') . '+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $this->getBackendUser()->veriCode() . '&prErr=1&uPT=1";
                 }
                 return false;
             }
         ');
         // Find backend layout / columns
         $backendLayout = GeneralUtility::callUserFunction(BackendLayoutView::class . '->getSelectedBackendLayout', $this->id, $this);
         if (!empty($backendLayout['__colPosList'])) {
             $this->colPosList = implode(',', $backendLayout['__colPosList']);
         }
         // Removing duplicates, if any
         $this->colPosList = array_unique(GeneralUtility::intExplode(',', $this->colPosList));
         // Accessible columns
         if (isset($this->modSharedTSconfig['properties']['colPos_list']) && trim($this->modSharedTSconfig['properties']['colPos_list']) !== '') {
             $this->activeColPosList = array_unique(GeneralUtility::intExplode(',', trim($this->modSharedTSconfig['properties']['colPos_list'])));
             // Match with the list which is present in the colPosList for the current page
             if (!empty($this->colPosList) && !empty($this->activeColPosList)) {
                 $this->activeColPosList = array_unique(array_intersect($this->activeColPosList, $this->colPosList));
             }
         } else {
             $this->activeColPosList = $this->colPosList;
         }
         $this->activeColPosList = implode(',', $this->activeColPosList);
         $this->colPosList = implode(',', $this->colPosList);
         $content .= $this->getHeaderFlashMessagesForCurrentPid();
         // Render the primary module content:
         if ($this->MOD_SETTINGS['function'] == 0) {
             // QuickEdit
             $content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db', ['prErr' => 1, 'uPT' => 1])) . '" method="post" enctype="multipart/form-data" name="editform" id="PageLayoutController" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
             $content .= $this->renderQuickEdit();
         } else {
             $content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl($this->moduleName, array('id' => $this->id, 'imagemode' => $this->imagemode))) . '" id="PageLayoutController" method="post">';
             // Page title
             $content .= '<h1 class="t3js-title-inlineedit">' . htmlspecialchars($this->getLocalizedPageTitle()) . '</h1>';
             // All other listings
             $content .= $this->renderListContent();
         }
         $content .= '</form>';
         $content .= $this->searchContent;
         // Setting up the buttons for the docheader
         $this->makeButtons($this->MOD_SETTINGS['function'] == 0 ? 'quickEdit' : '');
         // Create LanguageMenu
         $this->makeLanguageMenu();
     } else {
         $this->moduleTemplate->addJavaScriptCode('mainJsFunctions', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
         $content .= '<h1>' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . '</h1>';
         $view = GeneralUtility::makeInstance(StandaloneView::class);
         $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/InfoBox.html'));
         $view->assignMultiple(array('title' => $lang->getLL('clickAPage_header'), 'message' => $lang->getLL('clickAPage_content'), 'state' => InfoboxViewHelper::STATE_INFO));
         $content .= $view->render();
     }
     // Set content
     $this->moduleTemplate->setContent($content);
 }
コード例 #8
0
 /**
  * Loads the template source and render the template.
  * If "layoutName" is set in a PostParseFacet callback, it will render the file with the given layout.
  *
  * Additionally amends the rendered template with a module template "frame"
  *
  * @param string $actionName If set, the view of the specified action will be rendered instead. Default is the action specified in the Request object
  * @return string Rendered Template
  * @api
  */
 public function render($actionName = null)
 {
     $actionViewContent = $this->templateView->render($actionName);
     $this->moduleTemplate->setContent($actionViewContent);
     return $this->moduleTemplate->renderContent();
 }