129 $this->type =
'perm';
131 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_modSettings.php'][
'writeDevLog']) {
132 $this->writeDevLog = TRUE;
135 $this->writeDevLog = TRUE;
164 if ($this->writeDevLog) {
165 GeneralUtility::devLog(
'Store list:' . implode(
',', $this->storeList),
'TYPO3\\CMS\\Backend\\ModuleSettings', 0);
178 $this->storeList = array_merge($this->storeList,
$storeList);
179 if ($this->writeDevLog) {
180 GeneralUtility::devLog(
'Store list:' . implode(
',', $this->storeList),
'TYPO3\\CMS\\Backend\\ModuleSettings', 0);
194 foreach (
$GLOBALS[
'SOBE']->MOD_SETTINGS as $key => $value) {
195 if (preg_match(
'/^' .
$prefix .
'/', $key)) {
196 $this->storeList[$key] = $key;
199 unset($this->storeList[$this->prefix .
'_storedSettings']);
200 if ($this->writeDevLog) {
201 GeneralUtility::devLog(
'Store list:' . implode(
',', $this->storeList),
'TYPO3\\CMS\\Backend\\ModuleSettings', 0);
232 if (!is_array($sdArr)) {
235 if (!is_array($sdArr[
'data'])) {
238 if (!trim($sdArr[
'title'])) {
254 $storageData = array();
255 foreach ($this->storeList as $MS_key) {
256 $storageData[$MS_key] =
$GLOBALS[
'SOBE']->MOD_SETTINGS[$MS_key];
259 'title' => $data[
'title'],
260 'desc' => (
string) $data[
'desc'],
261 'data' => $storageData,
278 if ($this->storedSettings[$storeIndex]) {
279 foreach ($this->storeList as $k) {
280 $writeArray[$k] = $this->storedSettings[$storeIndex][
'data'][$k];
296 $storeIndex = $storeControl[
'STORE'];
298 $saveSettings = FALSE;
299 $writeArray = array();
300 if (is_array($storeControl)) {
301 if ($this->writeDevLog) {
305 if ($storeControl[
'LOAD'] and $storeIndex) {
306 $writeArray = $this->
getStoredData($storeIndex, $writeArray);
307 $saveSettings = TRUE;
308 $msg =
'\'' . $this->storedSettings[$storeIndex][
'title'] .
'\' preset loaded!
'; 309 } elseif ($storeControl['SAVE
']) { 310 if (trim($storeControl['title
'])) { 311 // Get the data to store 312 $newEntry = $this->compileEntry($storeControl); 313 // Create an index for the storage array 315 $storeIndex = GeneralUtility::shortMD5($newEntry['title
']); 317 // Add data to the storage array 318 $this->storedSettings[$storeIndex] = $newEntry; 319 $saveSettings = TRUE; 320 $msg = '\
'' . $newEntry[
'title'] .
'\' preset saved!
'; 322 $msg = 'Please enter a name
for the preset!
'; 324 } elseif ($storeControl['REMOVE
'] and $storeIndex) { 326 $msg = '\
'' . $this->storedSettings[$storeIndex][
'title'] .
'\' preset entry removed!
'; 327 unset($this->storedSettings[$storeIndex]); 328 $saveSettings = TRUE; 332 $this->writeStoredSetting($writeArray, $mconfName); 346 public function writeStoredSetting($writeArray = array(), $mconfName = '') { 347 // Making sure, index 0 is not set 348 unset($this->storedSettings[0]); 349 $this->storedSettings = $this->cleanupStorageArray($this->storedSettings); 350 $writeArray[$this->prefix . '_storedSettings
'] = serialize($this->storedSettings); 351 $GLOBALS['SOBE
']->MOD_SETTINGS = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleData($GLOBALS['SOBE
']->MOD_MENU, $writeArray, $mconfName ? $mconfName : $GLOBALS['SOBE
']->MCONF['name
'], $this->type); 352 if ($this->writeDevLog) { 353 GeneralUtility::devLog('Settings stored:
' . $this->msg, 'TYPO3\\CMS\\Backend\
\ModuleSettings', 0); 357 /******************************** 361 ********************************/ 370 public function getStoreControl($showElements = 'load,
remove,save
', $useOwnForm = TRUE) { 371 $showElements = GeneralUtility::trimExplode(',
', $showElements, TRUE); 372 $this->initStorage(); 375 $opt[] = '<option value=
"0"> </option>
'; 376 foreach ($this->storedSettings as $id => $v) { 377 $opt[] = '<option value=
"' . $id . '">
' . htmlspecialchars($v['title
']) . '</option>
'; 379 $storedEntries = count($opt) > 1; 381 // LOAD, REMOVE, but also show selector so you can overwrite an entry with SAVE 382 if ($storedEntries and count($showElements)) { 384 $onChange = 'document.forms[\
'' . $this->formName .
'\'][\
'storeControl[title]\'].value= this.options[this.selectedIndex].value!=0 ? this.options[this.selectedIndex].text : \'\';';
386 <select name="storeControl[STORE]" onChange="' . htmlspecialchars($onChange) .
'"> 391 if (in_array(
'load', $showElements)) {
393 <input type="submit" name="storeControl[LOAD]" value="Load" /> ';
396 if (in_array(
'remove', $showElements)) {
398 <input type="submit" name="storeControl[REMOVE]" value="Remove" /> ';
400 $codeTD[] =
'<td width="1%">Preset:</td>';
401 $codeTD[] =
'<td nowrap="nowrap">' . $code .
' </td>';
404 if (in_array(
'save', $showElements)) {
405 $onClick = !$storedEntries ?
'' :
'if (document.forms[\'' . $this->formName .
'\'][\
'storeControl[STORE]\'].options[document.forms[\'' . $this->formName .
'\'][\
'storeControl[STORE]\'].selectedIndex].value<0) return confirm(\'Are you sure you want to overwrite the existing entry?\');';
406 $code =
'<input name="storeControl[title]" value="" type="text" max="80" width="25"> ';
407 $code .=
'<input type="submit" name="storeControl[SAVE]" value="Save" onClick="' . htmlspecialchars($onClick) .
'" />';
408 $codeTD[] =
'<td nowrap="nowrap">' . $code .
'</td>';
417 <table border="0" cellpadding="3" cellspacing="0" width="100%"> 418 <tr class="bgColor4"> 426 <div><strong>' . htmlspecialchars($this->msg) .
'</strong></div>';
429 if ($useOwnForm and trim($code)) {
431 <form action="' .
GeneralUtility::getIndpEnv(
'SCRIPT_NAME') .
'" method="post" name="' . $this->formName .
'" enctype="' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'form_enctype'] .
'">' . $code .
'</form>';
init($prefix='', $storeList='')
getStoredData($storeIndex, $writeArray=array())
static devLog($msg, $extKey, $severity=0, $dataVar=FALSE)
static arrayToLogString(array $arr, $valueList=array(), $valueLength=20)
static getIndpEnv($getEnvName)
processStoreControl($mconfName='')
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
addToStoreListFromPrefix($prefix='')
cleanupStorageArray($storedSettings)
setSessionType($type='ses')
processEntry($storageArr)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
addToStoreList($storeList)