Only show the "save to session" button in case preferences store = none
refs #8234
This commit is contained in:
parent
d452f3218d
commit
55c20abddc
|
@ -43,7 +43,9 @@ class PreferenceController extends BasePreferenceController
|
|||
$user = $this->getRequest()->getUser();
|
||||
$form = new PreferenceForm();
|
||||
$form->setPreferences($user->getPreferences());
|
||||
if ($storeConfig->get('store', 'ini') !== 'none') {
|
||||
$form->setStore(PreferencesStore::create($storeConfig, $user));
|
||||
}
|
||||
$form->handleRequest();
|
||||
|
||||
$this->view->form = $form;
|
||||
|
|
|
@ -86,7 +86,7 @@ class PreferenceForm extends Form
|
|||
*/
|
||||
public function onSuccess()
|
||||
{
|
||||
$this->preferences = new Preferences($this->store->load());
|
||||
$this->preferences = new Preferences($this->store ? $this->store->load() : array());
|
||||
|
||||
$webPreferences = $this->preferences->get('icingaweb', array());
|
||||
foreach ($this->getValues() as $key => $value) {
|
||||
|
@ -103,7 +103,7 @@ class PreferenceForm extends Form
|
|||
Session::getSession()->user->setPreferences($this->preferences);
|
||||
|
||||
try {
|
||||
if ($this->getElement('btn_submit_preferences')->isChecked()) {
|
||||
if ($this->store && $this->getElement('btn_submit_preferences')->isChecked()) {
|
||||
$this->save();
|
||||
Notification::success($this->translate('Preferences successfully saved'));
|
||||
} else {
|
||||
|
@ -186,6 +186,7 @@ class PreferenceForm extends Form
|
|||
)
|
||||
);
|
||||
|
||||
if ($this->store) {
|
||||
$this->addElement(
|
||||
'submit',
|
||||
'btn_submit_preferences',
|
||||
|
@ -198,6 +199,7 @@ class PreferenceForm extends Form
|
|||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->addElement(
|
||||
'submit',
|
||||
|
|
Loading…
Reference in New Issue