phpDocumentor pond
[ class tree: pond ] [ index: pond ] [ all elements ]

Class: UserSettings

Source Location: /qp_inc/users/model/_usersettings.class.php

Class UserSettings

Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From AbstractSettings

AbstractSettings::$all_loaded
AbstractSettings::$cache
AbstractSettings::$cache_by_col_keys
AbstractSettings::$col_key_names
AbstractSettings::$col_value_name
AbstractSettings::$db_table_name

Inherited From AbstractSettings

AbstractSettings::AbstractSettings()
Constructor.
AbstractSettings::dbupdate()
Commit changed settings to DB.
AbstractSettings::delete()
Remove a setting.
AbstractSettings::delete_array()
Delete an array of values.
AbstractSettings::get()
Get a setting from the DB settings table.
AbstractSettings::get_cond()
Only set the first variable (passed by reference) if we could retrieve a setting.
AbstractSettings::get_default()
Get the default for the last key of $col_key_names
AbstractSettings::load_all()
Load all settings, disregarding the derived classes setting of $cache_by_col_keys
  • useful if you know that you want to get
all user settings for example.
AbstractSettings::reset()
Reset cache (includes settings to be written to DB).
AbstractSettings::restore_defaults()
Delete values for $_defaults in DB.
AbstractSettings::set()
Temporarily sets a setting (dbupdate() writes it to DB).
AbstractSettings::set_array()
Set an array of values.
AbstractSettings::_load()
Loads the settings. Not meant to be called directly, but gets called when needed.

[ Top ]
Property Summary
array   $_defaults   The default settings to use, when a setting is not given in the database.

[ Top ]
Method Summary
UserSettings   UserSettings()   Constructor
void   delete()   Mark a setting for deletion (dbupdate() writes it to DB).
void   get()   Get a setting from the DB user settings table
NULL|mixed   param_Request()   Get a param from Request and save it to UserSettings, or default to previously saved user setting.
void   set()   Temporarily sets a user setting (dbupdate() writes it to DB)

[ Top ]
Properties
array   $_defaults = array(
'action_icon_threshold' => 3,
'action_word_threshold' => 3,
'display_icon_legend' => 0,
'control_form_abortions' => 1,
'focus_on_first_input' => 0, // TODO: fix sideeffect when pressing F5
'pref_browse_tab' => 'full',
'pref_edit_tab' => 'expert', // was 'simple' but simple is going away :)

'fm_imglistpreview' => 1,
'fm_showdate' => 'compact',
'fm_allowfiltering' => 'simple',

'blogperms_layout' => 'default', // selected view in blog (user/group) perms

'login_multiple_sessions' => 1, // allow multiple concurrent sessions? (PARAMOUNT ON DEMO SERVER)

'results_per_page' => 20,

'num_admin_blogs' => 10,
)
[line 56]

The default settings to use, when a setting is not given in the database.

API Tags:
Access:  protected

Information Tags:
Todo:  (legacy): Allow overriding from /qp_config/_config_TEST.php?
Todo:  EdB: IMPORTANT! $_defaults excites me. dunno why ... or what this is even for

Redefinition of:
AbstractSettings::$_defaults
Default settings.

[ Top ]
Methods
Constructor UserSettings  [line 82]

  UserSettings UserSettings( )

Constructor



[ Top ]
delete  [line 143]

  void delete( string $setting, [integer $user_ID = NULL]  )

Mark a setting for deletion (dbupdate() writes it to DB).

Parameters:
string   $setting:  name of setting
integer   $user_ID:  User ID (by default $current_User->ID will be used)


Redefinition of:
AbstractSettings::delete()
Remove a setting.

[ Top ]
get  [line 94]

  void get( string $setting, [integer $user_ID = NULL]  )

Get a setting from the DB user settings table

Parameters:
string   $setting:  name of setting
integer   $user_ID:  User ID (by default $current_User->ID will be used)


Redefinition of:
AbstractSettings::get()
Get a setting from the DB settings table.

[ Top ]
param_Request  [line 187]

  NULL|mixed param_Request( string $param_name, string $uset_name, [string $type = ''], [mixed $default = ''], [boolean $memorize = false], [boolean $override = false]  )

Get a param from Request and save it to UserSettings, or default to previously saved user setting.

If the user setting was not set before (and there's no default given that gets returned), $default gets used.

Parameters:
string   $param_name:  Request param name
string   $uset_name:  User setting name. Make sure this is unique!
string   $type:  Force value type to one of:
  • integer
  • float
  • string (strips (HTML-)Tags, trims whitespace)
  • array
  • object
  • null
  • html (does nothing)
  • '' (does nothing)
  • '/^...$/' check regexp pattern match (string)
  • boolean (will force type to boolean, but you can't use 'true' as a default since it has special meaning. There is no real reason to pass booleans on a URL though. Passing 0 and 1 as integers seems to be best practice).
Value type will be forced only if resulting value (probably from default then) is !== NULL
mixed   $default:  Default value or TRUE if user input required
boolean   $memorize:  Do we need to memorize this to regenerate the URL for this page?
boolean   $override:  Override if variable already set

API Tags:
Return:  NULL, if neither a param was given nor $UserSettings knows about it.

Information Tags:
Todo:  Move this to _abstractsettings.class.php - the other Settings object can also make use of it!

[ Top ]
set  [line 119]

  void set( string $setting, mixed $value, [integer $user_ID = NULL]  )

Temporarily sets a user setting (dbupdate() writes it to DB)

Parameters:
string   $setting:  name of setting
mixed   $value:  new value
integer   $user_ID:  User ID (by default $current_User->ID will be used)


Redefinition of:
AbstractSettings::set()
Temporarily sets a setting (dbupdate() writes it to DB).

[ Top ]