/**
  * The main method of the PlugIn
  * @param    string $content : The PlugIn content
  * @param    array $conf : The PlugIn configuration
  * @return    string The content that is displayed on the website
  */
 public function main($content, $conf)
 {
     $this->ms = GeneralUtility::milliseconds();
     $this->conf = $conf;
     $this->pi_setPiVarDefaults();
     $this->pi_loadLL();
     // Configuring so caching is not expected. This value means that no cHash params are ever set.
     // We do this, because it's a USER_INT object!
     $this->pi_USER_INT_obj = 1;
     // initializes plugin configuration
     $this->init();
     // init template for pi1
     $this->initFluidTemplate();
     // hook for initials
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'] as $_classRef) {
             $_procObj =& GeneralUtility::getUserObj($_classRef);
             $_procObj->addInitials($this);
         }
     }
     // get content for searchbox
     $this->getSearchboxContent();
     // assign variables and do the rendering
     $this->searchFormView->assignMultiple($this->fluidTemplateVariables);
     $htmlOutput = $this->searchFormView->render();
     return $htmlOutput;
 }
Exemple #2
0
 /**
  * Renders an ajax-enabled text field. Also adds required JS
  *
  * @param string $fieldName The field name in the form
  * @param string $table The table we render this selector for
  * @param string $field The field we render this selector for
  * @param array $row The row which is currently edited
  * @param array $config The TSconfig of the field
  * @param array $flexFormConfig If field is within flex form, this is the TCA config of the flex field
  * @throws \RuntimeException for incomplete incoming arguments
  * @return string The HTML code for the selector
  */
 public function renderSuggestSelector($fieldName, $table, $field, array $row, array $config, array $flexFormConfig = [])
 {
     $dataStructureIdentifier = '';
     if (!empty($flexFormConfig) && $flexFormConfig['config']['type'] === 'flex') {
         $fieldPattern = 'data[' . $table . '][' . $row['uid'] . '][';
         $flexformField = str_replace($fieldPattern, '', $fieldName);
         $flexformField = substr($flexformField, 0, -1);
         $field = str_replace([']['], '|', $flexformField);
         if (!isset($flexFormConfig['config']['dataStructureIdentifier'])) {
             throw new \RuntimeException('A data structure identifier must be set in [\'config\'] part of a flex form.' . ' This is usually added by TcaFlexPrepare data processor', 1478604742);
         }
         $dataStructureIdentifier = $flexFormConfig['config']['dataStructureIdentifier'];
     }
     // Get minimumCharacters from TCA
     $minChars = 0;
     if (isset($config['fieldConf']['config']['wizards']['suggest']['default']['minimumCharacters'])) {
         $minChars = (int) $config['fieldConf']['config']['wizards']['suggest']['default']['minimumCharacters'];
     }
     // Overwrite it with minimumCharacters from TSConfig if given
     if (isset($config['fieldTSConfig']['suggest.']['default.']['minimumCharacters'])) {
         $minChars = (int) $config['fieldTSConfig']['suggest.']['default.']['minimumCharacters'];
     }
     $minChars = $minChars > 0 ? $minChars : 2;
     // fetch the TCA field type to hand it over to the JS class
     $type = '';
     if (isset($config['fieldConf']['config']['type'])) {
         $type = $config['fieldConf']['config']['type'];
     }
     // Sign those parameters that come back in an ajax request to configure the search in searchAction()
     $hmac = GeneralUtility::hmac((string) $table . (string) $field . (string) $row['uid'] . (string) $row['pid'] . (string) $dataStructureIdentifier, 'formEngineSuggest');
     $this->view->assignMultiple(['placeholder' => 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.findRecord', 'fieldname' => $fieldName, 'table' => $table, 'field' => $field, 'uid' => $row['uid'], 'pid' => (int) $row['pid'], 'dataStructureIdentifier' => $dataStructureIdentifier, 'fieldtype' => $type, 'minchars' => (int) $minChars, 'hmac' => $hmac]);
     return $this->view->render();
 }
 /**
  * @param string $templateName
  * @param string $appExtensionKey
  * @return string
  */
 public function loadTemplateAction($templateName, $appExtensionKey)
 {
     $appTemplatesPath = sprintf(RoutesFileGenerator::APP_TEMPLATES_FOLDER, ExtensionManagementUtility::extPath($appExtensionKey));
     $templateFilePath = $appTemplatesPath . '/' . $templateName;
     if (!file_exists($templateFilePath)) {
         return '';
     } else {
         $this->view->setTemplatePathAndFilename($templateFilePath);
         return $this->view->render();
     }
 }
Exemple #4
0
 /**
  * Render avatar tag
  *
  * @param array $backendUser be_users record
  * @param int $size width and height of the image
  * @param bool $showIcon show the record icon
  * @return string
  */
 public function render(array $backendUser = null, int $size = 32, bool $showIcon = false)
 {
     if (!is_array($backendUser)) {
         $backendUser = $this->getBackendUser()->user;
     }
     // Icon
     $icon = '';
     if ($showIcon) {
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         $icon = $iconFactory->getIconForRecord('be_users', $backendUser, Icon::SIZE_SMALL)->render();
     }
     $image = $this->getImgTag($backendUser, $size);
     $this->view->assignMultiple(['image' => $image, 'icon' => $icon]);
     return $this->view->render();
 }
Exemple #5
0
 /**
  * Render the Plugin Info
  *
  * @param array $params
  * @param object $pObj
  * @return string
  */
 public function getExtensionSummary($params, &$pObj)
 {
     $data = GeneralUtility::xml2array($params['row']['pi_flexform']);
     $this->init($data);
     $this->getSelectedObjects($data);
     $this->fluidRenderer->assign($this->pluginMode, true);
     $this->fluidRenderer->assign('storageFolder', $this->getStorageFolder($data));
     $this->fluidRenderer->assign('gallery', $this->selectedGallery);
     $this->fluidRenderer->assign('album', $this->selectedAlbum);
     $this->fluidRenderer->assign('item', $this->selectedItem);
     $this->fluidRenderer->assign('caLabel', 'LLL:EXT:yag/Resources/Private/Language/locallang.xlf:tx_yag_flexform_controllerAction.' . $this->pluginMode);
     $this->fluidRenderer->assign('theme', $this->theme);
     $this->fluidRenderer->assign('context', $this->getDataValue($data, 'settings.contextIdentifier'));
     return $this->fluidRenderer->render();
 }
 /**
  * Main functions, is rendering the content
  *
  * @return void
  */
 public function main()
 {
     switch ($this->MOD_SETTINGS['function']) {
         case 'search':
             $templateFilename = 'CustomSearch.html';
             $this->func_search();
             break;
         case 'records':
             $templateFilename = 'RecordStatistics.html';
             $this->func_records();
             break;
         case 'relations':
             $templateFilename = 'Relations.html';
             $this->func_relations();
             break;
         case 'refindex':
             $templateFilename = 'ReferenceIndex.html';
             $this->func_refindex();
             break;
         default:
             $templateFilename = 'IntegrityOverview.html';
             $this->func_default();
     }
     $this->view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($this->templatePath . $templateFilename));
     $this->content = $this->view->render();
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => $this->getFuncMenu(), 'CONTENT' => $this->content);
     // Build the <body> for the module
     $this->content = $this->doc->moduleBody(array(), $docHeaderButtons, $markers);
     // Renders the module page
     $this->content = $this->doc->render($this->getLanguageService()->getLL('title'), $this->content);
 }
Exemple #7
0
 /**
  * Main functions, is rendering the content
  *
  * @return void
  */
 public function main()
 {
     switch ($this->MOD_SETTINGS['function']) {
         case 'search':
             $templateFilename = 'CustomSearch.html';
             $this->func_search();
             break;
         case 'records':
             $templateFilename = 'RecordStatistics.html';
             $this->func_records();
             break;
         case 'relations':
             $templateFilename = 'Relations.html';
             $this->func_relations();
             break;
         case 'refindex':
             $templateFilename = 'ReferenceIndex.html';
             $this->func_refindex();
             break;
         default:
             $templateFilename = 'IntegrityOverview.html';
             $this->func_default();
     }
     $this->view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($this->templatePath . $templateFilename));
     $this->content = '<form action="" method="post" id="DatabaseIntegrityView" name="' . $this->formName . '">';
     $this->content .= $this->view->render();
     $this->content .= '</form>';
     // Setting up the shortcut button for docheader
     $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
     // Shortcut
     $shortCutButton = $buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setDisplayName($this->MOD_MENU['function'][$this->MOD_SETTINGS['function']])->setSetVariables(['function', 'search', 'search_query_makeQuery']);
     $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT, 2);
     $this->getModuleMenu();
 }
 public function main()
 {
     $result = $error = $url = NULL;
     $this->view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($this->templatePath . 'Main.html'));
     if ($this->configuration->isValid()) {
         try {
             $this->checkPageId();
             $url = $this->urlService->getFullUrl($this->pageId, $this->pObj->MOD_SETTINGS);
             if (GeneralUtility::_GET('clear')) {
                 $this->pageSpeedRepository->clearByIdentifier($url);
                 $this->view->assign('cacheCleared', TRUE);
             }
             $result = $this->pageSpeedRepository->findByIdentifier($url);
         } catch (\HTTP_Request2_ConnectionException $e) {
             $error = 'error.http_request.connection';
             // todo add log
         } catch (\RuntimeException $e) {
             $error = $e->getMessage();
         }
     } else {
         $error = 'error.invalid.key';
     }
     $this->view->assignMultiple(array('lll' => 'LLL:EXT:page_speed/Resources/Private/Language/locallang.xlf:', 'menu' => $this->modifyFuncMenu(BackendUtility::getFuncMenu($this->pObj->id, 'SET[language]', $this->pObj->MOD_SETTINGS['language'], $this->pObj->MOD_MENU['language']), 'language'), 'configuration' => $this->configuration, 'result' => $result, 'url' => $url, 'error' => $error, 'pageId' => $this->pageId));
     return $this->view->render();
 }
 /**
  * @param string $viewHelperTemplate
  * @param string $expectedOutput
  *
  * @test
  * @dataProvider viewHelperTemplateSourcesDataProvider
  */
 public function renderingTest($viewHelperTemplate, $expectedOutput)
 {
     $view = new StandaloneView();
     $view->getRenderingContext()->getViewHelperResolver()->addNamespace('ft', 'TYPO3Fluid\\FluidTest\\ViewHelpers');
     $view->getRenderingContext()->getTemplatePaths()->setTemplateSource($viewHelperTemplate);
     $view->assign('settings', ['test' => '<strong>Bla</strong>']);
     $this->assertSame($expectedOutput, $view->render());
 }
Exemple #10
0
 /**
  * Prints the clipboard
  *
  * @return string HTML output
  * @throws \BadFunctionCallException
  */
 public function printClipboard()
 {
     $languageService = $this->getLanguageService();
     $elementCount = count($this->elFromTable($this->fileMode ? '_FILE' : ''));
     // Copymode Selector menu
     $copymodeUrl = GeneralUtility::linkThisScript();
     $this->view->assign('actionCopyModeUrl', htmlspecialchars(GeneralUtility::quoteJSvalue($copymodeUrl . '&CB[setCopyMode]=')));
     $this->view->assign('actionCopyModeUrl1', htmlspecialchars(GeneralUtility::quoteJSvalue($copymodeUrl . '&CB[setCopyMode]=1')));
     $this->view->assign('currentMode', $this->currentMode());
     $this->view->assign('elementCount', $elementCount);
     if ($elementCount) {
         $removeAllUrl = GeneralUtility::linkThisScript(['CB' => ['removeAll' => $this->current]]);
         $this->view->assign('removeAllUrl', $removeAllUrl);
         // Selector menu + clear button
         $optionArray = [];
         // Import / Export link:
         if (ExtensionManagementUtility::isLoaded('impexp')) {
             $url = BackendUtility::getModuleUrl('xMOD_tximpexp', $this->exportClipElementParameters());
             $optionArray[] = ['label' => $this->clLabel('export', 'rm'), 'uri' => $url];
         }
         // Edit:
         if (!$this->fileMode) {
             $optionArray[] = ['label' => $this->clLabel('edit', 'rm'), 'uri' => '#', 'additionalAttributes' => ['onclick' => htmlspecialchars('window.location.href=' . GeneralUtility::quoteJSvalue($this->editUrl() . '&returnUrl=') . '+top.rawurlencode(window.location.href);')]];
         }
         // Delete referenced elements:
         $confirmationCheck = false;
         if ($this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)) {
             $confirmationCheck = true;
         }
         $confirmationMessage = sprintf($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:mess.deleteClip'), $elementCount);
         $title = $languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.clipboard.delete_elements');
         $returnUrl = $this->deleteUrl(1, $this->fileMode ? 1 : 0);
         $btnOkText = $languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:buttons.confirm.delete_elements.yes');
         $btnCancelText = $languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:buttons.confirm.delete_elements.no');
         $optionArray[] = ['label' => htmlspecialchars($title), 'uri' => $returnUrl, 'additionalAttributes' => ['class' => $confirmationCheck ? 't3js-modal-trigger' : ''], 'data' => ['severity' => 'warning', 'button-close-text' => htmlspecialchars($btnCancelText), 'button-ok-text' => htmlspecialchars($btnOkText), 'content' => htmlspecialchars($confirmationMessage), 'title' => htmlspecialchars($title)]];
         // Clear clipboard
         $optionArray[] = ['label' => $languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.clipboard.clear_clipboard', true), 'uri' => $removeAllUrl . '#clip_head'];
         $this->view->assign('optionArray', $optionArray);
     }
     // Print header and content for the NORMAL tab:
     $this->view->assign('current', $this->current);
     $tabArray = [];
     $tabArray['normal'] = ['id' => 'normal', 'number' => 0, 'url' => GeneralUtility::linkThisScript(['CB' => ['setP' => 'normal']]), 'description' => 'normal-description', 'label' => 'labels.normal', 'padding' => $this->padTitle('normal')];
     if ($this->current == 'normal') {
         $tabArray['normal']['content'] = $this->getContentFromTab('normal');
     }
     // Print header and content for the NUMERIC tabs:
     for ($a = 1; $a <= $this->numberTabs; $a++) {
         $tabArray['tab_' . $a] = ['id' => 'tab_' . $a, 'number' => $a, 'url' => GeneralUtility::linkThisScript(['CB' => ['setP' => 'tab_' . $a]]), 'description' => 'cliptabs-description', 'label' => 'labels.cliptabs-name', 'padding' => $this->padTitle('tab_' . $a)];
         if ($this->current === 'tab_' . $a) {
             $tabArray['tab_' . $a]['content'] = $this->getContentFromTab('tab_' . $a);
         }
     }
     $this->view->assign('clipboardHeader', BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_clipboard', $this->clLabel('clipboard', 'buttons')));
     $this->view->assign('tabArray', $tabArray);
     return $this->view->render();
 }
 /**
  * The main method of the PlugIn
  * @param    string $content : The PlugIn content
  * @param    array $conf : The PlugIn configuration
  * @return    string The content that is displayed on the website
  */
 public function main($content, $conf)
 {
     $this->ms = GeneralUtility::milliseconds();
     $this->conf = $conf;
     $this->pi_setPiVarDefaults();
     // use pi1 locallang values, since all the frontend locallang values for
     // pi1, pi2 and pi3 are set in pi1 language file
     $this->pi_loadLL('EXT:ke_search/pi1/locallang.xml');
     // Configuring so caching is not expected. This value means that no cHash params are ever set.
     // We do this, because it's a USER_INT object!
     $this->pi_USER_INT_obj = 1;
     // initializes plugin configuration
     $this->init();
     if ($this->conf['resultPage'] != $GLOBALS['TSFE']->id) {
         $content = '<div id="textmessage">' . $this->pi_getLL('error_resultPage') . '</div>';
         return $this->pi_wrapInBaseClass($content);
     }
     // init template
     $this->initFluidTemplate();
     // hook for initials
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'] as $_classRef) {
             $_procObj =& GeneralUtility::getUserObj($_classRef);
             $_procObj->addInitials($this);
         }
     }
     // assign isEmptySearch to fluid templates
     $this->fluidTemplateVariables['isEmptySearch'] = $this->isEmptySearch;
     // render "no results"-message, "too short words"-message and finally the result list
     $this->getSearchResults();
     // number of results
     $this->fluidTemplateVariables['numberofresults'] = $this->numberOfResults;
     // render links for sorting, fluid template variables are filled in class tx_kesearch_lib_sorting
     $this->renderOrdering();
     // process query time
     $queryTime = GeneralUtility::milliseconds() - $GLOBALS['TSFE']->register['ke_search_queryStartTime'];
     $this->fluidTemplateVariables['queryTime'] = $queryTime;
     $this->fluidTemplateVariables['queryTimeText'] = sprintf($this->pi_getLL('query_time'), $queryTime);
     // render pagebrowser
     if ($GLOBALS['TSFE']->id == $this->conf['resultPage']) {
         if ($this->conf['pagebrowserOnTop'] || $this->conf['pagebrowserAtBottom']) {
             $this->renderPagebrowser();
         }
     }
     // hook: modifyResultList
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyResultList'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyResultList'] as $_classRef) {
             $_procObj =& GeneralUtility::getUserObj($_classRef);
             $_procObj->modifyResultList($this->fluidTemplateVariables, $this);
         }
     }
     // generate HTML output
     $this->resultListView->assignMultiple($this->fluidTemplateVariables);
     $htmlOutput = $this->resultListView->render();
     return $htmlOutput;
 }
 /**
  * Render drop down
  *
  * @return string Drop down HTML
  */
 public function getDropDown()
 {
     if (!$this->checkAccess()) {
         return '';
     }
     $request = $this->standaloneView->getRequest();
     $request->setControllerExtensionName('backend');
     $this->standaloneView->assignMultiple(array('installToolUrl' => BackendUtility::getModuleUrl('system_extinstall'), 'messages' => $this->systemMessages, 'count' => $this->totalCount > $this->maximumCountInBadge ? $this->maximumCountInBadge . '+' : $this->totalCount, 'severityBadgeClass' => $this->severityBadgeClass, 'systemInformation' => $this->systemInformation));
     return $this->standaloneView->render();
 }
 /**
  * Callback function for rendering quotes.
  *
  * @param string $matches PCRE matches.
  * @return string  The quote content.
  */
 protected function replaceCallback($matches)
 {
     $this->view->setControllerContext($this->controllerContext);
     $this->view->setTemplatePathAndFilename(File::replaceSiteRelPath($this->settings['template']));
     $tmp = $this->postRepository->findByUid((int) $matches[1]);
     if (!empty($tmp)) {
         $this->view->assign('post', $tmp);
     }
     $this->view->assign('quote', trim($matches[2]));
     return $this->view->render();
 }
 /**
  * renderContent renders sie given Fluidtemplate an adds the given data to the view helper.
  * Your templates have to be in "Resources/Private/Html/Content/"
  *
  * @param array  $data Daten für das Fluid-Template
  * @param string $templateFile
  *
  * @return string Content
  */
 public function renderContent($data, $templateFile)
 {
     if (file_exists($templateFile)) {
         $this->view->getRequest()->setControllerExtensionName($this->extKey);
         $this->view->setTemplatePathAndFilename($templateFile);
         $this->view->assign('data', $data);
         $content = $this->view->render();
     } else {
         $content = 'Could not load template!';
     }
     return $content;
 }
Exemple #15
0
    /**
     * 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 = ['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->view = $this->getFluidTemplateObject();
            $this->view->assign('moduleName', BackendUtility::getModuleUrl($this->moduleName));
            $this->view->assign('versionSelector', $this->moduleTemplate->getVersionSelector($this->id, 1));
            $this->view->assign('functionMenuModuleContent', $this->getExtObjContent());
            // Setting up the buttons and markers for docheader
            $this->getButtons();
            $this->generateMenu();
            $this->content .= $this->view->render();
        } else {
            // If no access or if ID == zero
            $this->content = $this->moduleTemplate->header($this->languageService->getLL('title'));
        }
    }
Exemple #16
0
 /**
  * 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);
     if ($this->pageinfo) {
         $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->view = $this->getFluidTemplateObject('func', 'func');
         $this->view->assign('moduleName', BackendUtility::getModuleUrl('web_func'));
         $this->view->assign('id', $this->id);
         $this->view->assign('versionSelector', $this->moduleTemplate->getVersionSelector($this->id, true));
         $this->view->assign('functionMenuModuleContent', $this->getExtObjContent());
         // Setting up the buttons and markers for docheader
         $this->getButtons();
         $this->generateMenu();
         $this->content .= $this->view->render();
     } else {
         // If no access or if ID == zero
         $title = $this->getLanguageService()->getLL('title');
         $message = $this->getLanguageService()->getLL('clickAPage_content');
         $this->view = $this->getFluidTemplateObject('func', 'func', 'InfoBox');
         $this->view->assignMultiple(['title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO]);
         $this->content = $this->view->render();
         // Setting up the buttons and markers for docheader
         $this->getButtons();
     }
 }
Exemple #17
0
 /**
  * Add sys_notes as additional content to the footer of the page module
  *
  * @param array $params
  * @param PageLayoutController $parentObject
  * @return string
  */
 public function render(array $params = array(), PageLayoutController $parentObject)
 {
     if ($parentObject->MOD_SETTINGS['function'] == 1) {
         $pageInfo = $parentObject->pageinfo;
         if ($this->pageCanBeIndexed($pageInfo)) {
             // template
             $this->loadCss();
             $this->loadJavascript();
             //load partial paths info from typoscript
             $this->view = GeneralUtility::makeInstance(StandaloneView::class);
             $this->view->setFormat('html');
             $this->view->getRequest()->setControllerExtensionName('cs_seo');
             $absoluteResourcesPath = ExtensionManagementUtility::extPath('cs_seo') . 'Resources/';
             $layoutPaths = [$absoluteResourcesPath . 'Private/Layouts/'];
             $partialPaths = [$absoluteResourcesPath . 'Private/Partials/'];
             // load partial paths info from TypoScript
             if ($this->isTYPO3VersionGreather6) {
                 /** @var ObjectManager $objectManager */
                 $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
                 /** @var ConfigurationManagerInterface $configurationManager */
                 $configurationManager = $objectManager->get(ConfigurationManagerInterface::class);
                 $tsSetup = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'csseo');
                 $layoutPaths = $tsSetup["view"]["layoutRootPaths"] ?: $layoutPaths;
                 $partialPaths = $tsSetup["view"]["partialRootPaths"] ?: $partialPaths;
             }
             $this->view->setLayoutRootPaths($layoutPaths);
             $this->view->setPartialRootPaths($partialPaths);
             $this->view->setTemplatePathAndFilename(ExtensionManagementUtility::extPath('cs_seo') . 'Resources/Private/Templates/PageHook.html');
             $results = $this->getResults($pageInfo, $parentObject->current_sys_language);
             $score = $results['Percentage'];
             unset($results['Percentage']);
             $this->view->assignMultiple(['score' => $score, 'results' => $results, 'page' => $parentObject->pageinfo]);
             return $this->view->render();
         }
     }
 }
 /**
  * Main function of class
  *
  * @return string HTML output
  */
 public function main()
 {
     $pageId = (int) GeneralUtility::_GP('id');
     if ($pageId === 0) {
         $this->view->assign('pageZero', 1);
         $this->view->assign('overviewOfPagesUsingTSConfig', $this->getOverviewOfPagesUsingTSConfig());
     } else {
         if ($this->pObj->MOD_SETTINGS['tsconf_parts'] == 99) {
             $TSparts = BackendUtility::getPagesTSconfig($this->pObj->id, null, true);
             $lines = array();
             $pUids = array();
             foreach ($TSparts as $k => $v) {
                 if ($k != 'uid_0') {
                     $line = array();
                     if ($k == 'defaultPageTSconfig') {
                         $line['defaultPageTSconfig'] = 1;
                     } else {
                         $pUids[] = substr($k, 4);
                         $row = BackendUtility::getRecordWSOL('pages', substr($k, 4));
                         $icon = $this->iconFactory->getIconForRecord('pages', $row, Icon::SIZE_SMALL);
                         $editIdList = substr($k, 4);
                         $urlParameters = ['edit' => ['pages' => [$editIdList => 'edit']], 'columnsOnly' => 'TSconfig', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
                         $line['editIcon'] = BackendUtility::getModuleUrl('record_edit', $urlParameters);
                         $line['editTitle'] = 'editTSconfig';
                         $line['title'] = BackendUtility::wrapClickMenuOnIcon($icon, 'pages', $row['uid']) . ' ' . htmlspecialchars(BackendUtility::getRecordTitle('pages', $row));
                     }
                     $tsparser = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::class);
                     $tsparser->lineNumberOffset = 0;
                     $line['content'] = $tsparser->doSyntaxHighlight(trim($v) . LF);
                     $lines[] = $line;
                 }
             }
             if (!empty($pUids)) {
                 $urlParameters = ['edit' => ['pages' => [implode(',', $pUids) => 'edit']], 'columnsOnly' => 'TSconfig', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
                 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
                 $editIcon = htmlspecialchars($url);
                 $editTitle = 'editTSconfig_all';
             } else {
                 $editIcon = '';
                 $editTitle = '';
             }
             $this->view->assign('tsconfParts99', 1);
             $this->view->assign('csh', BackendUtility::cshItem('_MOD_web_info', 'tsconfig_edit', null, '|'));
             $this->view->assign('lines', $lines);
             $this->view->assign('editIcon', $editIcon);
             $this->view->assign('editTitle', $editTitle);
         } else {
             $this->view->assign('tsconfParts99', 0);
             // Defined global here!
             $tmpl = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class);
             // Do not log time-performance information
             $tmpl->tt_track = 0;
             $tmpl->fixedLgd = 0;
             $tmpl->linkObjects = 0;
             $tmpl->bType = '';
             $tmpl->ext_expandAllNotes = 1;
             $tmpl->ext_noPMicons = 1;
             $beUser = $this->getBackendUser();
             switch ($this->pObj->MOD_SETTINGS['tsconf_parts']) {
                 case '1':
                     $modTSconfig = BackendUtility::getModTSconfig($this->pObj->id, 'mod');
                     break;
                 case '1a':
                     $modTSconfig = $beUser->getTSConfig('mod.web_layout', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1b':
                     $modTSconfig = $beUser->getTSConfig('mod.web_view', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1c':
                     $modTSconfig = $beUser->getTSConfig('mod.web_modules', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1d':
                     $modTSconfig = $beUser->getTSConfig('mod.web_list', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1e':
                     $modTSconfig = $beUser->getTSConfig('mod.web_info', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1f':
                     $modTSconfig = $beUser->getTSConfig('mod.web_func', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1g':
                     $modTSconfig = $beUser->getTSConfig('mod.web_ts', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '2':
                     $modTSconfig = $beUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '5':
                     $modTSconfig = $beUser->getTSConfig('TCEFORM', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '6':
                     $modTSconfig = $beUser->getTSConfig('TCEMAIN', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '3':
                     $modTSconfig = $beUser->getTSConfig('TSFE', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '4':
                     $modTSconfig = $beUser->getTSConfig('user', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 default:
                     $modTSconfig['properties'] = BackendUtility::getPagesTSconfig($this->pObj->id);
             }
             $modTSconfig = $modTSconfig['properties'];
             if (!is_array($modTSconfig)) {
                 $modTSconfig = array();
             }
             $this->view->assign('csh', BackendUtility::cshItem('_MOD_web_info', 'tsconfig_hierarchy', null, '|'));
             $this->view->assign('tree', $tmpl->ext_getObjTree($modTSconfig, '', '', '', '', $this->pObj->MOD_SETTINGS['tsconf_alphaSort']));
         }
         $this->view->assign('alphaSort', BackendUtility::getFuncCheck($this->pObj->id, 'SET[tsconf_alphaSort]', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'], '', '', 'id="checkTsconf_alphaSort"'));
         $this->view->assign('dropdownMenu', BackendUtility::getDropdownMenu($this->pObj->id, 'SET[tsconf_parts]', $this->pObj->MOD_SETTINGS['tsconf_parts'], $this->pObj->MOD_MENU['tsconf_parts']));
     }
     return $this->view->render();
 }
 /**
  * Render fluid standalone view
  *
  * @return string
  */
 protected function renderFluidView()
 {
     return $this->view->render();
 }
 /**
  * Render the warning markup when the page record has not been saved yet
  *
  * @return string The warning markup
  */
 protected function renderSaveWarning()
 {
     $this->view->setTemplate('SaveWarning');
     return $this->view->render();
 }
 /**
  * @return string
  */
 protected function renderViewForMail()
 {
     $view = new StandaloneView();
     $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:pt_extbase/Resources/Private/Templates/Logger/ErrorEmail.html'));
     $view->assign('logRecord', $this->logRecord);
     $view->assign('serverInformation', $this->serverInformation);
     $view->assign('userAgent', $this->userAgent);
     $view->assign('requestId', $this->requestInformation->getCurrentRequestId());
     return $view->render();
 }
Exemple #22
0
 /**
  * Returns the fully rendered view
  *
  * @return string
  */
 public function renderContent()
 {
     $this->setupPage();
     $this->pageRenderer->setTitle($this->title);
     $this->loadJavaScripts();
     $this->setJavaScriptCodeArray();
     $this->loadStylesheets();
     $this->view->assign('docHeader', $this->docHeaderComponent->docHeaderContent());
     if ($this->moduleId) {
         $this->view->assign('moduleId', $this->moduleId);
     }
     if ($this->moduleName) {
         $this->view->assign('moduleName', $this->moduleName);
     }
     $renderedPage = $this->pageRenderer->render(PageRenderer::PART_HEADER);
     $renderedPage .= $this->view->render();
     $this->pageRenderer->addJsFooterInlineCode('updateSignals', BackendUtility::getUpdateSignalCode());
     $renderedPage .= $this->pageRenderer->render(PageRenderer::PART_FOOTER);
     return $renderedPage;
 }
 /**
  * Main function
  *
  * @return void
  */
 public function main()
 {
     /** @var ArrayBrowser $arrayBrowser */
     $arrayBrowser = GeneralUtility::makeInstance(ArrayBrowser::class);
     $label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
     $search_field = GeneralUtility::_GP('search_field');
     $templatePathAndFilename = GeneralUtility::getFileAbsFileName('EXT:lowlevel/Resources/Private/Templates/Backend/Configuration.html');
     $this->view->setTemplatePathAndFilename($templatePathAndFilename);
     $this->view->assign('label', $label);
     $this->view->assign('search_field', $search_field);
     $this->view->assign('checkbox_checkRegexsearch', BackendUtility::getFuncCheck(0, 'SET[regexsearch]', $this->MOD_SETTINGS['regexsearch'], '', '', 'id="checkRegexsearch"'));
     switch ($this->MOD_SETTINGS['function']) {
         case 0:
             $theVar = $GLOBALS['TYPO3_CONF_VARS'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TYPO3_CONF_VARS';
             break;
         case 1:
             $theVar = $GLOBALS['TCA'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TCA';
             break;
         case 2:
             $theVar = $GLOBALS['TCA_DESCR'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TCA_DESCR';
             break;
         case 3:
             $theVar = $GLOBALS['TYPO3_LOADED_EXT'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TYPO3_LOADED_EXT';
             break;
         case 4:
             $theVar = $GLOBALS['T3_SERVICES'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$T3_SERVICES';
             break;
         case 5:
             $theVar = $GLOBALS['TBE_MODULES'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TBE_MODULES';
             break;
         case 6:
             $theVar = $GLOBALS['TBE_MODULES_EXT'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TBE_MODULES_EXT';
             break;
         case 7:
             $theVar = $GLOBALS['TBE_STYLES'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TBE_STYLES';
             break;
         case 8:
             $theVar = $GLOBALS['BE_USER']->uc;
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$BE_USER->uc';
             break;
         case 9:
             $theVar = $GLOBALS['TYPO3_USER_SETTINGS'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TYPO3_USER_SETTINGS';
             break;
         default:
             $theVar = array();
     }
     // Update node:
     $update = 0;
     $node = GeneralUtility::_GET('node');
     // If any plus-signs were clicked, it's registered.
     if (is_array($node)) {
         $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]);
         $update = 1;
     }
     if ($update) {
         $this->getBackendUser()->pushModuleData($this->moduleName, $this->MOD_SETTINGS);
     }
     $arrayBrowser->dontLinkVar = true;
     $arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']];
     $arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
     $arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
     $arrayBrowser->searchKeysToo = true;
     // If any POST-vars are send, update the condition array
     if (GeneralUtility::_POST('search') && trim($search_field)) {
         $arrayBrowser->depthKeys = $arrayBrowser->getSearchKeys($theVar, '', $search_field, array());
     }
     // mask sensitive information
     $varName = trim($arrayBrowser->varName, '$');
     if (isset($this->blindedConfigurationOptions[$varName])) {
         ArrayUtility::mergeRecursiveWithOverrule($theVar, $this->blindedConfigurationOptions[$varName]);
     }
     $tree = $arrayBrowser->tree($theVar, '', '');
     $this->view->assign('tree', $tree);
     // Setting up the shortcut button for docheader
     $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
     // Shortcut
     $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setDisplayName($this->MOD_MENU['function'][$this->MOD_SETTINGS['function']])->setSetVariables(['function']);
     $buttonBar->addButton($shortcutButton);
     $this->getModuleMenu();
     $this->content = '<form action="" id="ConfigurationView" method="post">';
     $this->content .= $this->view->render();
     $this->content .= '</form>';
 }
 /**
  * Assemble display of list of scheduled tasks
  *
  * @return string Table of pending tasks
  */
 protected function listTasksAction()
 {
     $this->view->setTemplatePathAndFilename($this->backendTemplatePath . 'ListTasks.html');
     // Define display format for dates
     $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
     // Get list of registered classes
     $registeredClasses = $this->getRegisteredClasses();
     // Get list of registered task groups
     $registeredTaskGroups = $this->getRegisteredTaskGroups();
     // add an empty entry for non-grouped tasks
     // add in front of list
     array_unshift($registeredTaskGroups, array('uid' => 0, 'groupName' => ''));
     // Get all registered tasks
     // Just to get the number of entries
     $query = array('SELECT' => '
             tx_scheduler_task.*,
             tx_scheduler_task_group.groupName as taskGroupName,
             tx_scheduler_task_group.description as taskGroupDescription,
             tx_scheduler_task_group.deleted as isTaskGroupDeleted
             ', 'FROM' => '
             tx_scheduler_task
             LEFT JOIN tx_scheduler_task_group ON tx_scheduler_task_group.uid = tx_scheduler_task.task_group
             ', 'WHERE' => '1=1', 'ORDERBY' => 'tx_scheduler_task_group.sorting');
     $res = $this->getDatabaseConnection()->exec_SELECT_queryArray($query);
     $numRows = $this->getDatabaseConnection()->sql_num_rows($res);
     // No tasks defined, display information message
     if ($numRows == 0) {
         $this->view->setTemplatePathAndFilename($this->backendTemplatePath . 'ListTasksNoTasks.html');
         return $this->view->render();
     } else {
         $this->getPageRenderer()->loadJquery();
         $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Scheduler/Scheduler');
         $table = array();
         // Header row
         $table[] = '<thead><tr>' . '<th><a href="#" id="checkall" title="' . $this->getLanguageService()->getLL('label.checkAll', true) . '" class="icon">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-select', Icon::SIZE_SMALL)->render() . '</a></th>' . '<th>' . $this->getLanguageService()->getLL('label.id', true) . '</th>' . '<th>' . $this->getLanguageService()->getLL('task', true) . '</th>' . '<th>' . $this->getLanguageService()->getLL('label.type', true) . '</th>' . '<th>' . $this->getLanguageService()->getLL('label.frequency', true) . '</th>' . '<th>' . $this->getLanguageService()->getLL('label.parallel', true) . '</th>' . '<th>' . $this->getLanguageService()->getLL('label.lastExecution', true) . '</th>' . '<th>' . $this->getLanguageService()->getLL('label.nextExecution', true) . '</th>' . '<th></th>' . '</tr></thead>';
         // Loop on all tasks
         $temporaryResult = array();
         while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
             if ($row['taskGroupName'] === null || $row['isTaskGroupDeleted'] === '1') {
                 $row['taskGroupName'] = '';
                 $row['taskGroupDescription'] = '';
                 $row['task_group'] = 0;
             }
             $temporaryResult[$row['task_group']]['groupName'] = $row['taskGroupName'];
             $temporaryResult[$row['task_group']]['groupDescription'] = $row['taskGroupDescription'];
             $temporaryResult[$row['task_group']]['tasks'][] = $row;
         }
         $registeredClasses = $this->getRegisteredClasses();
         foreach ($temporaryResult as $taskGroup) {
             if (!empty($taskGroup['groupName'])) {
                 $groupText = '<strong>' . htmlspecialchars($taskGroup['groupName']) . '</strong>';
                 if (!empty($taskGroup['groupDescription'])) {
                     $groupText .= '<br>' . nl2br(htmlspecialchars($taskGroup['groupDescription']));
                 }
                 $table[] = '<tr><td colspan="9">' . $groupText . '</td></tr>';
             }
             foreach ($taskGroup['tasks'] as $schedulerRecord) {
                 // Define action icons
                 $link = htmlspecialchars($this->moduleUri . '&CMD=edit&tx_scheduler[uid]=' . $schedulerRecord['uid']);
                 $editAction = '<a class="btn btn-default" href="' . $link . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:edit', true) . '" class="icon">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
                 if ((int) $schedulerRecord['disable'] === 1) {
                     $translationKey = 'enable';
                     $icon = $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-unhide', Icon::SIZE_SMALL);
                 } else {
                     $translationKey = 'disable';
                     $icon = $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-hide', Icon::SIZE_SMALL);
                 }
                 $toggleHiddenAction = '<a class="btn btn-default" href="' . htmlspecialchars($this->moduleUri . '&CMD=toggleHidden&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:' . $translationKey, true) . '" class="icon">' . $icon->render() . '</a>';
                 $deleteAction = '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars($this->moduleUri . '&CMD=delete&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" ' . ' data-severity="warning"' . ' data-title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:delete', true) . '"' . ' data-button-close-text="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:cancel', true) . '"' . ' data-content="' . $this->getLanguageService()->getLL('msg.delete', true) . '"' . ' title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:delete', true) . '" class="icon">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
                 $stopAction = '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars($this->moduleUri . '&CMD=stop&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" ' . ' data-severity="warning"' . ' data-title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:stop', true) . '"' . ' data-button-close-text="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:cancel', true) . '"' . ' data-content="' . $this->getLanguageService()->getLL('msg.stop', true) . '"' . ' title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:stop', true) . '" class="icon">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-close', Icon::SIZE_SMALL)->render() . '</a>';
                 $runAction = '<a class="btn btn-default" href="' . htmlspecialchars($this->moduleUri . '&tx_scheduler[execute][]=' . $schedulerRecord['uid']) . '" title="' . $this->getLanguageService()->getLL('action.run_task', true) . '" class="icon">' . $this->moduleTemplate->getIconFactory()->getIcon('extensions-scheduler-run-task', Icon::SIZE_SMALL)->render() . '</a>';
                 // Define some default values
                 $lastExecution = '-';
                 $isRunning = false;
                 $showAsDisabled = false;
                 $startExecutionElement = '<span class="btn btn-default disabled">' . $this->moduleTemplate->getIconFactory()->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
                 // Restore the serialized task and pass it a reference to the scheduler object
                 /** @var $task \TYPO3\CMS\Scheduler\Task\AbstractTask|\TYPO3\CMS\Scheduler\ProgressProviderInterface */
                 $task = unserialize($schedulerRecord['serialized_task_object']);
                 $class = get_class($task);
                 if ($class === '__PHP_Incomplete_Class' && preg_match('/^O:[0-9]+:"(?P<classname>.+?)"/', $schedulerRecord['serialized_task_object'], $matches) === 1) {
                     $class = $matches['classname'];
                 }
                 // Assemble information about last execution
                 if (!empty($schedulerRecord['lastexecution_time'])) {
                     $lastExecution = date($dateFormat, $schedulerRecord['lastexecution_time']);
                     if ($schedulerRecord['lastexecution_context'] == 'CLI') {
                         $context = $this->getLanguageService()->getLL('label.cron');
                     } else {
                         $context = $this->getLanguageService()->getLL('label.manual');
                     }
                     $lastExecution .= ' (' . $context . ')';
                 }
                 if (isset($registeredClasses[get_class($task)]) && $this->scheduler->isValidTaskObject($task)) {
                     // The task object is valid
                     $labels = array();
                     $name = htmlspecialchars($registeredClasses[$class]['title'] . ' (' . $registeredClasses[$class]['extension'] . ')');
                     $additionalInformation = $task->getAdditionalInformation();
                     if ($task instanceof \TYPO3\CMS\Scheduler\ProgressProviderInterface) {
                         $progress = round(floatval($task->getProgress()), 2);
                         $name .= $this->renderTaskProgressBar($progress);
                     }
                     if (!empty($additionalInformation)) {
                         $name .= '<div class="additional-information">' . nl2br(htmlspecialchars($additionalInformation)) . '</div>';
                     }
                     // Check if task currently has a running execution
                     if (!empty($schedulerRecord['serialized_executions'])) {
                         $labels[] = array('class' => 'success', 'text' => $this->getLanguageService()->getLL('status.running'));
                         $isRunning = true;
                     }
                     // Prepare display of next execution date
                     // If task is currently running, date is not displayed (as next hasn't been calculated yet)
                     // Also hide the date if task is disabled (the information doesn't make sense, as it will not run anyway)
                     if ($isRunning || $schedulerRecord['disable']) {
                         $nextDate = '-';
                     } else {
                         $nextDate = date($dateFormat, $schedulerRecord['nextexecution']);
                         if (empty($schedulerRecord['nextexecution'])) {
                             $nextDate = $this->getLanguageService()->getLL('none');
                         } elseif ($schedulerRecord['nextexecution'] < $GLOBALS['EXEC_TIME']) {
                             $labels[] = array('class' => 'warning', 'text' => $this->getLanguageService()->getLL('status.late'), 'description' => $this->getLanguageService()->getLL('status.legend.scheduled'));
                         }
                     }
                     // Get execution type
                     if ($task->getType() === AbstractTask::TYPE_SINGLE) {
                         $execType = $this->getLanguageService()->getLL('label.type.single');
                         $frequency = '-';
                     } else {
                         $execType = $this->getLanguageService()->getLL('label.type.recurring');
                         if ($task->getExecution()->getCronCmd() == '') {
                             $frequency = $task->getExecution()->getInterval();
                         } else {
                             $frequency = $task->getExecution()->getCronCmd();
                         }
                     }
                     // Get multiple executions setting
                     if ($task->getExecution()->getMultiple()) {
                         $multiple = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:yes');
                     } else {
                         $multiple = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:no');
                     }
                     // Define checkbox
                     $startExecutionElement = '<label class="btn btn-default btn-checkbox"><input type="checkbox" name="tx_scheduler[execute][]" value="' . $schedulerRecord['uid'] . '" id="task_' . $schedulerRecord['uid'] . '"><span class="t3-icon fa"></span></label>';
                     $actions = $editAction . $toggleHiddenAction . $deleteAction;
                     // Check the disable status
                     // Row is shown dimmed if task is disabled, unless it is still running
                     if ($schedulerRecord['disable'] && !$isRunning) {
                         $labels[] = array('class' => 'default', 'text' => $this->getLanguageService()->getLL('status.disabled'));
                         $showAsDisabled = true;
                     }
                     // Show no action links (edit, delete) if task is running
                     if ($isRunning) {
                         $actions = $stopAction;
                     } else {
                         $actions .= $runAction;
                     }
                     // Check if the last run failed
                     if (!empty($schedulerRecord['lastexecution_failure'])) {
                         // Try to get the stored exception array
                         /** @var $exceptionArray array */
                         $exceptionArray = @unserialize($schedulerRecord['lastexecution_failure']);
                         // If the exception could not be unserialized, issue a default error message
                         if (!is_array($exceptionArray) || empty($exceptionArray)) {
                             $labelDescription = $this->getLanguageService()->getLL('msg.executionFailureDefault');
                         } else {
                             $labelDescription = sprintf($this->getLanguageService()->getLL('msg.executionFailureReport'), $exceptionArray['code'], $exceptionArray['message']);
                         }
                         $labels[] = array('class' => 'danger', 'text' => $this->getLanguageService()->getLL('status.failure'), 'description' => $labelDescription);
                     }
                     // Format the execution status,
                     // including failure feedback, if any
                     $taskDesc = '';
                     if ($schedulerRecord['description'] !== '') {
                         $taskDesc = '<span class="description">' . nl2br(htmlspecialchars($schedulerRecord['description'])) . '</span>';
                     }
                     $taskName = '<span class="name"><a href="' . $link . '">' . $name . '</a></span>';
                     $table[] = '<tr class="' . ($showAsDisabled ? 'disabled' : '') . '">' . '<td>' . $startExecutionElement . '</td>' . '<td class="right">' . $schedulerRecord['uid'] . '</td>' . '<td>' . $this->makeStatusLabel($labels) . $taskName . $taskDesc . '</td>' . '<td>' . $execType . '</td>' . '<td>' . $frequency . '</td>' . '<td>' . $multiple . '</td>' . '<td>' . $lastExecution . '</td>' . '<td>' . $nextDate . '</td>' . '<td nowrap="nowrap"><div class="btn-group" role="group">' . $actions . '</div></td>' . '</tr>';
                 } else {
                     // The task object is not valid
                     // Prepare to issue an error
                     $executionStatusOutput = '<span class="label label-danger">' . htmlspecialchars(sprintf($this->getLanguageService()->getLL('msg.invalidTaskClass'), $class)) . '</span>';
                     $table[] = '<tr>' . '<td>' . $startExecutionElement . '</td>' . '<td class="right">' . $schedulerRecord['uid'] . '</td>' . '<td colspan="6">' . $executionStatusOutput . '</td>' . '<td nowrap="nowrap"><div class="btn-group" role="group">' . '<span class="btn btn-default disabled">' . $this->moduleTemplate->getIconFactory()->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>' . '<span class="btn btn-default disabled">' . $this->moduleTemplate->getIconFactory()->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>' . $deleteAction . '<span class="btn btn-default disabled">' . $this->moduleTemplate->getIconFactory()->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>' . '</div></td>' . '</tr>';
                 }
             }
         }
         $this->getDatabaseConnection()->sql_free_result($res);
         $this->view->assign('table', '<table class="table table-striped table-hover">' . implode(LF, $table) . '</table>');
         // Server date time
         $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] . ' T (e';
         $this->view->assign('now', date($dateFormat) . ', GMT ' . date('P') . ')');
     }
     return $this->view->render();
 }
 /**
  * @test
  * @expectedException \TYPO3\CMS\Fluid\View\Exception\InvalidTemplateResourceException
  */
 public function renderThrowsExceptionIfSpecifiedTemplateFileDoesNotExist()
 {
     $this->view->setTemplatePathAndFilename('NonExistingTemplatePath');
     @$this->view->render();
 }
 /**
  * Main function
  *
  * @return void
  */
 public function main()
 {
     /** @var ArrayBrowser $arrayBrowser */
     $arrayBrowser = GeneralUtility::makeInstance(ArrayBrowser::class);
     $label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
     $search_field = GeneralUtility::_GP('search_field');
     $templatePathAndFilename = GeneralUtility::getFileAbsFileName('EXT:lowlevel/Resources/Private/Templates/Backend/Configuration.html');
     $this->view->setTemplatePathAndFilename($templatePathAndFilename);
     $this->view->assign('label', $label);
     $this->view->assign('search_field', $search_field);
     $this->view->assign('checkbox_checkRegexsearch', BackendUtility::getFuncCheck(0, 'SET[regexsearch]', $this->MOD_SETTINGS['regexsearch'], '', '', 'id="checkRegexsearch"'));
     switch ($this->MOD_SETTINGS['function']) {
         case 0:
             $theVar = $GLOBALS['TYPO3_CONF_VARS'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TYPO3_CONF_VARS';
             break;
         case 1:
             $theVar = $GLOBALS['TCA'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TCA';
             break;
         case 2:
             $theVar = $GLOBALS['TCA_DESCR'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TCA_DESCR';
             break;
         case 3:
             $theVar = $GLOBALS['TYPO3_LOADED_EXT'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TYPO3_LOADED_EXT';
             break;
         case 4:
             $theVar = $GLOBALS['T3_SERVICES'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$T3_SERVICES';
             break;
         case 5:
             $theVar = $GLOBALS['TBE_MODULES'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TBE_MODULES';
             break;
         case 6:
             $theVar = $GLOBALS['TBE_MODULES_EXT'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TBE_MODULES_EXT';
             break;
         case 7:
             $theVar = $GLOBALS['TBE_STYLES'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TBE_STYLES';
             break;
         case 8:
             $theVar = $GLOBALS['BE_USER']->uc;
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$BE_USER->uc';
             break;
         case 9:
             $theVar = $GLOBALS['TYPO3_USER_SETTINGS'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TYPO3_USER_SETTINGS';
             break;
         default:
             $theVar = array();
     }
     // Update node:
     $update = 0;
     $node = GeneralUtility::_GET('node');
     // If any plus-signs were clicked, it's registred.
     if (is_array($node)) {
         $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]);
         $update = 1;
     }
     if ($update) {
         $this->getBackendUser()->pushModuleData($this->moduleName, $this->MOD_SETTINGS);
     }
     $arrayBrowser->dontLinkVar = TRUE;
     $arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']];
     $arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
     $arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
     $arrayBrowser->searchKeysToo = TRUE;
     // If any POST-vars are send, update the condition array
     if (GeneralUtility::_POST('search') && trim($search_field)) {
         $arrayBrowser->depthKeys = $arrayBrowser->getSearchKeys($theVar, '', $search_field, array());
     }
     // mask the encryption key to not show it as plaintext in the configuration module
     if ($theVar == $GLOBALS['TYPO3_CONF_VARS']) {
         $theVar['SYS']['encryptionKey'] = '***** (length: ' . strlen($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']) . ' characters)';
     }
     $tree = $arrayBrowser->tree($theVar, '', '');
     $this->view->assign('tree', $tree);
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => $this->getFuncMenu(), 'CONTENT' => $this->view->render());
     // Build the <body> for the module
     $this->content = $this->doc->moduleBody(array(), $docHeaderButtons, $markers);
     // Renders the module page
     $this->content = $this->doc->render('Configuration', $this->content);
 }
 /**
  * Main function for the listing of history.
  * It detects incoming variables like element reference, history element uid etc. and renders the correct screen.
  *
  * @return string HTML content for the module
  */
 public function main()
 {
     // Save snapshot
     if ($this->getArgument('highlight') && !$this->getArgument('settings')) {
         $this->toggleHighlight($this->getArgument('highlight'));
     }
     $this->displaySettings();
     if ($this->createChangeLog()) {
         if ($this->rollbackFields) {
             $completeDiff = $this->createMultipleDiff();
             $this->performRollback($completeDiff);
         }
         if ($this->lastSyslogId) {
             $this->view->assign('lastSyslogId', $this->lastSyslogId);
             $completeDiff = $this->createMultipleDiff();
             $this->displayMultipleDiff($completeDiff);
         }
         if ($this->element) {
             $this->displayHistory();
         }
     }
     return $this->view->render();
 }
 /**
  * Injects the request object for the current request and gathers all data
  *
  * IMPORTING DATA:
  *
  * Incoming array has syntax:
  * GETvar 'id' = import page id (must be readable)
  *
  * file = 	(pointing to filename relative to PATH_site)
  *
  * [all relation fields are clear, but not files]
  * - page-tree is written first
  * - then remaining pages (to the root of import)
  * - then all other records are written either to related included pages or if not found to import-root (should be a sysFolder in most cases)
  * - then all internal relations are set and non-existing relations removed, relations to static tables preserved.
  *
  * EXPORTING DATA:
  *
  * Incoming array has syntax:
  *
  * file[] = file
  * dir[] = dir
  * list[] = table:pid
  * record[] = table:uid
  *
  * pagetree[id] = (single id)
  * pagetree[levels]=1,2,3, -1 = currently unpacked tree, -2 = only tables on page
  * pagetree[tables][]=table/_ALL
  *
  * external_ref[tables][]=table/_ALL
  *
  * @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();
     $this->main();
     $this->moduleTemplate->setContent($this->standaloneView->render());
     $response->getBody()->write($this->moduleTemplate->renderContent());
     return $response;
 }
    /**
     * Main function - creating the login/logout form
     *
     * @throws Exception
     * @return string The content to output
     */
    public function main()
    {
        /** @var $pageRenderer PageRenderer */
        $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
        $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Login');
        // support placeholders for IE9 and lower
        $clientInfo = GeneralUtility::clientInfo();
        if ($clientInfo['BROWSER'] === 'msie' && $clientInfo['VERSION'] <= 9) {
            $pageRenderer->addJsLibrary('placeholders', 'sysext/core/Resources/Public/JavaScript/Contrib/placeholders.jquery.min.js');
        }
        // Checking, if we should make a redirect.
        // Might set JavaScript in the header to close window.
        $this->checkRedirect();
        // Extension Configuration
        $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['backend']);
        // Background Image
        if (!empty($extConf['loginBackgroundImage'])) {
            $backgroundImage = $this->getUriForFileName($extConf['loginBackgroundImage']);
            $this->getDocumentTemplate()->inDocStylesArray[] = '
				@media (min-width: 768px){
					.typo3-login-carousel-control.right,
					.typo3-login-carousel-control.left,
					.panel-login { border: 0; }
					.typo3-login { background-image: url("' . $backgroundImage . '"); }
				}
			';
        }
        // Add additional css to use the highlight color in the login screen
        if (!empty($extConf['loginHighlightColor'])) {
            $this->getDocumentTemplate()->inDocStylesArray[] = '
				.btn-login.disabled, .btn-login[disabled], fieldset[disabled] .btn-login,
				.btn-login.disabled:hover, .btn-login[disabled]:hover, fieldset[disabled] .btn-login:hover,
				.btn-login.disabled:focus, .btn-login[disabled]:focus, fieldset[disabled] .btn-login:focus,
				.btn-login.disabled.focus, .btn-login[disabled].focus, fieldset[disabled] .btn-login.focus,
				.btn-login.disabled:active, .btn-login[disabled]:active, fieldset[disabled] .btn-login:active,
				.btn-login.disabled.active, .btn-login[disabled].active, fieldset[disabled] .btn-login.active,
				.btn-login:hover, .btn-login:focus, .btn-login:active,
				.btn-login:active:hover, .btn-login:active:focus,
				.btn-login { background-color: ' . $extConf['loginHighlightColor'] . '; }
				.panel-login .panel-body { border-color: ' . $extConf['loginHighlightColor'] . '; }
			';
        }
        // Logo
        if (!empty($extConf['loginLogo'])) {
            $logo = $extConf['loginLogo'];
        } elseif (!empty($GLOBALS['TBE_STYLES']['logo_login'])) {
            // Fallback to old TBE_STYLES login logo
            $logo = $GLOBALS['TBE_STYLES']['logo_login'];
            GeneralUtility::deprecationLog('$GLOBALS["TBE_STYLES"]["logo_login"] is deprecated since TYPO3 CMS 7 and will be removed in TYPO3 CMS 8, please use the backend extension\'s configuration instead.');
        } else {
            // Use TYPO3 logo depending on highlight color
            if (!empty($extConf['loginHighlightColor'])) {
                $logo = 'EXT:backend/Resources/Public/Images/typo3_black.svg';
            } else {
                $logo = 'EXT:backend/Resources/Public/Images/typo3_orange.svg';
            }
            $this->getDocumentTemplate()->inDocStylesArray[] = '
				.typo3-login-logo .typo3-login-image { max-width: 150px; }
			';
        }
        $logo = $this->getUriForFileName($logo);
        // Start form
        $formType = empty($this->getBackendUserAuthentication()->user['uid']) ? 'LoginForm' : 'LogoutForm';
        $this->view->assignMultiple(array('backendUser' => $this->getBackendUserAuthentication()->user, 'hasLoginError' => $this->isLoginInProgress(), 'formType' => $formType, 'logo' => $logo, 'images' => array('capslock' => $this->getUriForFileName('EXT:backend/Resources/Public/Images/icon_capslock.svg'), 'typo3' => $this->getUriForFileName('EXT:backend/Resources/Public/Images/typo3_orange.svg')), 'copyright' => BackendUtility::TYPO3_copyRightNotice(), 'loginNewsItems' => $this->getSystemNews(), 'loginProviderIdentifier' => $this->loginProviderIdentifier, 'loginProviders' => $this->loginProviders));
        // Initialize interface selectors:
        $this->makeInterfaceSelectorBox();
        /** @var LoginProviderInterface $loginProvider */
        $loginProvider = GeneralUtility::makeInstance($this->loginProviders[$this->loginProviderIdentifier]['provider']);
        $loginProvider->render($this->view, $pageRenderer, $this);
        $content = $this->getDocumentTemplate()->startPage('TYPO3 CMS Login: '******'TYPO3_CONF_VARS']['SYS']['sitename']);
        $content .= $this->view->render();
        $content .= $this->getDocumentTemplate()->endPage();
        return $content;
    }
 /**
  * Main function for the listing of history.
  * It detects incoming variables like element reference, history element uid etc. and renders the correct screen.
  *
  * @return string HTML content for the module
  */
 public function main()
 {
     // Single-click rollback
     if ($this->getArgument('revert') && $this->getArgument('sumUp')) {
         $this->rollbackFields = $this->getArgument('revert');
         $this->showInsertDelete = 0;
         $this->showSubElements = 0;
         $element = explode(':', $this->element);
         $record = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('*', 'sys_history', 'tablename=' . $this->getDatabaseConnection()->fullQuoteStr($element[0], 'sys_history') . ' AND recuid=' . (int) $element[1], '', 'uid DESC');
         $this->lastSyslogId = $record['sys_log_uid'];
         $this->createChangeLog();
         $completeDiff = $this->createMultipleDiff();
         $this->performRollback($completeDiff);
         HttpUtility::redirect($this->returnUrl);
     }
     // Save snapshot
     if ($this->getArgument('highlight') && !$this->getArgument('settings')) {
         $this->toggleHighlight($this->getArgument('highlight'));
     }
     $this->displaySettings();
     if ($this->createChangeLog()) {
         if ($this->rollbackFields) {
             $completeDiff = $this->createMultipleDiff();
             $this->performRollback($completeDiff);
         }
         if ($this->lastSyslogId) {
             $this->view->assign('lastSyslogId', $this->lastSyslogId);
             $completeDiff = $this->createMultipleDiff();
             $this->displayMultipleDiff($completeDiff);
         }
         if ($this->element) {
             $this->displayHistory();
         }
     }
     return $this->view->render();
 }