view->tabs = ControllerTabCollector::collectControllerTabs('PreferenceController'); } protected function savePreferences(array $preferences) { $session = Session::getSession(); $currentPreferences = $session->user->getPreferences(); foreach ($preferences as $key => $value) { if ($value === null) { $currentPreferences->remove($key); } else { $currentPreferences->{$key} = $value; } } $session->write(); if (($preferencesConfig = IcingaConfig::app()->preferences) === null) { throw new ConfigurationError( 'Cannot save preferences changes since you\'ve not configured a preferences backend' ); } $store = PreferencesStore::create($preferencesConfig, $session->user); $store->load(); // Necessary for patching existing preferences $store->save($currentPreferences); } }