TYPO3
7.6
|
Public Member Functions | |
__construct () | |
init ($prefix= '', $storeList= '') | |
setSessionType ($type= 'ses') | |
setStoreList ($storeList) | |
addToStoreList ($storeList) | |
addToStoreListFromPrefix ($prefix= '') | |
initStorage () | |
cleanupStorageArray ($storedSettings) | |
compileEntry ($data) | |
getStoredData ($storeIndex, $writeArray=array()) | |
processStoreControl ($mconfName= '') | |
writeStoredSetting ($writeArray=array(), $mconfName= '') | |
getStoreControl ($showElements= 'load, remove, save', $useOwnForm=true) | |
processEntry ($storageArr) | |
Public Attributes | |
$type = 'perm' | |
$prefix = '' | |
$storeList = array() | |
$storedSettings = array() | |
$msg = '' | |
$formName = 'storeControl' | |
$writeDevLog = false | |
Protected Member Functions | |
getModule () | |
Manage storing and restoring of $this->getModule()->MOD_SETTINGS settings. Provides a presets box for BE modules.
usage inside of BaseScriptClass class
....
$this->MOD_MENU = array( 'function' => array('xxx'), 'tx_someext_storedSettings' => '',
....
function main() { // reStore settings $store = ::makeInstance(::class); $store->init('tx_someext'); $store->setStoreList('tx_someext'); $store->processStoreControl();
// show control panel $this->content .= '
' . '
';
Format of saved settings
$this->getModule()->MOD_SETTINGS[$this->prefix . '_storedSettings'] = serialize( array ( 'any id' => array( 'title' => 'title for saved settings', 'desc' => 'description text, not mandatory', 'data' => array(), // data from MOD_SETTINGS 'user' => NULL, // can be used for extra data used by the application to identify this entry 'tstamp' => 12345, // $GLOBALS['EXEC_TIME'] ), 'another id' => ... )
Definition at line 60 of file ModuleSettings.php.
__construct | ( | ) |
Default constructor
Definition at line 121 of file ModuleSettings.php.
References GeneralUtility\deprecationLog().
addToStoreList | ( | $storeList | ) |
Add MOD_SETTINGS keys to the current list
array | string | $storeList | Add names of keys of the MOD_SETTING array which should be stored |
Definition at line 181 of file ModuleSettings.php.
References ModuleSettings\$storeList, GeneralUtility\devLog(), and GeneralUtility\trimExplode().
Referenced by ModuleSettings\setStoreList().
addToStoreListFromPrefix | ( | $prefix = '' | ) |
Add names of keys of the MOD_SETTING array by a prefix
string | $prefix | Prefix of MOD_SETTING array keys that should be stored |
Definition at line 196 of file ModuleSettings.php.
References ModuleSettings\$prefix, GeneralUtility\devLog(), and ModuleSettings\getModule().
cleanupStorageArray | ( | $storedSettings | ) |
Remove corrupted data entries from the stored settings array
array | $storedSettings | The stored settings |
Definition at line 233 of file ModuleSettings.php.
References ModuleSettings\$storedSettings, and elseif.
Referenced by ModuleSettings\initStorage().
compileEntry | ( | $data | ) |
Creates an entry for the stored settings array Collects data from MOD_SETTINGS selected by the storeList
array | $data | Should work with data from _GP('storeControl'). This is ['title']: Title for the entry. ['desc']: A description text. Currently not used by this class |
Definition at line 256 of file ModuleSettings.php.
References $GLOBALS, ModuleSettings\getModule(), and ModuleSettings\processEntry().
|
protected |
Definition at line 465 of file ModuleSettings.php.
References $GLOBALS.
Referenced by ModuleSettings\addToStoreListFromPrefix(), ModuleSettings\compileEntry(), and ModuleSettings\initStorage().
getStoreControl | ( | $showElements = 'load , |
|
remove | , | ||
save' | , | ||
$useOwnForm = true |
|||
) |
Returns the storage control box
string | $showElements | List of elemetns which should be shown: load,remove,save |
bool | $useOwnForm | If set the box is wrapped with own form tag |
Definition at line 378 of file ModuleSettings.php.
getStoredData | ( | $storeIndex, | |
$writeArray = array() |
|||
) |
Copies the stored data from entry $index to $writeArray which can be used to set MOD_SETTINGS
mixed | $storeIndex | The entry key |
array | $writeArray | Preset data array. Will be overwritten by copied values. |
Definition at line 280 of file ModuleSettings.php.
Referenced by ModuleSettings\processStoreControl().
init | ( | $prefix = '' , |
|
$storeList = '' |
|||
) |
Initializes the object
string | $prefix | Prefix of MOD_SETTING array keys that should be stored |
array | string | $storeList | Additional names of keys of the MOD_SETTING array which should be stored (array or comma list) |
Definition at line 133 of file ModuleSettings.php.
References $GLOBALS, ModuleSettings\$prefix, ModuleSettings\$storeList, and ModuleSettings\setStoreList().
initStorage | ( | ) |
Get the stored settings from MOD_SETTINGS and set them in $this->storedSettings
Definition at line 221 of file ModuleSettings.php.
References ModuleSettings\$storedSettings, ModuleSettings\cleanupStorageArray(), and ModuleSettings\getModule().
Referenced by ModuleSettings\processStoreControl().
processEntry | ( | $storageArr | ) |
Processing entry for the stored settings array Can be overwritten by extended class
array | $storageArr | Entry for the stored settings array |
Definition at line 457 of file ModuleSettings.php.
Referenced by ModuleSettings\compileEntry().
processStoreControl | ( | $mconfName = '' | ) |
Processing of the storage command LOAD, SAVE, REMOVE
string | $mconfName | Name of the module to store the settings for. Default: $this->getModule()->MCONF['name'] (current module) |
Definition at line 296 of file ModuleSettings.php.
References ModuleSettings\$msg, GeneralUtility\_GP(), GeneralUtility\arrayToLogString(), GeneralUtility\devLog(), ModuleSettings\getStoredData(), and ModuleSettings\initStorage().
setSessionType | ( | $type = 'ses' | ) |
Set session type to 'ses' which will store the settings data not permanently.
string | $type | Default is 'ses' |
Definition at line 153 of file ModuleSettings.php.
References ModuleSettings\$type.
setStoreList | ( | $storeList | ) |
Set MOD_SETTINGS keys which should be stored
array | string | $storeList | Add names of keys of the MOD_SETTING array which should be stored |
Definition at line 169 of file ModuleSettings.php.
References ModuleSettings\$storeList, and ModuleSettings\addToStoreList().
Referenced by ModuleSettings\init().
writeStoredSetting | ( | $writeArray = array() , |
|
$mconfName = '' |
|||
) |
Write the current storage array and update MOD_SETTINGS
array | $writeArray | Array of settings which should be overwrite current MOD_SETTINGS |
string | $mconfName | Name of the module to store the settings for. Default: $this->getModule()->MCONF['name'] (current module) |
Definition at line 349 of file ModuleSettings.php.
$formName = 'storeControl' |
Definition at line 103 of file ModuleSettings.php.
$msg = '' |
Definition at line 96 of file ModuleSettings.php.
Referenced by ModuleSettings\processStoreControl().
$prefix = '' |
Definition at line 75 of file ModuleSettings.php.
Referenced by ModuleSettings\addToStoreListFromPrefix(), and ModuleSettings\init().
$storedSettings = array() |
Definition at line 89 of file ModuleSettings.php.
Referenced by ModuleSettings\cleanupStorageArray(), and ModuleSettings\initStorage().
$storeList = array() |
Definition at line 82 of file ModuleSettings.php.
Referenced by ModuleSettings\addToStoreList(), ModuleSettings\init(), and ModuleSettings\setStoreList().
$type = 'perm' |
Definition at line 68 of file ModuleSettings.php.
Referenced by ModuleSettings\setSessionType().
$writeDevLog = false |
Definition at line 110 of file ModuleSettings.php.