|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 Steffen Kamper <steffen@typo3.org> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00027 00028 /** 00029 * ExtDirect DataProvider for State 00030 */ 00031 class extDirect_DataProvider_State { 00032 00033 /** @var extDirect_DataProvider_BackenduserSettings */ 00034 protected $userSettings; 00035 00036 /** 00037 * Constructor 00038 * 00039 * @return void 00040 */ 00041 public function __construct() { 00042 //all data is saved in BE_USER->uc 00043 $this->userSettings = t3lib_div::makeInstance('extDirect_DataProvider_BackenduserSettings'); 00044 } 00045 00046 /** 00047 * Gets state for given key 00048 * 00049 * @param stdClass $parameter 00050 * @return array 00051 */ 00052 public function getState($parameter) { 00053 $key = $parameter->params->key; 00054 $data = $this->userSettings->get($key); 00055 00056 return array( 00057 'success' => TRUE, 00058 'data' => $data 00059 ); 00060 } 00061 00062 /** 00063 * Save the state for a given key 00064 * 00065 * @param stdClass $parameter 00066 * @return array 00067 */ 00068 public function setState($parameter) { 00069 $key = $parameter->params->key; 00070 $data = json_decode($parameter->params->data); 00071 00072 $this->userSettings->set($key . '.' . $data[0]->name, $data[0]->value); 00073 return array( 00074 'success' => TRUE, 00075 'params' => $parameter 00076 ); 00077 } 00078 00079 00080 } 00081 00082 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/extjs/dataprovider/class.extdirect_dataprovider_state.php'])) { 00083 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/extjs/dataprovider/class.extdirect_dataprovider_state.php']); 00084 } 00085 00086 ?>
1.8.0