class UserPreferences (View source)

Functions for displaying user preferences pages

Methods

__construct(DatabaseInterface $dbi, Relation $relation, Template $template)

No description

void
pageInit(ConfigFile $cf)

Common initialization for user preferences modification pages

array
load()

Loads user preferences

Message
save(array $configArray)

Saves user preferences

array
apply(array $configData)

Returns a user preferences array filtered by $cfg['UserprefsDisallow'] (exclude list) and keys from user preferences form (allow list)

Message
persistOption(string $path, mixed $value, mixed $defaultValue)

Updates one user preferences option (loads and saves to database).

void
redirect(string $fileName, array|null $params = null, string|null $hash = null)

Redirects after saving new user preferences

string
autoloadGetHeader()

Shows form which allows to quickly load settings stored in browser's local storage

Details

__construct(DatabaseInterface $dbi, Relation $relation, Template $template)

No description

Parameters

DatabaseInterface $dbi
Relation $relation
Template $template

void pageInit(ConfigFile $cf)

Common initialization for user preferences modification pages

Parameters

ConfigFile $cf

Config file instance

Return Value

void

array load()

Loads user preferences

Returns an array:

  • config_data - path => value pairs
  • mtime - last modification time
  • type - 'db' (config read from pmadb) or 'session' (read from user session)

Return Value

array

Message save(array $configArray)

Saves user preferences

Parameters

array $configArray

configuration array

Return Value

Message

array apply(array $configData)

Returns a user preferences array filtered by $cfg['UserprefsDisallow'] (exclude list) and keys from user preferences form (allow list)

Parameters

array $configData

path => value pairs

Return Value

array

Message persistOption(string $path, mixed $value, mixed $defaultValue)

Updates one user preferences option (loads and saves to database).

No validation is done!

Parameters

string $path configuration
mixed $value value
mixed $defaultValue

default value

Return Value

Message

void redirect(string $fileName, array|null $params = null, string|null $hash = null)

Redirects after saving new user preferences

Parameters

string $fileName Filename
array|null $params

URL parameters

string|null $hash

Hash value

Return Value

void

string autoloadGetHeader()

Shows form which allows to quickly load settings stored in browser's local storage

Return Value

string