BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
BsConfig Class Reference

Public Member Functions

 getDefault ()
 
 getValue ()
 
 getKey ()
 
 getAdapter ()
 
 getExtension ()
 
 getI18nExtension ()
 
 getName ()
 
 getI18nName ()
 
 getOptions ()
 
 getFieldMapping ()
 
 getFieldDefinition ($sSection)
 
 generateFieldId ()
 

Static Public Member Functions

static registerVar ($path, $default=null, $options=0, $i18n= '', $sFormFieldMappingName= 'text')
 
static deliverUsersSettings ($bFlag)
 
static set ($path, $value, $bUserValue=false)
 
static get ($sPath)
 
static add ($path, $value)
 
static getScriptSettings ()
 
static loadSettings ()
 
static saveSettings ()
 
static getVarForUser ($sKey, $mUser)
 
static getUsersForVar ($sKey, $vValue, $sSingleValFromMultiple=false, $bSerialized=true)
 
static loadUserSettings ($user)
 
static saveUserSettings ($user)
 
static getRegisteredVars ()
 

Public Attributes

const LEVEL_PRIVATE = 1
 
const LEVEL_PUBLIC = 2
 
const LEVEL_USER = 4
 
const RENDER_AS_JAVASCRIPT = 16
 
const NO_DEFAULT = 262144
 
const SET_WRITE_PROTECTED = 32768
 
const TYPE_BOOL = 32
 
const TYPE_INT = 64
 
const TYPE_FLOAT = 128
 
const TYPE_STRING = 256
 
const TYPE_TEXT = 512
 
const TYPE_OBJECT = 1024
 
const TYPE_ARRAY_INT = 2048
 
const TYPE_ARRAY_STRING = 4096
 
const TYPE_ARRAY_MIXED = 8192
 
const TYPE_ARRAY_BOOL = 16384
 
const TYPE_JSON = 65536
 
const USE_PLUGIN_FOR_PREFS = 131072
 

Protected Member Functions

 __construct ()
 
 setKey ($key)
 
 setAdapter ($adapter)
 
 setExtension ($extension)
 
 setName ($name)
 
 setI18N ($i18n)
 
 setOptions ($options)
 
 setFieldMapping ($sFormFieldMappingName)
 
 setDefault ($default)
 
 _set ($value)
 
 _setUserValue ($value)
 
 _add ($value)
 
 _get ()
 

Static Protected Member Functions

static getSettingObject ($path)
 

Protected Attributes

 $_mKey = null
 
 $_mAdapter = null
 
 $_mExtension = null
 
 $_mName = null
 
 $_mOptions = null
 
 $_mDefault = null
 
 $_mValue = null
 
 $_mUserValue = null
 
 $_mI18n = null
 
 $_mFieldMapping = null
 

Static Protected Attributes

static $prSettings = array ()
 
static $prRegisterAdapter = array ()
 
static $prRegisterExtension = array ()
 
static $prGetUsersSettings = true
 
static $prRegisterJavascript = array ()
 

Constructor & Destructor Documentation

BsConfig::__construct ( )
protected

the constructor

Member Function Documentation

BsConfig::_add (   $value)
protected

This method try to add a given value to the variables actual value.

Actually just the types INT, STRING and BOOL are supported. If the type of the variable is int, the return of this method is an addition of the given value and the set value. If the type is string, the given value will extend the set value. If the type is bool, the result is the same as you would set the value.

Parameters
mixed$value
Returns
mixed the value after the addition
BsConfig::_get ( )
protected

returns the value of this variable

Returns
mixed
BsConfig::_set (   $value)
protected

sets the value of this variable

Parameters
mixed$value
static BsConfig::add (   $path,
  $value 
)
static

adds an value to the variable, which is specified by the path

Parameters
string$pathThe unique identifier the variable should be accessibly by. I.e. 'Adapter::Extension::MyVar'.
mixed$valuethe value to add
Returns
mixed the new value after the addition
See Also
_add()
static BsConfig::deliverUsersSettings (   $bFlag)
static

This method switch the config class to deliver the bluespice basesettings or the users own settings

Parameters
bool$bFlag
BsConfig::generateFieldId ( )

returns an id for this variable, which can be used in html

Returns
string
static BsConfig::get (   $sPath)
static

Gets the value of the variable, which is specified by the path

Parameters
string$sPathThe unique identifier the variable should be accessibly by. I.e. 'Adapter::Extension::MyVar'.
Returns
mixed the value
BsConfig::getAdapter ( )

returns the adapter name of this variable

Returns
string
BsConfig::getDefault ( )

returns the default value for this variable

Returns
mixed
BsConfig::getExtension ( )

returns the extension name of this variable

Returns
string
BsConfig::getFieldDefinition (   $sSection)

Returns a field description/definition array for preferences

Parameters
string$sSection
Returns
array
BsConfig::getFieldMapping ( )

returns the mapping descriptor of this variable

Returns
string
BsConfig::getI18nExtension ( )

returns the i18n instance of this variable

Returns
String i18n
BsConfig::getI18nName ( )

returns the i18n translated name of this variable

Returns
string
BsConfig::getKey ( )

returns the key of this variable

Returns
string
BsConfig::getName ( )

returns the name of this variable

Returns
string
BsConfig::getOptions ( )

returns the option bitmap of this variable

Returns
int
static BsConfig::getRegisteredVars ( )
static

returns an array of instaces which holds all registered variables.

Returns
array
static BsConfig::getScriptSettings ( )
static

returns all settings instances, which should be rendered as javascript variables

Returns
array
static BsConfig::getSettingObject (   $path)
staticprotected

returns the BsConfig instance for a variable, specified by the path

Parameters
string$pathThe unique identifier the variable should be accessibly by. I.e. 'Adapter::Extension::MyVar'.
Returns
BsConfig
BsConfig::getValue ( )

returns the value of this variable

See Also
_get()
Returns
mixed
static BsConfig::loadSettings ( )
static

loads all settings from the database and saves the instances for every variable internal.

static BsConfig::registerVar (   $path,
  $default = null,
  $options = 0,
  $i18n = '',
  $sFormFieldMappingName = 'text' 
)
static

Use this method to register a configurable variable.

Parameters
string$pathThe unique identifier the variable should be accessibly by. I.e. 'Adapter::Extension::MyVar'.
mixed$defaultThe default value of the variable if not set by user.
int$options
string$i18nstring for proper labeling in the webinterface
string$sFormFieldMappingNameThe type for the input rendering. I.e.
static BsConfig::saveSettings ( )
static

save all settings to the database

Returns
bool false if an error occurs
static BsConfig::saveUserSettings (   $user)
static

saves all userspecific settings for the given user to the database

Parameters
string | User$userthe username or a instance of the mediawiki user class
Returns
bool returns always true since we save the settings with mediawiki methods
static BsConfig::set (   $path,
  $value,
  $bUserValue = false 
)
static

sets the value of the variable, which is specified by the path

Parameters
string$pathThe unique identifier the variable should be accessibly by. I.e. 'Adapter::Extension::MyVar'.
mixed$valuethe value
bool$bUserValuetrue to set the value as a user specific setting
Returns
bool true if the action was successful
BsConfig::setAdapter (   $adapter)
protected

sets the adapter name for this variable

Parameters
string$adapter
BsConfig::setDefault (   $default)
protected

sets the default value for this variable

Parameters
mixed$default
BsConfig::setExtension (   $extension)
protected

sets the extension name for this variable

Parameters
string$extension
BsConfig::setFieldMapping (   $sFormFieldMappingName)
protected

sets the mapping descriptor for this variable

See Also
$_mFieldMapping
Parameters
string$sFormFieldMappingName
BsConfig::setI18N (   $i18n)
protected

sets the i18n instance for this variable

Parameters
String$i18n
BsConfig::setKey (   $key)
protected

sets the key for this variable

Parameters
string$key(normally ADAPTER::EXTENSION::NAME or ADAPTER::NAME)
BsConfig::setName (   $name)
protected

sets the name for this variable

Parameters
string$name
BsConfig::setOptions (   $options)
protected

sets the option bitmask for this variable

Parameters
int$options

Member Data Documentation

BsConfig::$_mI18n = null
protected

the i18n key for this variable

const BsConfig::LEVEL_PRIVATE = 1

configuration level = hardcodet or file

const BsConfig::LEVEL_PUBLIC = 2

configuration level = systemwide (configurable and saved in the database)

const BsConfig::LEVEL_USER = 4

configuration level = userspecific (configurable and saved in the database)

const BsConfig::RENDER_AS_JAVASCRIPT = 16

the variable should be rendered as a javascript variable

const BsConfig::SET_WRITE_PROTECTED = 32768

the variable will be set write protected and cannot be changed in this instance

const BsConfig::USE_PLUGIN_FOR_PREFS = 131072

the variable has an own preference plugin, which should be executed when a preference form is rendered


The documentation for this class was generated from the following file: