TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Backend\ModuleSettings Class Reference
Inheritance diagram for TYPO3\CMS\Backend\ModuleSettings:
t3lib_modSettings

Public Member Functions

 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 = 0
 

Detailed Description

Manage storing and restoring of $GLOBALS['SOBE']->MOD_SETTINGS settings. Provides a presets box for BE modules.

usage inside of scbase class

....

$this->MOD_MENU = array( 'function' => array( 'xxx ... ), 'tx_dam_select_storedSettings' => '',

....

function main() { reStore settings $store = ::makeInstance('TYPO3\CMS\Backend\ModuleSettings'); $store->init('tx_dam_select'); $store->setStoreList('tx_dam_select'); $store->processStoreControl();

show control panel $this->content.= $this->doc->section('Settings',$store->getStoreControl(),0,1);

Format of saved settings

$GLOBALS['SOBE']->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' => ...

) );

Author
René Fritz r.fri.nosp@m.tz@c.nosp@m.olorc.nosp@m.ube..nosp@m.de

Definition at line 62 of file ModuleSettings.php.

Member Function Documentation

◆ addToStoreList()

TYPO3\CMS\Backend\ModuleSettings::addToStoreList (   $storeList)

Add MOD_SETTINGS keys to the current list

Parameters
mixedArray or string (,) - add names of keys of the MOD_SETTING array which should be stored
Returns
void
Todo:
Define visibility

Definition at line 176 of file ModuleSettings.php.

References TYPO3\CMS\Backend\ModuleSettings\$storeList, TYPO3\CMS\Core\Utility\GeneralUtility\devLog(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

◆ addToStoreListFromPrefix()

TYPO3\CMS\Backend\ModuleSettings::addToStoreListFromPrefix (   $prefix = '')

Add names of keys of the MOD_SETTING array by a prefix

Parameters
string$prefixPrefix of MOD_SETTING array keys that should be stored
Returns
void
Todo:
Define visibility

Definition at line 191 of file ModuleSettings.php.

References $GLOBALS, TYPO3\CMS\Backend\ModuleSettings\$prefix, and TYPO3\CMS\Core\Utility\GeneralUtility\devLog().

◆ cleanupStorageArray()

TYPO3\CMS\Backend\ModuleSettings::cleanupStorageArray (   $storedSettings)

Remove corrupted data entries from the stored settings array

Parameters
array$storedSettingsThe stored settings
Returns
array Cleaned up stored settings
Todo:
Define visibility

Definition at line 228 of file ModuleSettings.php.

References TYPO3\CMS\Backend\ModuleSettings\$storedSettings.

Referenced by TYPO3\CMS\Backend\ModuleSettings\initStorage().

◆ compileEntry()

TYPO3\CMS\Backend\ModuleSettings::compileEntry (   $data)

Creates an entry for the stored settings array Collects data from MOD_SETTINGS selected by the storeList

Parameters
array$dataShould work with data from _GP('storeControl'). This is ['title']: Title for the entry. ['desc']: A description text. Currently not used by this class
Returns
array Entry for the stored settings array
Todo:
Define visibility

Definition at line 253 of file ModuleSettings.php.

References $GLOBALS, and TYPO3\CMS\Backend\ModuleSettings\processEntry().

◆ getStoreControl()

TYPO3\CMS\Backend\ModuleSettings::getStoreControl (   $showElements = 'load,
remove  ,
save'  ,
  $useOwnForm = TRUE 
)

Returns the storage control box

Parameters
string$showElementsList of elemetns which should be shown: load,remove,save
boolean$useOwnFormIf set the box is wrapped with own form tag
Returns
string HTML code
Todo:
Define visibility

Definition at line 370 of file ModuleSettings.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\GeneralUtility\getIndpEnv().

◆ getStoredData()

TYPO3\CMS\Backend\ModuleSettings::getStoredData (   $storeIndex,
  $writeArray = array() 
)

Copies the stored data from entry $index to $writeArray which can be used to set MOD_SETTINGS

Parameters
mixed$storeIndexThe entry key
array$writeArrayPreset data array. Will be overwritten by copied values.
Returns
array Data array
Todo:
Define visibility

Definition at line 277 of file ModuleSettings.php.

Referenced by TYPO3\CMS\Backend\ModuleSettings\processStoreControl().

◆ init()

TYPO3\CMS\Backend\ModuleSettings::init (   $prefix = '',
  $storeList = '' 
)

Initializes the object

Parameters
string$prefixPrefix of MOD_SETTING array keys that should be stored
array$storeListAdditional names of keys of the MOD_SETTING array which should be stored (array or comma list)
Returns
void
Todo:
Define visibility

Definition at line 126 of file ModuleSettings.php.

References $GLOBALS, TYPO3\CMS\Backend\ModuleSettings\$prefix, TYPO3\CMS\Backend\ModuleSettings\$storeList, and TYPO3\CMS\Backend\ModuleSettings\setStoreList().

◆ initStorage()

TYPO3\CMS\Backend\ModuleSettings::initStorage ( )

Get the stored settings from MOD_SETTINGS and set them in $this->storedSettings

Returns
void
Todo:
Define visibility

Definition at line 216 of file ModuleSettings.php.

References $GLOBALS, TYPO3\CMS\Backend\ModuleSettings\$storedSettings, and TYPO3\CMS\Backend\ModuleSettings\cleanupStorageArray().

Referenced by TYPO3\CMS\Backend\ModuleSettings\processStoreControl().

◆ processEntry()

TYPO3\CMS\Backend\ModuleSettings::processEntry (   $storageArr)

Processing entry for the stored settings array Can be overwritten by extended class

Parameters
array$storageDataEntry for the stored settings array
Returns
array Entry for the stored settings array
Todo:
Define visibility

Definition at line 449 of file ModuleSettings.php.

Referenced by TYPO3\CMS\Backend\ModuleSettings\compileEntry().

◆ processStoreControl()

TYPO3\CMS\Backend\ModuleSettings::processStoreControl (   $mconfName = '')

Processing of the storage command LOAD, SAVE, REMOVE

Parameters
string$mconfNameName of the module to store the settings for. Default: $GLOBALS['SOBE']->MCONF['name'] (current module)
Returns
string Storage message. Also set in $this->msg
Todo:
Define visibility

Definition at line 293 of file ModuleSettings.php.

References TYPO3\CMS\Backend\ModuleSettings\$msg, TYPO3\CMS\Core\Utility\GeneralUtility\_GP(), TYPO3\CMS\Core\Utility\GeneralUtility\arrayToLogString(), TYPO3\CMS\Core\Utility\GeneralUtility\devLog(), TYPO3\CMS\Backend\ModuleSettings\getStoredData(), and TYPO3\CMS\Backend\ModuleSettings\initStorage().

◆ setSessionType()

TYPO3\CMS\Backend\ModuleSettings::setSessionType (   $type = 'ses')

Set session type to 'ses' which will store the settings data not permanently.

Parameters
string$typeDefault is 'ses'
Returns
void
Todo:
Define visibility

Definition at line 146 of file ModuleSettings.php.

References TYPO3\CMS\Backend\ModuleSettings\$type.

◆ setStoreList()

TYPO3\CMS\Backend\ModuleSettings::setStoreList (   $storeList)

Set MOD_SETTINGS keys which should be stored

Parameters
mixed$storeListArray or string (,) - set additional names of keys of the MOD_SETTING array which should be stored
Returns
void
Todo:
Define visibility

Definition at line 162 of file ModuleSettings.php.

References TYPO3\CMS\Backend\ModuleSettings\$storeList, TYPO3\CMS\Core\Utility\GeneralUtility\devLog(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Backend\ModuleSettings\init().

◆ writeStoredSetting()

TYPO3\CMS\Backend\ModuleSettings::writeStoredSetting (   $writeArray = array(),
  $mconfName = '' 
)

Write the current storage array and update MOD_SETTINGS

Parameters
array$writeArrayArray of settings which should be overwrite current MOD_SETTINGS
string$mconfNameName of the module to store the settings for. Default: $GLOBALS['SOBE']->MCONF['name'] (current module)
Returns
void
Todo:
Define visibility

Definition at line 346 of file ModuleSettings.php.

Member Data Documentation

◆ $formName

TYPO3\CMS\Backend\ModuleSettings::$formName = 'storeControl'

Name of the form. Needed for JS

Todo:
Define visibility

Definition at line 105 of file ModuleSettings.php.

◆ $msg

TYPO3\CMS\Backend\ModuleSettings::$msg = ''

Message from the last storage command

Todo:
Define visibility

Definition at line 98 of file ModuleSettings.php.

Referenced by TYPO3\CMS\Backend\ModuleSettings\processStoreControl().

◆ $prefix

TYPO3\CMS\Backend\ModuleSettings::$prefix = ''

prefix of MOD_SETTING array keys that should be stored

Todo:
Define visibility

Definition at line 77 of file ModuleSettings.php.

Referenced by TYPO3\CMS\Backend\ModuleSettings\addToStoreListFromPrefix(), and TYPO3\CMS\Backend\ModuleSettings\init().

◆ $storedSettings

TYPO3\CMS\Backend\ModuleSettings::$storedSettings = array()

The stored settings array

Todo:
Define visibility

Definition at line 91 of file ModuleSettings.php.

Referenced by TYPO3\CMS\Backend\ModuleSettings\cleanupStorageArray(), and TYPO3\CMS\Backend\ModuleSettings\initStorage().

◆ $storeList

TYPO3\CMS\Backend\ModuleSettings::$storeList = array()

Names of keys of the MOD_SETTING array which should be stored

Todo:
Define visibility

Definition at line 84 of file ModuleSettings.php.

Referenced by TYPO3\CMS\Backend\ModuleSettings\addToStoreList(), TYPO3\CMS\Backend\ModuleSettings\init(), and TYPO3\CMS\Backend\ModuleSettings\setStoreList().

◆ $type

TYPO3\CMS\Backend\ModuleSettings::$type = 'perm'

If type is set 'ses' then the module data will be stored into the session and will be lost with logout. Type 'perm' will store the data permanently.

Todo:
Define visibility

Definition at line 70 of file ModuleSettings.php.

Referenced by TYPO3\CMS\Backend\ModuleSettings\setSessionType().

◆ $writeDevLog

TYPO3\CMS\Backend\ModuleSettings::$writeDevLog = 0
Todo:
Define visibility

Definition at line 111 of file ModuleSettings.php.