mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 17:18:54 +01:00
added saving states to user prefs in calendar. the only saved state until now is owner, but this can be simply extended in future.
This commit is contained in:
parent
c3e40ade99
commit
72115c0ae4
@ -120,6 +120,11 @@ class calendar_ui
|
|||||||
*/
|
*/
|
||||||
var $last;
|
var $last;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array $states_to_save all states that will be saved to the user prefs
|
||||||
|
*/
|
||||||
|
var $states_to_save = array('owner');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -248,6 +253,12 @@ class calendar_ui
|
|||||||
{
|
{
|
||||||
$states = $states_session = $GLOBALS['egw']->session->appsession('session_data','calendar');
|
$states = $states_session = $GLOBALS['egw']->session->appsession('session_data','calendar');
|
||||||
|
|
||||||
|
// retrieve saved states from prefs
|
||||||
|
if(!$states)
|
||||||
|
{
|
||||||
|
$states = unserialize($this->bo->cal_prefs['saved_states']);
|
||||||
|
}
|
||||||
|
|
||||||
if (is_null($set_states))
|
if (is_null($set_states))
|
||||||
{
|
{
|
||||||
$set_states = $_REQUEST;
|
$set_states = $_REQUEST;
|
||||||
@ -367,6 +378,13 @@ class calendar_ui
|
|||||||
if ($this->debug > 0 || $this->debug == 'manage_states') $this->bo->debug_message('uical::manage_states(%1) session was %2, states now %3',True,$set_states,$states_session,$states);
|
if ($this->debug > 0 || $this->debug == 'manage_states') $this->bo->debug_message('uical::manage_states(%1) session was %2, states now %3',True,$set_states,$states_session,$states);
|
||||||
// save the states in the session
|
// save the states in the session
|
||||||
$GLOBALS['egw']->session->appsession('session_data','calendar',$states);
|
$GLOBALS['egw']->session->appsession('session_data','calendar',$states);
|
||||||
|
// save defined states into the user-prefs
|
||||||
|
if(!empty($states) && is_array($states))
|
||||||
|
{
|
||||||
|
$saved_states = array_intersect_key($states,array_flip($this->states_to_save));
|
||||||
|
$GLOBALS['egw']->preferences->add('calendar','saved_states',serialize($saved_states));
|
||||||
|
$GLOBALS['egw']->preferences->save_repository(false,'user',false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user