mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-08 23:19:04 +01:00
new method preferences->default_prefs($app=null,$name=null) to access default prefs, taking into account forced preferences
This commit is contained in:
parent
3fdf5fdfd0
commit
1c386e2d6b
@ -623,8 +623,8 @@ abstract class bo_tracking
|
||||
}
|
||||
else
|
||||
{
|
||||
// for the notification copy, we use the default-prefs plus the language from the the tracker config
|
||||
$GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->default;
|
||||
// for the notification copy, we use default (and forced) prefs plus the language from the the tracker config
|
||||
$GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->default_prefs();
|
||||
$GLOBALS['egw_info']['user']['preferences']['common']['lang'] = $user_or_lang;
|
||||
}
|
||||
if ($GLOBALS['egw_info']['user']['preferences']['common']['lang'] != translation::$userlang) // load the right language if needed
|
||||
|
@ -396,6 +396,25 @@ class preferences
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default preferences (also taking forced preferences into account!)
|
||||
*
|
||||
* @param string $app=null
|
||||
* @param string $name=null
|
||||
* @return mixed
|
||||
*/
|
||||
function default_prefs($app=null,$name=null)
|
||||
{
|
||||
// boetemplate::complete_array_merge() is identical to PHP >= 5.3 array_replace_recursive()
|
||||
$default = boetemplate::complete_array_merge($this->default, $this->forced);
|
||||
|
||||
if ($app) $default = $default[$app];
|
||||
|
||||
if ($name && is_array($default)) $default = $default[$name];
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checking new timezone ('tz') pref and setting old tz_offset pref from it
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user