/** * Load RequireJS code. * * @return void * @api */ public function render() { $content = $this->renderChildren(); $this->pageRenderer->addJsInlineCode('vidi-inline', $content); $configuration['paths']['Fab/Vidi'] = '../typo3conf/ext/vidi/Resources/Public/JavaScript'; $this->pageRenderer->addRequireJsConfiguration($configuration); $this->pageRenderer->loadRequireJsModule('Fab/Vidi/Vidi/Main'); }
/** * Construct */ public function __construct() { $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $this->pageRenderer->loadJquery(); $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Recordlist/ElementBrowser'); $this->initialize(); }
/** * wrapper function called by hook (\TYPO3\CMS\Core\Page\PageRenderer->render-preProcess) * * @param array $parameters : An array of available parameters * @param \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer : The parent object that triggered this hook * * @return void */ public function addJSCSS($parameters, &$pageRenderer) { // Add javascript $pageRenderer->loadRequireJsModule('TYPO3/CMS/Themes/ThemesBackendTca'); // Add css $filename = $pageRenderer->backPath . ExtensionManagementUtility::extRelPath('themes') . 'Resources/Public/Stylesheet/ThemesBackendTca.css'; $pageRenderer->addCssFile($filename, 'stylesheet', 'screen'); }
/** * Creates a tab menu where the tabs or collapsible are rendered with bootstrap markup * * @param array $menuItems Tab elements, each element is an array with "label" and "content" * @param string $domId DOM id attribute, will be appended with an iteration number per tab. * @param int $defaultTabIndex Default tab to open (for toggle <=0). Value corresponds to integer-array index + 1 * (index zero is "1", index "1" is 2 etc.). A value of zero (or something non-existing * will result in no default tab open. * @param bool $collapsible If set, the tabs are rendered as headers instead over each sheet. Effectively this means * there is no tab menu, but rather a foldout/fold-in menu. * @param bool $wrapContent If set, the content is wrapped in div structure which provides a padding and border * style. Set this FALSE to get unstyled content pane with fullsize content area. * @param bool $storeLastActiveTab If set, the last open tab is stored in local storage and will be re-open again. * If you don't need this feature, e.g. for wizards like import/export you can * disable this behaviour. * @return string */ public function getDynamicTabMenu(array $menuItems, $domId, $defaultTabIndex = 1, $collapsible = false, $wrapContent = true, $storeLastActiveTab = true) { $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Tabs'); $templatePathAndFileName = 'EXT:backend/Resources/Private/Templates/DocumentTemplate/' . ($collapsible ? 'Collapse.html' : 'Tabs.html'); $view = GeneralUtility::makeInstance(StandaloneView::class); $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templatePathAndFileName)); $view->assignMultiple(array('id' => 'DTM-' . GeneralUtility::shortMD5($domId), 'items' => $menuItems, 'defaultTabIndex' => $defaultTabIndex, 'wrapContent' => $wrapContent, 'storeLastActiveTab' => $storeLastActiveTab)); return $view->render(); }
/** * @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')); } }
/** * @param PageRenderer $pageRenderer */ public function getPageRenderer(PageRenderer $pageRenderer) { $loginSecurityLevel = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel']) ?: 'normal'; if ($loginSecurityLevel === 'rsa') { $javascriptPath = '../' . ExtensionManagementUtility::siteRelPath('rsaauth') . 'Resources/Public/JavaScript/'; $files = array('jsbn/jsbn.js', 'jsbn/prng4.js', 'jsbn/rng.js', 'jsbn/rsa.js', 'jsbn/base64.js'); foreach ($files as $file) { $pageRenderer->addJsFile($javascriptPath . $file); } $pageRenderer->loadRequireJsModule('TYPO3/CMS/Rsaauth/BackendLoginFormRsaEncryption'); } }
/** * Constructor */ public function __construct() { $this->getLanguageService()->includeLLFile('EXT:lang/locallang_misc.xlf'); $this->backendModuleRepository = GeneralUtility::makeInstance(BackendModuleRepository::class); // Set debug flag for BE development only $this->debug = (int) $GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] === 1; // Initializes the backend modules structure for use later. $this->moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); $this->moduleLoader->load($GLOBALS['TBE_MODULES']); $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $this->pageRenderer->loadExtJS(); // included for the module menu JavaScript, please note that this is subject to change $this->pageRenderer->loadJquery(); $this->pageRenderer->addJsInlineCode('consoleOverrideWithDebugPanel', '//already done', false); $this->pageRenderer->addExtDirectCode(); // Add default BE javascript $backendRelPath = ExtensionManagementUtility::extRelPath('backend'); $this->jsFiles = array('locallang' => $this->getLocalLangFileName(), 'md5' => $backendRelPath . 'Resources/Public/JavaScript/md5.js', 'modulemenu' => $backendRelPath . 'Resources/Public/JavaScript/modulemenu.js', 'evalfield' => $backendRelPath . 'Resources/Public/JavaScript/jsfunc.evalfield.js', 'notifications' => $backendRelPath . 'Resources/Public/JavaScript/notifications.js', 'backend' => $backendRelPath . 'Resources/Public/JavaScript/backend.js', 'viewport' => $backendRelPath . 'Resources/Public/JavaScript/extjs/viewport.js', 'iframepanel' => $backendRelPath . 'Resources/Public/JavaScript/iframepanel.js', 'backendcontentiframe' => $backendRelPath . 'Resources/Public/JavaScript/extjs/backendcontentiframe.js', 'viewportConfiguration' => $backendRelPath . 'Resources/Public/JavaScript/extjs/viewportConfiguration.js'); $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LoginRefresh', 'function(LoginRefresh) { LoginRefresh.setLoginFramesetUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('login_frameset')) . '); LoginRefresh.setLogoutUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('logout')) . '); }'); // load Utility class $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Utility'); // load Notification functionality $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Notification'); // load Modals $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Modal'); // load Legacy CSS Support $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LegacyCssClasses'); // load the storage API and fill the UC into the PersistentStorage, so no additional AJAX call is needed $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Storage', 'function(Storage) { Storage.Persistent.load(' . json_encode($this->getBackendUser()->uc) . '); }'); // load debug console $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DebugConsole'); // Load RSA encryption $rsaEncryptionEncoder = GeneralUtility::makeInstance(RsaEncryptionEncoder::class); $rsaEncryptionEncoder->enableRsaEncryption(true); $this->pageRenderer->addInlineSetting('ShowItem', 'moduleUrl', BackendUtility::getModuleUrl('show_item')); $this->css = ''; $this->initializeToolbarItems(); if (isset($GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'])) { $this->menuWidth = (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW']; } $this->executeHook('constructPostProcess'); $this->includeLegacyBackendItems(); }
/** * Constructor */ public function __construct() { $this->getLanguageService()->includeLLFile('EXT:lang/Resources/Private/Language/locallang_misc.xlf'); $this->backendModuleRepository = GeneralUtility::makeInstance(BackendModuleRepository::class); $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); // Set debug flag for BE development only $this->debug = (int) $GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] === 1; // Initializes the backend modules structure for use later. $this->moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); $this->moduleLoader->load($GLOBALS['TBE_MODULES']); $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $this->pageRenderer->loadExtJS(); // included for the module menu JavaScript, please note that this is subject to change $this->pageRenderer->loadJquery(); $this->pageRenderer->addExtDirectCode(); // Add default BE javascript $this->jsFiles = ['locallang' => $this->getLocalLangFileName(), 'md5' => 'EXT:backend/Resources/Public/JavaScript/md5.js', 'evalfield' => 'EXT:backend/Resources/Public/JavaScript/jsfunc.evalfield.js', 'backend' => 'EXT:backend/Resources/Public/JavaScript/backend.js']; $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LoginRefresh', 'function(LoginRefresh) { LoginRefresh.setIntervalTime(' . MathUtility::forceIntegerInRange((int) $GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout'] - 60, 60) . '); LoginRefresh.setLoginFramesetUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('login_frameset')) . '); LoginRefresh.setLogoutUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('logout')) . '); LoginRefresh.initialize(); }'); // load module menu $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ModuleMenu'); // load Toolbar class $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar'); // load Utility class $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Utility'); // load Notification functionality $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Notification'); // load Modals $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Modal'); // load the storage API and fill the UC into the PersistentStorage, so no additional AJAX call is needed $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Storage', 'function(Storage) { Storage.Persistent.load(' . json_encode($this->getBackendUser()->uc) . '); }'); // load debug console $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DebugConsole'); // Load RSA encryption $rsaEncryptionEncoder = GeneralUtility::makeInstance(RsaEncryptionEncoder::class); $rsaEncryptionEncoder->enableRsaEncryption(true); $this->pageRenderer->addInlineSetting('ShowItem', 'moduleUrl', BackendUtility::getModuleUrl('show_item')); $this->css = ''; $this->initializeToolbarItems(); $this->executeHook('constructPostProcess'); $this->includeLegacyBackendItems(); }
/** * Render start page with \TYPO3\CMS\Backend\Template\DocumentTemplate and pageTitle * * @param string $pageTitle title tag of the module. Not required by default, as BE modules are shown in a frame * @param bool $loadExtJs specifies whether to load ExtJS library. Defaults to FALSE * @param bool $loadExtJsTheme whether to load ExtJS "grey" theme. Defaults to FALSE * @param bool $enableExtJsDebug if TRUE, debug version of ExtJS is loaded. Use this for development only * @param bool $loadJQuery whether to load jQuery library. Defaults to FALSE * @param array $includeCssFiles List of custom CSS file to be loaded * @param array $includeJsFiles List of custom JavaScript file to be loaded * @param array $addJsInlineLabels Custom labels to add to JavaScript inline labels * @param array $includeRequireJsModules List of RequireJS modules to be loaded * @param string $jQueryNamespace Store the jQuery object in a specific namespace * @return void */ public function render($pageTitle = '', $loadExtJs = false, $loadExtJsTheme = true, $enableExtJsDebug = false, $loadJQuery = false, $includeCssFiles = null, $includeJsFiles = null, $addJsInlineLabels = null, $includeRequireJsModules = null, $jQueryNamespace = null) { if ($pageTitle) { $this->pageRenderer->setTitle($pageTitle); } if ($loadExtJs) { $this->pageRenderer->loadExtJS(true, $loadExtJsTheme); if ($enableExtJsDebug) { $this->pageRenderer->enableExtJsDebug(); } } if ($loadJQuery) { $jQueryNamespace = $jQueryNamespace ?: PageRenderer::JQUERY_NAMESPACE_DEFAULT; $this->pageRenderer->loadJquery(null, null, $jQueryNamespace); } // Include custom CSS and JS files if (is_array($includeCssFiles) && count($includeCssFiles) > 0) { foreach ($includeCssFiles as $addCssFile) { $this->pageRenderer->addCssFile($addCssFile); } } if (is_array($includeJsFiles) && count($includeJsFiles) > 0) { foreach ($includeJsFiles as $addJsFile) { $this->pageRenderer->addJsFile($addJsFile); } } if (is_array($includeRequireJsModules) && count($includeRequireJsModules) > 0) { foreach ($includeRequireJsModules as $addRequireJsFile) { $this->pageRenderer->loadRequireJsModule($addRequireJsFile); } } // Add inline language labels if (is_array($addJsInlineLabels) && count($addJsInlineLabels) > 0) { $extensionKey = $this->controllerContext->getRequest()->getControllerExtensionKey(); foreach ($addJsInlineLabels as $key) { $label = LocalizationUtility::translate($key, $extensionKey); $this->pageRenderer->addInlineLanguageLabel($key, $label); } } }
/** * 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->pageRenderer->loadJquery(); $this->pageRenderer->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">' . IconUtility::getSpriteIcon('actions-document-select') . '</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; } 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 $editAction = '<a class="btn btn-default" href="' . htmlspecialchars($this->moduleUri . '&CMD=edit&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:edit', TRUE) . '" class="icon">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>'; if ((int) $schedulerRecord['disable'] === 1) { $translationKey = 'enable'; $spriteIcon = 'actions-edit-unhide'; } else { $translationKey = 'disable'; $spriteIcon = 'actions-edit-hide'; } $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">' . IconUtility::getSpriteIcon($spriteIcon) . '</a>'; $deleteAction = '<a class="btn btn-default" href="' . htmlspecialchars($this->moduleUri . '&CMD=delete&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" onclick="return confirm(' . GeneralUtility::quoteJSvalue($this->getLanguageService()->getLL('msg.delete')) . ');" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:delete', TRUE) . '" class="icon">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; $stopAction = '<a class="btn btn-default" href="' . htmlspecialchars($this->moduleUri . '&CMD=stop&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" onclick="return confirm(' . GeneralUtility::quoteJSvalue($this->getLanguageService()->getLL('msg.stop')) . ');" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:stop', TRUE) . '" class="icon">' . IconUtility::getSpriteIcon('actions-document-close') . '</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">' . IconUtility::getSpriteIcon('extensions-scheduler-run-task') . '</a>'; // Define some default values $lastExecution = '-'; $isRunning = FALSE; $showAsDisabled = FALSE; $startExecutionElement = '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</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 ($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"><span title="' . htmlspecialchars($additionalInformation) . '">[' . GeneralUtility::fixed_lgd_cs(htmlspecialchars($additionalInformation), (int) $this->getBackendUser()->uc['titleLen']) . ']</span></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->getExecution()->getInterval() == 0 && $task->getExecution()->getCronCmd() == '') { $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 object /** @var $exception \Exception */ $exception = @unserialize($schedulerRecord['lastexecution_failure']); // If the exception could not be unserialized, issue a default error message if ($exception === FALSE || $exception instanceof \__PHP_Incomplete_Class) { $labelDescription = $this->getLanguageService()->getLL('msg.executionFailureDefault'); } else { $labelDescription = sprintf($this->getLanguageService()->getLL('msg.executionFailureReport'), $exception->getCode(), $exception->getMessage()); } $labels[] = array('class' => 'danger', 'text' => $this->getLanguageService()->getLL('status.failure'), 'description' => $labelDescription); } // Format the execution status, // including failure feedback, if any if ($schedulerRecord['description'] !== '') { $taskName = '<span title="' . htmlspecialchars($schedulerRecord['description']) . '">' . $name . '</span>'; } else { $taskName = $name; } $table[] = '<tr class="' . ($showAsDisabled ? 'disabled' : '') . '">' . '<td>' . $startExecutionElement . '</td>' . '<td class="right">' . $schedulerRecord['uid'] . '</td>' . '<td>' . $taskName . ' ' . $this->makeStatusLabel($labels) . '</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 /** @var $flashMessage FlashMessage */ $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, sprintf($this->getLanguageService()->getLL('msg.invalidTaskClass'), $class), '', FlashMessage::ERROR); $executionStatusOutput = $flashMessage->render(); $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">' . $deleteAction . '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>' . '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>' . '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>' . '</div></td>' . '</tr>'; } } } $this->getDatabaseConnection()->sql_free_result($res); $this->view->assign('table', '<div class="table-fit"><table class="table table-striped table-hover">' . implode(LF, $table) . '</table></div>'); // 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(); }
/** * Includes the necessary javascript file for use on pages which have the * drag and drop functionality (legacy folder tree) * * @param string $table indicator of which table the drag and drop function should work on (pages or folders) * @param string $additionalJavaScriptCode adds more code to the additional javascript code * @return void * @deprecated since TYPO3 CMS 8, will be removed in TYPO3 CMS 9. */ public function getDragDropCode($table, $additionalJavaScriptCode = '') { GeneralUtility::logDeprecatedFunction(); $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LegacyTree', 'function() { DragDrop.table = "' . $table . '"; ' . $additionalJavaScriptCode . ' }'); }
/** * wrapper function called by hook (\TYPO3\CMS\Core\Page\PageRenderer->render-preProcess) * * @param array $parameters : An array of available parameters * @param \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer : The parent object that triggered this hook * * @return void */ public function addJSCSS($parameters, &$pageRenderer) { if (get_class($GLOBALS['SOBE']) === 'TYPO3\\CMS\\Recordlist\\RecordList') { $pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsOnReady'); return; } if (get_class($GLOBALS['SOBE']) === 'TYPO3\\CMS\\Backend\\Controller\\PageLayoutController') { $iconFactory = GeneralUtility::makeInstance(IconFactory::class); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsOnReady'); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsDragDrop'); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsDragInWizard'); /** @var Clipboard $clipObj */ $clipObj = GeneralUtility::makeInstance(Clipboard::class); // Start clipboard $clipObj->initializeClipboard(); $clipObj->lockToNormal(); if (!$pageRenderer->getCharSet()) { $pageRenderer->setCharSet($GLOBALS['LANG']->charSet ? $GLOBALS['LANG']->charSet : 'utf-8'); } // pull locallang_db.xml to JS side - only the tx_gridelements_js-prefixed keys $pageRenderer->addInlineLanguageLabelFile('EXT:gridelements/Resources/Private/Language/locallang_db.xml', 'tx_gridelements_js'); $pAddExtOnReadyCode = ' TYPO3.l10n = { localize: function(langKey){ return TYPO3.lang[langKey]; } } '; $allowedContentTypesClassesByColPos = array(); $allowedGridTypesClassesByColPos = array(); $layoutSetup = GeneralUtility::callUserFunction('TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getSelectedBackendLayout', intval(GeneralUtility::_GP('id')), $this); if (is_array($layoutSetup) && !empty($layoutSetup['__config']['backend_layout.']['rows.'])) { foreach ($layoutSetup['__config']['backend_layout.']['rows.'] as $rows) { foreach ($rows as $row) { if (!empty($layoutSetup['__config']['backend_layout.']['rows.'])) { foreach ($row as $col) { $classes = ''; $gridClasses = ''; if ($col['allowed']) { $allowed = explode(',', $col['allowed']); foreach ($allowed as $contentTypes) { $contentTypes = trim($contentTypes); if ($contentTypes === '*') { $classes = 't3-allow-all'; break; } else { $contentTypes = explode(',', $contentTypes); foreach ($contentTypes as $contentType) { $classes .= 't3-allow-' . $contentType . ' '; } } } } else { $classes = 't3-allow-all'; } if ($col['allowedGridTypes']) { $allowedGridTypes = explode(',', $col['allowedGridTypes']); $classes .= 't3-allow-gridelements_pi1 '; foreach ($allowedGridTypes as $gridTypes) { $gridTypes = trim($gridTypes); if ($gridTypes !== '*') { $gridTypes = explode(',', $gridTypes); foreach ($gridTypes as $gridType) { $gridClasses .= 't3-allow-gridtype t3-allow-gridtype-' . $gridType . ' '; } } } if ($classes !== 't3-allow-all') { $classes .= 't3-allow-gridelements_pi1 '; } } $allowedContentTypesClassesByColPos[$col['colPos']] .= ' ' . trim($classes); $allowedGridTypesClassesByColPos[$col['colPos']] .= ' ' . trim($gridClasses); } } } } } // add Ext.onReady() code from file $pAddExtOnReadyCode .= "\n top.pageColumnsAllowedCTypes = " . json_encode($allowedContentTypesClassesByColPos) . ";\n top.pageColumnsAllowedGridTypes = " . json_encode($allowedGridTypesClassesByColPos) . ";\n top.pasteReferenceAllowed = " . ($this->getBackendUser()->checkAuthMode('tt_content', 'CType', 'shortcut', 'explicitAllow') ? 'true' : 'false') . ";\n top.skipDraggableDetails = " . ($this->getBackendUser()->uc['dragAndDropHideNewElementWizardInfoOverlay'] ? 'true' : 'false') . ";\n top.backPath = '" . $GLOBALS['BACK_PATH'] . "';\n top.browserUrl = '" . BackendUtility::getModuleUrl('wizard_element_browser') . "'"; $elFromTable = $clipObj->elFromTable('tt_content'); if (!empty($elFromTable)) { $pasteItem = substr(key($elFromTable), 11); $pasteRecord = BackendUtility::getRecord('tt_content', (int) $pasteItem); $pasteTitle = $pasteRecord['header'] ? $pasteRecord['header'] : $pasteItem; $copyMode = $clipObj->clipData['normal']['mode'] ? '-' . $clipObj->clipData['normal']['mode'] : ''; $pAddExtOnReadyCode .= "\n top.pasteIntoLinkTemplate = " . json_encode('<a data-pasteitem="' . $pasteItem . '" data-pastetitle="' . $pasteTitle . '" class="t3js-paste t3js-paste' . $copyMode . ' t3js-paste-into btn btn-default" title="' . $this->getLanguageService()->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_js.pasteinto') . '">' . $iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL)->render() . '</a>') . ";\n top.pasteAfterLinkTemplate = " . json_encode('<a data-pasteitem="' . $pasteItem . '" data-pastetitle="' . $pasteTitle . '" class="t3js-paste t3js-paste' . $copyMode . ' t3js-paste-after btn btn-default" title="' . $this->getLanguageService()->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_js.pasteafter') . '">' . $iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL)->render() . '</a>') . ";"; if ($this->getBackendUser()->checkAuthMode('tt_content', 'CType', 'shortcut', 'explicitAllow')) { $pAddExtOnReadyCode .= "\n top.pasteReferencesAllowed = true;"; } } else { $pAddExtOnReadyCode .= "\n top.pasteIntoLinkTemplate = '';\n top.pasteAfterLinkTemplate = '';"; } $pAddExtOnReadyCode .= "\n top.copyFromAnotherPageLinkTemplate = " . json_encode('<a class="t3js-paste-new btn btn-default" title="' . $this->getLanguageService()->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_js.copyfrompage') . '">' . $iconFactory->getIcon('actions-insert-reference', Icon::SIZE_SMALL)->render() . '</a>') . ";"; $pageRenderer->addJsInlineCode('gridelementsExtOnReady', $pAddExtOnReadyCode); } }
/** * This loads everything needed for the Context Sensitive Help (CSH) * * @return void */ protected function loadCshJavascript() { $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ContextHelp'); $this->pageRenderer->addInlineSetting('ContextHelp', 'moduleUrl', BackendUtility::getModuleUrl('help_cshmanual')); }
/** * init all actions * @return void */ public function initializeAction() { $this->pageRenderer = $this->objectManager->get(\TYPO3\CMS\Core\Page\PageRenderer::class); $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DateTimePicker'); }
/** * Assemble display of list of scheduled tasks * * @return string Table of pending tasks */ protected function listTasks() { // Define display format for dates $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm']; $content = ''; // Get list of registered classes $registeredClasses = self::getRegisteredClasses(); // Get list of registered task groups $registeredTaskGroups = self::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' => '*', 'FROM' => 'tx_scheduler_task', 'WHERE' => '1=1', 'ORDERBY' => ''); $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($query); $numRows = $GLOBALS['TYPO3_DB']->sql_num_rows($res); $GLOBALS['TYPO3_DB']->sql_free_result($res); // No tasks defined, display information message if ($numRows == 0) { /** @var $flashMessage FlashMessage */ $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('msg.noTasks'), '', FlashMessage::INFO); $content .= $flashMessage->render(); } else { $this->pageRenderer->loadJquery(); $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Scheduler/Scheduler'); // Initialise table layout $tableLayout = array('table' => array('<table class="t3-table">', '</table>'), '0' => array('tr' => array('<thead><tr>', '</tr></thead>'), 'defCol' => array('<td>', '</td>'), '1' => array('<td style="width: 56px;">', '</td>'), '3' => array('<td colspan="2">', '</td>')), 'defRow' => array('tr' => array('<tr class="db_list_normal">', '</tr>'), 'defCol' => array('<td>', '</td>'), '1' => array('<td class="right">', '</td>'), '2' => array('<td class="right">', '</td>'))); $disabledTaskRow = array('tr' => array('<tr class="db_list_normal disabled">', '</tr>'), 'defCol' => array('<td>', '</td>'), '1' => array('<td class="right">', '</td>'), '2' => array('<td class="right">', '</td>')); $rowWithSpan = array('tr' => array('<tr class="db_list_normal">', '</tr>'), 'defCol' => array('<td>', '</td>'), '1' => array('<td class="right">', '</td>'), '2' => array('<td class="right">', '</td>'), '3' => array('<td colspan="6">', '</td>')); $taskGroupRow = array('tr' => array('<tr class="db_list_normal">', '</tr>'), 'defCol' => array('<td>', '</td>'), '0' => array('<td colspan="10">', '</td>')); $table = array(); $tr = 0; // Header row $table[$tr][] = '<a href="#" id="checkall" title="' . $GLOBALS['LANG']->getLL('label.checkAll', TRUE) . '" class="icon">' . IconUtility::getSpriteIcon('actions-document-select') . '</a>'; $table[$tr][] = ' '; $table[$tr][] = $GLOBALS['LANG']->getLL('label.id'); $table[$tr][] = $GLOBALS['LANG']->getLL('task'); $table[$tr][] = $GLOBALS['LANG']->getLL('label.type'); $table[$tr][] = $GLOBALS['LANG']->getLL('label.frequency'); $table[$tr][] = $GLOBALS['LANG']->getLL('label.parallel'); $table[$tr][] = $GLOBALS['LANG']->getLL('label.lastExecution'); $table[$tr][] = $GLOBALS['LANG']->getLL('label.nextExecution'); $tr++; foreach ($registeredTaskGroups as $taskGroup) { $query = array('SELECT' => '*', 'FROM' => 'tx_scheduler_task', 'WHERE' => 'task_group=' . $taskGroup['uid'], 'ORDERBY' => 'nextexecution'); $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($query); $numRows = $GLOBALS['TYPO3_DB']->sql_num_rows($res); if ($numRows === 0) { continue; } if ($taskGroup['groupName'] !== '') { $tableLayout[$tr] = $taskGroupRow; $groupText = '<strong>' . htmlspecialchars($taskGroup['groupName']) . '</strong>'; if (!empty($taskGroup['description'])) { $groupText .= '<br />' . nl2br(htmlspecialchars($taskGroup['description'])); } $table[$tr][] = $groupText; $tr++; } // Loop on all tasks while ($schedulerRecord = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // Define action icons $editAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=edit&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:edit', TRUE) . '" class="icon">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>'; $deleteAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=delete&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" onclick="return confirm(\'' . $GLOBALS['LANG']->getLL('msg.delete') . '\');" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:delete', TRUE) . '" class="icon">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; $stopAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=stop&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" onclick="return confirm(\'' . $GLOBALS['LANG']->getLL('msg.stop') . '\');" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:stop', TRUE) . '" class="icon">' . '<img ' . IconUtility::skinImg($this->backPath, ExtensionManagementUtility::extRelPath('scheduler') . '/Resources/Public/Images/stop.png') . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:stop') . '" /></a>'; $runAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&tx_scheduler[execute][]=' . $schedulerRecord['uid'] . '" title="' . $GLOBALS['LANG']->getLL('action.run_task') . '" class="icon">' . IconUtility::getSpriteIcon('extensions-scheduler-run-task') . '</a>'; // Define some default values $lastExecution = '-'; $isRunning = FALSE; $executionStatus = 'scheduled'; $executionStatusOutput = ''; $name = ''; $nextDate = '-'; $execType = '-'; $frequency = '-'; $multiple = '-'; $startExecutionElement = ' '; // 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 $context = ''; if (!empty($schedulerRecord['lastexecution_time'])) { $lastExecution = date($dateFormat, $schedulerRecord['lastexecution_time']); if ($schedulerRecord['lastexecution_context'] == 'CLI') { $context = $GLOBALS['LANG']->getLL('label.cron'); } else { $context = $GLOBALS['LANG']->getLL('label.manual'); } $lastExecution .= ' (' . $context . ')'; } if ($this->scheduler->isValidTaskObject($task)) { // The task object is valid $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 .= '<br />' . $this->renderTaskProgressBar($progress); } if (!empty($additionalInformation)) { $name .= '<br />[' . htmlspecialchars($additionalInformation) . ']'; } // Check if task currently has a running execution if (!empty($schedulerRecord['serialized_executions'])) { $isRunning = TRUE; $executionStatus = 'running'; } // 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'] == 1) { $nextDate = '-'; } else { $nextDate = date($dateFormat, $schedulerRecord['nextexecution']); if (empty($schedulerRecord['nextexecution'])) { $nextDate = $GLOBALS['LANG']->getLL('none'); } elseif ($schedulerRecord['nextexecution'] < $GLOBALS['EXEC_TIME']) { // Next execution is overdue, highlight date $nextDate = '<span class="late" title="' . $GLOBALS['LANG']->getLL('status.legend.scheduled') . '">' . $nextDate . '</span>'; $executionStatus = 'late'; } } // Get execution type if ($task->getExecution()->getInterval() == 0 && $task->getExecution()->getCronCmd() == '') { $execType = $GLOBALS['LANG']->getLL('label.type.single'); $frequency = '-'; } else { $execType = $GLOBALS['LANG']->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 = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:yes'); } else { $multiple = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:no'); } // Define checkbox $startExecutionElement = '<input type="checkbox" name="tx_scheduler[execute][]" value="' . $schedulerRecord['uid'] . '" id="task_' . $schedulerRecord['uid'] . '" class="checkboxes" />'; $actions = $editAction . $deleteAction; // Check the disable status // Row is shown dimmed if task is disabled, unless it is still running if ($schedulerRecord['disable'] == 1 && !$isRunning) { $tableLayout[$tr] = $disabledTaskRow; $executionStatus = 'disabled'; } // Show no action links (edit, delete) if task is running if ($isRunning) { $actions = $stopAction; } else { $actions .= $runAction; } // Check if the last run failed $failureOutput = ''; if (!empty($schedulerRecord['lastexecution_failure'])) { // Try to get the stored exception object /** @var $exception \Exception */ $exception = unserialize($schedulerRecord['lastexecution_failure']); // If the exception could not be unserialized, issue a default error message if ($exception === FALSE || $exception instanceof \__PHP_Incomplete_Class) { $failureDetail = $GLOBALS['LANG']->getLL('msg.executionFailureDefault'); } else { $failureDetail = sprintf($GLOBALS['LANG']->getLL('msg.executionFailureReport'), $exception->getCode(), $exception->getMessage()); } $failureOutput = ' <img ' . IconUtility::skinImg(ExtensionManagementUtility::extRelPath('scheduler'), 'Resources/Public/Images/status_failure.png') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.failure')) . '" title="' . htmlspecialchars($failureDetail) . '" />'; } // Format the execution status, // including failure feedback, if any $executionStatusOutput = '<img ' . IconUtility::skinImg(ExtensionManagementUtility::extRelPath('scheduler'), 'Resources/Public/Images/status_' . $executionStatus . '.png') . ' id="executionstatus_' . $schedulerRecord['uid'] . '" alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.' . $executionStatus)) . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.legend.' . $executionStatus)) . '" />' . $failureOutput; $table[$tr][] = $startExecutionElement; $table[$tr][] = $actions; $table[$tr][] = $schedulerRecord['uid']; $table[$tr][] = $executionStatusOutput; if ($schedulerRecord['description'] !== '') { if (!empty($this->scheduler->extConf['listShowTaskDescriptionAsHover'])) { $table[$tr][] = '<span title="' . htmlspecialchars($schedulerRecord['description']) . '">' . $name . '</span>'; } else { $table[$tr][] = $name . '<br />' . nl2br(htmlspecialchars($schedulerRecord['description'])) . '<br />'; } } else { $table[$tr][] = $name; } $table[$tr][] = $execType; $table[$tr][] = $frequency; $table[$tr][] = $multiple; $table[$tr][] = $lastExecution; $table[$tr][] = $nextDate; } else { // The task object is not valid // Prepare to issue an error /** @var $flashMessage FlashMessage */ $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($GLOBALS['LANG']->getLL('msg.invalidTaskClass'), $class), '', FlashMessage::ERROR); $executionStatusOutput = $flashMessage->render(); $tableLayout[$tr] = $rowWithSpan; $table[$tr][] = $startExecutionElement; $table[$tr][] = $deleteAction; $table[$tr][] = $schedulerRecord['uid']; $table[$tr][] = $executionStatusOutput; } $tr++; } $GLOBALS['TYPO3_DB']->sql_free_result($res); } // Render table $content .= $this->doc->table($table, $tableLayout); $content .= '<button name="go" id="scheduler_executeselected">' . IconUtility::getSpriteIcon('extensions-scheduler-run-task') . ' ' . $GLOBALS['LANG']->getLL('label.executeSelected') . '</button>'; } if (!count($registeredClasses) > 0) { /** @var $flashMessage FlashMessage */ $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('msg.noTasksDefined'), '', FlashMessage::INFO); $content .= $flashMessage->render(); } // Display legend, if there's at least one registered task // Also display information about the usage of server time if ($numRows > 0) { $content .= $this->doc->spacer(20); $extensionRelativePath = ExtensionManagementUtility::extRelPath('scheduler'); $content .= '<h3>' . $GLOBALS['LANG']->getLL('status.legend') . '</h3> <ul> <li><img ' . IconUtility::skinImg($extensionRelativePath, 'Resources/Public/Images/status_failure.png') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.failure')) . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.failure')) . '" /> ' . $GLOBALS['LANG']->getLL('status.legend.failure') . '</li> <li><img ' . IconUtility::skinImg($extensionRelativePath, 'Resources/Public/Images/status_late.png') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.late')) . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.late')) . '" /> ' . $GLOBALS['LANG']->getLL('status.legend.late') . '</li> <li><img ' . IconUtility::skinImg($extensionRelativePath, 'Resources/Public/Images/status_running.png') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.running')) . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.running')) . '" /> ' . $GLOBALS['LANG']->getLL('status.legend.running') . '</li> <li><img ' . IconUtility::skinImg($extensionRelativePath, 'Resources/Public/Images/status_scheduled.png') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.scheduled')) . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.scheduled')) . '" /> ' . $GLOBALS['LANG']->getLL('status.legend.scheduled') . '</li> <li><img ' . IconUtility::skinImg($extensionRelativePath, 'Resources/Public/Images/status_disabled.png') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.disabled')) . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.disabled')) . '" /> ' . $GLOBALS['LANG']->getLL('status.legend.disabled') . '</li> </ul>'; $content .= $this->displayServerTime(); } return $content; }
/** * Construct */ public function __construct() { $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); $this->fileRepository = GeneralUtility::makeInstance(FileRepository::class); $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $this->pageRenderer->loadJquery(); $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Recordlist/FieldSelectBox'); }