method getAll documentation in bbn\User\Preferences
Returns an array of the current user's preferences based on the given id_option, his own profile and his group's.
function(string $id_option = NULL, bool $with_config = true)
{
if ($id_option = $this->_getIdOption($id_option)) {
$farch = $this->fields;
$fields = [];
foreach ($farch as $k => $f) {
$field = $this->class_table . '.' . $f;
if ($k === 'cfg') {
$fields[$farch['cfg']] = "IFNULL($field, aliases.$farch[cfg])";
}
elseif ($k === 'text') {
$fields[$farch['text']] = "IFNULL($field, aliases.$farch[text])";
}
else {
$fields[] = $field;
}
}
if (
$rows = $this->db->rselectAll(
[
'table' => $this->class_table,
'fields' => $fields,
'join' => [[
'table' => $this->class_table,
'type' => 'left',
'alias' => 'aliases',
'on' => [
'conditions' => [[
'field' => $farch['id_alias'],
'exp' => 'aliases.id'
]]
]]
],
'where' => [
'conditions' => [
[
'field' => $farch['id_option'],
'value' => $id_option
], [
'logic' => 'OR',
'conditions' => [
[
'field' => $farch['id_user'],
'value' => $this->id_user
], [
'field' => $farch['id_group'],
'value' => $this->id_group
], [
'field' => $farch['public'],
'value' => 1
]
]
]
]
]
]
)
) {
return $with_config ? array_map(
function ($a) use ($farch) {
$cfg = $a[$farch['cfg']];
unset($a[$farch['cfg']]);
if ($cfg = json_decode($cfg, true)) {
$a = bbn\X::mergeArrays($cfg, $a);
}
return $a;
},
$rows
) : $rows;
}
return [];
}
return null;
}
Returns an array of the current user's preferences based on the given id_option, his own profile and his group's. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions