[TASK] Use name-resolution instead of strings where possible: 12
[Packages/TYPO3.CMS.git] / typo3 / sysext / scheduler / Classes / Task / CachingFrameworkGarbageCollectionAdditionalFieldProvider.php
index d831561..d70c0c3 100644 (file)
@@ -1,35 +1,24 @@
 <?php
 namespace TYPO3\CMS\Scheduler\Task;
 
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2009-2011 Christian Kuhn <lolli@schwarzbu.ch>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+/**
+ * This file is part of the TYPO3 CMS project.
  *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
  *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
  *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
+ * The TYPO3 project - inspiring people to share!
+ */
+
 /**
  * Additional BE fields for caching framework garbage collection task.
  * Creates a multi selectbox with all available cache backends to select from.
  *
  * @author Christian Kuhn <lolli@schwarzbu.ch>
- * @package TYPO3
- * @subpackage scheduler
  */
 class CachingFrameworkGarbageCollectionAdditionalFieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface {
 
@@ -45,24 +34,24 @@ class CachingFrameworkGarbageCollectionAdditionalFieldProvider implements \TYPO3
                // Initialize selected fields
                if (empty($taskInfo['scheduler_cachingFrameworkGarbageCollection_selectedBackends'])) {
                        $taskInfo['scheduler_cachingFrameworkGarbageCollection_selectedBackends'] = array();
-                       if ($parentObject->CMD == 'add') {
+                       if ($parentObject->CMD === 'add') {
                                // In case of new task, set to dbBackend if it's available
-                               if (in_array('TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend', $this->getRegisteredBackends())) {
-                                       $taskInfo['scheduler_cachingFrameworkGarbageCollection_selectedBackends'][] = 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend';
+                               if (in_array(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, $this->getRegisteredBackends())) {
+                                       $taskInfo['scheduler_cachingFrameworkGarbageCollection_selectedBackends'][] = \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class;
                                }
-                       } elseif ($parentObject->CMD == 'edit') {
+                       } elseif ($parentObject->CMD === 'edit') {
                                // In case of editing the task, set to currently selected value
                                $taskInfo['scheduler_cachingFrameworkGarbageCollection_selectedBackends'] = $task->selectedBackends;
                        }
                }
-               $fieldName = 'TYPO3\\CMS\\Scheduler\\Scheduler[scheduler_cachingFrameworkGarbageCollection_selectedBackends][]';
+               $fieldName = 'tx_scheduler[scheduler_cachingFrameworkGarbageCollection_selectedBackends][]';
                $fieldId = 'task_cachingFrameworkGarbageCollection_selectedBackends';
                $fieldOptions = $this->getCacheBackendOptions($taskInfo['scheduler_cachingFrameworkGarbageCollection_selectedBackends']);
-               $fieldHtml = ((((('<select name="' . $fieldName) . '" id="') . $fieldId) . '" class="wide" size="10" multiple="multiple">') . $fieldOptions) . '</select>';
+               $fieldHtml = '<select name="' . $fieldName . '" id="' . $fieldId . '" class="wide" size="10" multiple="multiple">' . $fieldOptions . '</select>';
                $additionalFields[$fieldId] = array(
                        'code' => $fieldHtml,
-                       'label' => 'LLL:EXT:scheduler/mod1/locallang.xml:label.cachingFrameworkGarbageCollection.selectBackends',
-                       'cshKey' => '_MOD_tools_txschedulerM1',
+                       'label' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.cachingFrameworkGarbageCollection.selectBackends',
+                       'cshKey' => '_MOD_system_txschedulerM1',
                        'cshLabel' => $fieldId
                );
                return $additionalFields;
@@ -73,7 +62,7 @@ class CachingFrameworkGarbageCollectionAdditionalFieldProvider implements \TYPO3
         *
         * @param array $submittedData Reference to the array containing the data submitted by the user
         * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject Reference to the calling object (Scheduler's BE module)
-        * @return boolean TRUE if validation was ok (or selected class is not relevant), FALSE otherwise
+        * @return bool TRUE if validation was ok (or selected class is not relevant), FALSE otherwise
         */
        public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject) {
                $validData = TRUE;
@@ -81,11 +70,11 @@ class CachingFrameworkGarbageCollectionAdditionalFieldProvider implements \TYPO3
                if (is_array($submittedData['scheduler_cachingFrameworkGarbageCollection_selectedBackends'])) {
                        $invalidBackends = array_diff($submittedData['scheduler_cachingFrameworkGarbageCollection_selectedBackends'], $availableBackends);
                        if (!empty($invalidBackends)) {
-                               $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xml:msg.selectionOfNonExistingCacheBackends'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
+                               $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:msg.selectionOfNonExistingCacheBackends'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                                $validData = FALSE;
                        }
                } else {
-                       $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xml:msg.noCacheBackendSelected'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
+                       $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:msg.noCacheBackendSelected'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                        $validData = FALSE;
                }
                return $validData;
@@ -95,10 +84,10 @@ class CachingFrameworkGarbageCollectionAdditionalFieldProvider implements \TYPO3
         * Save selected backends in task object
         *
         * @param array $submittedData Contains data submitted by the user
-        * @param \TYPO3\CMS\Scheduler\Task $task Reference to the current task object
+        * @param \TYPO3\CMS\Scheduler\Task\AbstractTask $task Reference to the current task object
         * @return void
         */
-       public function saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task $task) {
+       public function saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task) {
                $task->selectedBackends = $submittedData['scheduler_cachingFrameworkGarbageCollection_selectedBackends'];
        }
 
@@ -117,7 +106,7 @@ class CachingFrameworkGarbageCollectionAdditionalFieldProvider implements \TYPO3
                        } else {
                                $selected = '';
                        }
-                       $options[] = ((((('<option value="' . $backendName) . '"') . $selected) . '>') . $backendName) . '</option>';
+                       $options[] = '<option value="' . $backendName . '"' . $selected . '>' . $backendName . '</option>';
                }
                return implode('', $options);
        }
@@ -142,6 +131,3 @@ class CachingFrameworkGarbageCollectionAdditionalFieldProvider implements \TYPO3
        }
 
 }
-
-
-?>
\ No newline at end of file