diff --git a/typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php b/typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php index 23712f082e4598e51f477cb4d474d73a9acf9504..599284205ce5b3c4e9239f6d67c7fa110609e9b4 100644 --- a/typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php +++ b/typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php @@ -19,6 +19,7 @@ use TYPO3\CMS\Backend\Utility\IconUtility; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Taskcenter\TaskInterface; /** * This class provides a taskcenter for BE users @@ -41,8 +42,6 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass { /** * Initializes the Module - * - * @return void */ public function __construct() { $this->getLanguageService()->includeLLFile('EXT:taskcenter/task/locallang.xlf'); @@ -97,7 +96,7 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass { $this->renderModuleContent(); } // Compile document - $markers['FUNC_MENU'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(0, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode']); + $markers['FUNC_MENU'] = BackendUtility::getFuncMenu(0, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode']); $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); @@ -120,18 +119,17 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass { * @return void */ protected function renderModuleContent() { - $title = ($content = ($actionContent = '')); $chosenTask = (string)$this->MOD_SETTINGS['function']; // Render the taskcenter task as default if (empty($chosenTask) || $chosenTask == 'index') { $chosenTask = 'taskcenter.tasks'; } // Render the task + $actionContent = ''; list($extKey, $taskClass) = explode('.', $chosenTask, 2); - $title = $this->getLanguageService()->sL($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter'][$extKey][$taskClass]['title']); if (class_exists($taskClass)) { $taskInstance = GeneralUtility::makeInstance($taskClass, $this); - if ($taskInstance instanceof \TYPO3\CMS\Taskcenter\TaskInterface) { + if ($taskInstance instanceof TaskInterface) { // Check if the task is restricted to admins only if ($this->checkAccess($extKey, $taskClass)) { $actionContent .= $taskInstance->getTask(); @@ -148,7 +146,7 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass { // Error if the task is not an instance of \TYPO3\CMS\Taskcenter\TaskInterface $flashMessage = GeneralUtility::makeInstance( FlashMessage::class, - sprintf($this->getLanguageService()->getLL('error_no-instance', TRUE), $taskClass, \TYPO3\CMS\Taskcenter\TaskInterface::class), + sprintf($this->getLanguageService()->getLL('error_no-instance', TRUE), $taskClass, TaskInterface::class), $this->getLanguageService()->getLL('error_header'), FlashMessage::ERROR ); @@ -247,7 +245,7 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass { $icon = '<img src="' . $icon . '" title="' . $title . '" alt="' . $title . '" />'; } if (@is_file($icon)) { - $icon = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], $icon, 'width="16" height="16"') . ' title="' . $title . '" alt="' . $title . '" />'; + $icon = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], $icon, 'width="16" height="16"') . ' title="' . $title . '" alt="' . $title . '" />'; } } else { $icon = $item['icon']; @@ -272,10 +270,12 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass { $active = (string)$this->MOD_SETTINGS['function'] == $item['uid'] ? ' active-task' : ''; // Main menu: Render additional syntax to sort tasks if ($mainMenu) { - $dragIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-move', array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.move', TRUE))); + $dragIcon = IconUtility::getSpriteIcon('actions-document-move', array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.move', TRUE))); $section = '<div class="down"> </div> <div class="drag">' . $dragIcon . '</div>'; $backgroundClass = 't3-row-header '; + } else { + $backgroundClass = ''; } $content .= '<li class="' . $additionalClass . $active . '" id="el_' . $id . '"> ' . $section . ' @@ -316,7 +316,7 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass { } if (class_exists($taskClass)) { $taskInstance = GeneralUtility::makeInstance($taskClass, $this); - if ($taskInstance instanceof \TYPO3\CMS\Taskcenter\TaskInterface) { + if ($taskInstance instanceof TaskInterface) { $taskDescriptionHtml = $taskInstance->getOverview(); } } diff --git a/typo3/sysext/taskcenter/Classes/TaskStatus.php b/typo3/sysext/taskcenter/Classes/TaskStatus.php index a223e19bd51e6a5b90698cb157dccf2764143b82..74caa6af29e3f4f87a81722680418cfc24155a14 100644 --- a/typo3/sysext/taskcenter/Classes/TaskStatus.php +++ b/typo3/sysext/taskcenter/Classes/TaskStatus.php @@ -14,6 +14,9 @@ namespace TYPO3\CMS\Taskcenter; * The TYPO3 project - inspiring people to share! */ +use TYPO3\CMS\Core\Http\AjaxRequestHandler; +use TYPO3\CMS\Core\Utility\GeneralUtility; + /** * Status of tasks * @@ -25,32 +28,41 @@ class TaskStatus { * Saves the section toggle state of tasks in the backend user's uc * * @param array $params Array of parameters from the AJAX interface, currently unused - * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler + * @param AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler * @return void */ - public function saveCollapseState(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj) { + public function saveCollapseState(array $params, AjaxRequestHandler $ajaxObj) { // Remove 'el_' in the beginning which is needed for the saveSortingState() - $item = substr(htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('item')), 3); - $state = (bool)\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('state'); - $GLOBALS['BE_USER']->uc['taskcenter']['states'][$item] = $state; - $GLOBALS['BE_USER']->writeUC(); + $item = substr(htmlspecialchars(GeneralUtility::_POST('item')), 3); + $state = (bool)GeneralUtility::_POST('state'); + $this->getBackendUserAuthentication()->uc['taskcenter']['states'][$item] = $state; + $this->getBackendUserAuthentication()->writeUC(); } /** * Saves the sorting order of tasks in the backend user's uc * * @param array $params Array of parameters from the AJAX interface, currently unused - * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler + * @param AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler * @return void */ - public function saveSortingState(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj) { + public function saveSortingState(array $params, AjaxRequestHandler $ajaxObj) { $sort = array(); - $items = explode('&', \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('data')); + $items = explode('&', GeneralUtility::_POST('data')); foreach ($items as $item) { $sort[] = substr($item, 12); } - $GLOBALS['BE_USER']->uc['taskcenter']['sorting'] = serialize($sort); - $GLOBALS['BE_USER']->writeUC(); + $this->getBackendUserAuthentication()->uc['taskcenter']['sorting'] = serialize($sort); + $this->getBackendUserAuthentication()->writeUC(); + } + + /** + * Returns BackendUserAuthentication + * + * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication + */ + protected function getBackendUserAuthentication() { + return $GLOBALS['BE_USER']; } }