[TASK] Re-work/simplify copyright header in PHP files - Part 9
[Packages/TYPO3.CMS.git] / typo3 / sysext / taskcenter / Classes / TaskStatus.php
1 <?php
2 namespace TYPO3\CMS\Taskcenter;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Status of tasks
19 *
20 * @author Georg Ringer <typo3@ringerge.org>
21 */
22 class TaskStatus {
23
24 /**
25 * Saves the section toggle state of tasks in the backend user's uc
26 *
27 * @param array $params Array of parameters from the AJAX interface, currently unused
28 * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
29 * @return void
30 */
31 public function saveCollapseState(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj) {
32 // Remove 'el_' in the beginning which is needed for the saveSortingState()
33 $item = substr(htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('item')), 3);
34 $state = (bool) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('state');
35 $GLOBALS['BE_USER']->uc['taskcenter']['states'][$item] = $state;
36 $GLOBALS['BE_USER']->writeUC();
37 }
38
39 /**
40 * Saves the sorting order of tasks in the backend user's uc
41 *
42 * @param array $params Array of parameters from the AJAX interface, currently unused
43 * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
44 * @return void
45 */
46 public function saveSortingState(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj) {
47 $sort = array();
48 $items = explode('&', \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('data'));
49 foreach ($items as $item) {
50 $sort[] = substr($item, 12);
51 }
52 $GLOBALS['BE_USER']->uc['taskcenter']['sorting'] = serialize($sort);
53 $GLOBALS['BE_USER']->writeUC();
54 }
55
56 }