|
| __construct (string $user_id, string $name, ?dcRecord $rs=null) |
|
| prefExists (string $name, bool $global=false) |
|
| get (string $name) |
|
| getGlobal (string $name) |
|
| getLocal (string $name) |
|
| __get (string $name) |
|
| set (string $name, $value) |
|
| __set (string $name, $value) |
|
| put (string $name, $value, ?string $type=null, ?string $label=null, bool $ignore_value=true, bool $global=false) |
|
| rename (string $old_name, string $new_name) |
|
| drop (string $name, bool $force_global=false) |
|
| dropEvery (string $name, bool $global=false) |
|
| dropAll (bool $force_global=false) |
|
| dumpWorkspace () |
|
| dumpPrefs () |
|
| dumpLocalPrefs () |
|
| dumpGlobalPrefs () |
|
◆ __construct()
__construct |
( |
string |
$user_id, |
|
|
string |
$name, |
|
|
?dcRecord |
$rs = null |
|
) |
| |
Object constructor. Retrieves user prefs and puts them in $prefs array. Local (user) prefs have a highest priority than global prefs.
- Parameters
-
string | $user_id | The user identifier |
string | $name | The workspace name |
dcRecord | $rs | The recordset |
- Exceptions
-
References $user_id, dcCore\app(), and WS_TABLE_NAME.
◆ prefExists()
prefExists |
( |
string |
$name, |
|
|
bool |
$global = false |
|
) |
| |
Returns true if a pref exist, else false
- Parameters
-
string | $name | The identifier |
bool | $global | The global |
- Returns
- bool
Referenced by drop(), dropEvery(), and put().
◆ get()
Returns pref value if exists.
- Parameters
-
- Returns
- mixed
◆ getGlobal()
getGlobal |
( |
string |
$name | ) |
|
Returns global pref value if exists.
- Parameters
-
- Returns
- mixed
◆ getLocal()
Returns local pref value if exists.
- Parameters
-
- Returns
- mixed
◆ __get()
Magic __get method.
- Parameters
-
- Returns
- mixed
◆ set()
set |
( |
string |
$name, |
|
|
|
$value |
|
) |
| |
Sets a pref in $prefs property. This sets the pref for script execution time only and if pref exists.
- Parameters
-
string | $name | The pref name |
mixed | $value | The pref value |
◆ __set()
__set |
( |
string |
$name, |
|
|
|
$value |
|
) |
| |
Magic __set method.
- Parameters
-
string | $name | The pref name |
mixed | $value | The pref value |
◆ put()
put |
( |
string |
$name, |
|
|
|
$value, |
|
|
?string |
$type = null , |
|
|
?string |
$label = null , |
|
|
bool |
$ignore_value = true , |
|
|
bool |
$global = false |
|
) |
| |
Creates or updates a pref.
$type could be 'string', 'integer', 'float', 'boolean' or null. If $type is null and pref exists, it will keep current pref type.
$ignore_value allow you to not change pref. Useful if you need to change a pref label or type and don't want to change its value.
- Parameters
-
string | $name | The pref identifier |
mixed | $value | The pref value |
string | $type | The pref type |
string | $label | The pref label |
bool | $ignore_value | Change pref value or not |
bool | $global | Pref is global |
- Exceptions
-
References $user_id, $workspace, drop(), and prefExists().
◆ rename()
rename |
( |
string |
$old_name, |
|
|
string |
$new_name |
|
) |
| |
Rename an existing pref in a Workspace
- Parameters
-
string | $old_name | The old identifier |
string | $new_name | The new identifier |
- Exceptions
-
- Returns
- bool false is error, true if renamed
◆ drop()
drop |
( |
string |
$name, |
|
|
bool |
$force_global = false |
|
) |
| |
Removes an existing pref. Workspace
- Parameters
-
string | $name | The pref identifier |
bool | $force_global | Force global pref drop |
- Exceptions
-
References prefExists().
Referenced by put().
◆ dropEvery()
dropEvery |
( |
string |
$name, |
|
|
bool |
$global = false |
|
) |
| |
Removes every existing specific pref. in a workspace
- Parameters
-
string | $name | Pref ID |
bool | $global | Remove global pref too |
References prefExists().
◆ dropAll()
dropAll |
( |
bool |
$force_global = false | ) |
|
Removes all existing pref. in a Workspace
- Parameters
-
bool | $force_global | Remove global prefs too |
- Exceptions
-
◆ dumpWorkspace()
Dumps a workspace.
- Returns
- string
References $workspace.
◆ dumpPrefs()
Dumps preferences.
- Returns
- array
References $prefs.
◆ dumpLocalPrefs()
Dumps local preferences.
- Returns
- array
References $local_prefs.
◆ dumpGlobalPrefs()
◆ WS_TABLE_NAME
const WS_TABLE_NAME = 'pref' |
◆ WS_NAME_SCHEMA
const WS_NAME_SCHEMA = '/^[a-zA-Z][a-zA-Z0-9]+$/' |
◆ WS_ID_SCHEMA
const WS_ID_SCHEMA = '/^[a-zA-Z][a-zA-Z0-9_]+$/' |
|
protected |
◆ $con
◆ $table
◆ $user_id
◆ $global_prefs
◆ $local_prefs
◆ $prefs
◆ $workspace
The documentation for this class was generated from the following file: