[TASK] Replace Space Indent into Tab indent (CGL Cleanup)
[Packages/TYPO3.CMS.git] / typo3 / sysext / taskcenter / classes / class.tx_taskcenter_status.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010-2011 Georg Ringer <typo3@ringerge.org>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25
26 /**
27 * Status of tasks
28 *
29 * @author Georg Ringer <typo3@ringerge.org>
30 * @package TYPO3
31 * @subpackage taskcenter
32 *
33 */
34 class tx_taskcenter_status {
35
36 /**
37 * Saves the section toggle state of tasks in the backend user's uc
38 *
39 * @param array array of parameters from the AJAX interface, currently unused
40 * @param TYPO3AJAX object of type TYPO3AJAX
41 * @return void
42 */
43 public function saveCollapseState(array $params, TYPO3AJAX $ajaxObj) {
44 // remove 'el_' in the beginning which is needed for the saveSortingState()
45 $item = substr(htmlspecialchars(t3lib_div::_POST('item')), 3);
46 $state = (bool)t3lib_div::_POST('state');
47
48 $GLOBALS['BE_USER']->uc['taskcenter']['states'][$item] = $state;
49 $GLOBALS['BE_USER']->writeUC();
50 }
51
52
53 /**
54 * Saves the sorting order of tasks in the backend user's uc
55 *
56 * @param array array of parameters from the AJAX interface, currently unused
57 * @param TYPO3AJAX object of type TYPO3AJAX
58 * @return void
59 */
60 public function saveSortingState(array $params, TYPO3AJAX $ajaxObj) {
61 $sort = array();
62 $items = explode('&', t3lib_div::_POST('data'));
63 foreach($items as $item) {
64 $sort[] = substr($item, 12);
65 }
66
67 $GLOBALS['BE_USER']->uc['taskcenter']['sorting'] = serialize($sort);
68 $GLOBALS['BE_USER']->writeUC();
69 }
70 }
71 ?>