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 $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(); } }
/** * 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(); }
/** * inits the standalone fluid template */ public function initFluidTemplate() { $this->searchFormView = GeneralUtility::makeInstance('TYPO3\\CMS\\Fluid\\View\\StandaloneView'); $this->searchFormView->setPartialRootPaths([$this->conf['partialRootPath']]); $this->searchFormView->setLayoutRootPaths([$this->conf['layoutRootPath']]); $this->searchFormView->setTemplatePathAndFilename($this->conf['templateRootPath'] . 'SearchForm.html'); // make settings available in fluid template $this->searchFormView->assign('conf', $this->conf); $this->searchFormView->assign('extConf', $this->extConf); $this->searchFormView->assign('extConfPremium', $this->extConfPremium); }
/** * Constructor */ public function __construct() { if (!$this->checkAccess()) { return; } $extPath = ExtensionManagementUtility::extPath('backend'); /* @var $view StandaloneView */ $this->standaloneView = GeneralUtility::makeInstance(StandaloneView::class); $this->standaloneView->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/ToolbarMenu/' . static::TOOLBAR_MENU_TEMPLATE); $pageRenderer = $this->getPageRenderer(); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/SystemInformationMenu'); }
/** * Initialize the handle action, sets up fluid stuff and assigns default variables. * * @return void */ protected function initializeHandle() { // Context service distinguishes between standalone and backend context $contextService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\ContextService::class); $viewRootPath = GeneralUtility::getFileAbsFileName('EXT:install/Resources/Private/'); $controllerActionDirectoryName = ucfirst($this->controller); $mainTemplate = ucfirst($this->action); $this->view = GeneralUtility::makeInstance(StandaloneView::class); $this->view->setTemplatePathAndFilename($viewRootPath . 'Templates/Action/' . $controllerActionDirectoryName . '/' . $mainTemplate . '.html'); $this->view->setLayoutRootPaths([$viewRootPath . 'Layouts/']); $this->view->setPartialRootPaths([$viewRootPath . 'Partials/']); $this->view->assign('time', time())->assign('action', $this->action)->assign('controller', $this->controller)->assign('token', $this->token)->assign('context', $contextService->getContextString())->assign('contextService', $contextService)->assign('lastError', $this->lastError)->assign('messages', $this->messages)->assign('typo3Version', TYPO3_version)->assign('siteName', $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']); }
/** * 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); }
/** * Set template * * @param array $conf With possibly set file resource * @return void * @throws \InvalidArgumentException */ protected function setTemplate(array $conf) { // Fetch the Fluid template by templateName if (!empty($conf['templateName']) && !empty($conf['templateRootPaths.']) && is_array($conf['templateRootPaths.'])) { $templateRootPaths = array(); foreach ($conf['templateRootPaths.'] as $key => $path) { if (strpos($key, '.') === false) { $templateRootPaths[$key] = isset($conf['templateRootPaths.'][$key . '.']) ? GeneralUtility::getFileAbsFileName($this->cObj->stdWrap($conf['templateRootPaths.'][$key], $conf['templateRootPaths.'][$key . '.'])) : GeneralUtility::getFileAbsFileName($path); } } $this->view->setTemplateRootPaths($templateRootPaths); $templateName = isset($conf['templateName.']) ? $this->cObj->stdWrap($conf['templateName'], $conf['templateName.']) : $conf['templateName']; $this->view->setTemplate($templateName); // Fetch the Fluid template by template cObject } elseif (!empty($conf['template']) && !empty($conf['template.'])) { $templateSource = $this->cObj->cObjGetSingle($conf['template'], $conf['template.']); $this->view->setTemplateSource($templateSource); // Fetch the Fluid template by file stdWrap } else { $file = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file']; /** @var $templateService \TYPO3\CMS\Core\TypoScript\TemplateService */ $templateService = $GLOBALS['TSFE']->tmpl; $templatePathAndFilename = $templateService->getFileName($file); $this->view->setTemplatePathAndFilename(PATH_site . $templatePathAndFilename); } }
/** * 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(); }
/** * @test */ public function getPartialRootPathReturnsDefaultPathIfNoPartialRootPathIsSpecified() { $templatePathAndFilename = 'some/template/RootPath/SomeTemplate.html'; $this->view->setTemplatePathAndFilename($templatePathAndFilename); $expectedResult = 'some/template/RootPath/Partials'; $actualResult = $this->view->getPartialRootPath(); $this->assertEquals($expectedResult, $actualResult); }
/** * Set template * * @param array $conf With possibly set file resource * @return void */ protected function setTemplate(array $conf) { // Fetch the Fluid template $file = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file']; /** @var $templateService \TYPO3\CMS\Core\TypoScript\TemplateService */ $templateService = $GLOBALS['TSFE']->tmpl; $templatePathAndFilename = $templateService->getFileName($file); $this->view->setTemplatePathAndFilename($templatePathAndFilename); }
/** * @param StandaloneView $view * @param PageRenderer $pageRenderer * @param LoginController $loginController * @throws \UnexpectedValueException */ public function render(StandaloneView $view, PageRenderer $pageRenderer, LoginController $loginController) { GeneralUtility::makeInstance(ObjectManager::class)->get(Dispatcher::class)->dispatch(__CLASS__, self::SIGNAL_getPageRenderer, array($pageRenderer)); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/UserPassLogin'); $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/UserPassLoginForm.html')); if (GeneralUtility::getIndpEnv('TYPO3_SSL')) { $view->assign('presetUsername', GeneralUtility::_GP('u')); $view->assign('presetPassword', GeneralUtility::_GP('p')); } }
/** * 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; }
/** * Set template * * @param array $conf With possibly set file resource * @return void * @throws \InvalidArgumentException */ protected function setTemplate(array $conf) { // Fetch the Fluid template if (!empty($conf['template']) && !empty($conf['template.'])) { $templateSource = $this->cObj->cObjGetSingle($conf['template'], $conf['template.']); $this->view->setTemplateSource($templateSource); } else { $file = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file']; /** @var $templateService \TYPO3\CMS\Core\TypoScript\TemplateService */ $templateService = $GLOBALS['TSFE']->tmpl; $templatePathAndFilename = $templateService->getFileName($file); $this->view->setTemplatePathAndFilename(PATH_site . $templatePathAndFilename); } }
/** * main method * * @return string */ public function main() { $this->view = $this->objectManager->get('\\TYPO3\\CMS\\Fluid\\View\\StandaloneView'); $this->view->getRequest()->setControllerExtensionName($this->getExtensionName()); $this->view->getRequest()->setPluginName('UpdateScript'); $this->view->getRequest()->setControllerName('UpdateScript'); $this->view->setLayoutRootPaths($this->getTemplateFolders('layout')); $this->view->setPartialRootPaths($this->getTemplateFolders('partial')); $this->view->assign('requestUri', GeneralUtility::getIndpEnv('REQUEST_URI')); $action = GeneralUtility::_GP('action') ? GeneralUtility::_GP('action') : 'Main'; if (is_callable(array($this, $action . 'Action'))) { $this->view->setTemplatePathAndFilename($this->getTemplatePath('UpdateScript/' . ucfirst($action) . '.html')); $content = call_user_func_array(array($this, $action . 'Action'), array()); } return $content; }
/** * Init some values * * @param array $data */ protected function init($data) { $templatePathAndFilename = GeneralUtility::getFileAbsFileName('EXT:yag/Resources/Private/Templates/Backend/PluginInfo.html'); // Extbase $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); $configuration['extensionName'] = self::EXTENSION_NAME; $configuration['pluginName'] = self::PLUGIN_NAME; $bootstrap = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Core\\Bootstrap'); $bootstrap->initialize($configuration); // Fluid $this->fluidRenderer = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView'); $this->fluidRenderer->setTemplatePathAndFilename($templatePathAndFilename); // PluginMode if (is_array($data)) { $firstControllerAction = array_shift(explode(';', $this->getDataValue($data, 'switchableControllerActions', 'sDefault'))); $this->pluginMode = str_replace('->', '_', $firstControllerAction); // Theme $this->theme = $this->getDataValue($data, 'settings.theme', 'sDefault'); } }
/** * Set template * * @param array $conf With possibly set file resource * @return void * @throws \InvalidArgumentException */ protected function setTemplate(array $conf) { // Fetch the Fluid template by templateName if ((!empty($conf['templateName']) || !empty($conf['templateName.'])) && !empty($conf['templateRootPaths.']) && is_array($conf['templateRootPaths.'])) { $templateRootPaths = $this->applyStandardWrapToFluidPaths($conf['templateRootPaths.']); $this->view->setTemplateRootPaths($templateRootPaths); $templateName = isset($conf['templateName.']) ? $this->cObj->stdWrap(isset($conf['templateName']) ? $conf['templateName'] : '', $conf['templateName.']) : $conf['templateName']; $this->view->setTemplate($templateName); // Fetch the Fluid template by template cObject } elseif (!empty($conf['template']) && !empty($conf['template.'])) { $templateSource = $this->cObj->cObjGetSingle($conf['template'], $conf['template.']); $this->view->setTemplateSource($templateSource); // Fetch the Fluid template by file stdWrap } else { $file = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file']; /** @var $templateService \TYPO3\CMS\Core\TypoScript\TemplateService */ $templateService = $GLOBALS['TSFE']->tmpl; $templatePathAndFilename = $templateService->getFileName($file); $this->view->setTemplatePathAndFilename(PATH_site . $templatePathAndFilename); } }
/** * 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 * * @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>'; }
/** * @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(); }
/** * 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(); }
/** * 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); }
/** * @param StandaloneView $view * @param PageRenderer $pageRenderer * @param LoginController $loginController */ public function render(StandaloneView $view, PageRenderer $pageRenderer, LoginController $loginController) { $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:openid/Resources/Private/Templates/OpenidLogin.html')); $view->assign('presetOpenId', GeneralUtility::_GP('openid_url')); }