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();
|
$user = $this->getRequest()->getUser();
|
||||||
$form = new PreferenceForm();
|
$form = new PreferenceForm();
|
||||||
$form->setPreferences($user->getPreferences());
|
$form->setPreferences($user->getPreferences());
|
||||||
|
if ($storeConfig->get('store', 'ini') !== 'none') {
|
||||||
$form->setStore(PreferencesStore::create($storeConfig, $user));
|
$form->setStore(PreferencesStore::create($storeConfig, $user));
|
||||||
|
}
|
||||||
$form->handleRequest();
|
$form->handleRequest();
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
|
|
|
@ -86,7 +86,7 @@ class PreferenceForm extends Form
|
||||||
*/
|
*/
|
||||||
public function onSuccess()
|
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());
|
$webPreferences = $this->preferences->get('icingaweb', array());
|
||||||
foreach ($this->getValues() as $key => $value) {
|
foreach ($this->getValues() as $key => $value) {
|
||||||
|
@ -103,7 +103,7 @@ class PreferenceForm extends Form
|
||||||
Session::getSession()->user->setPreferences($this->preferences);
|
Session::getSession()->user->setPreferences($this->preferences);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($this->getElement('btn_submit_preferences')->isChecked()) {
|
if ($this->store && $this->getElement('btn_submit_preferences')->isChecked()) {
|
||||||
$this->save();
|
$this->save();
|
||||||
Notification::success($this->translate('Preferences successfully saved'));
|
Notification::success($this->translate('Preferences successfully saved'));
|
||||||
} else {
|
} else {
|
||||||
|
@ -186,6 +186,7 @@ class PreferenceForm extends Form
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($this->store) {
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'submit',
|
'submit',
|
||||||
'btn_submit_preferences',
|
'btn_submit_preferences',
|
||||||
|
@ -198,6 +199,7 @@ class PreferenceForm extends Form
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'submit',
|
'submit',
|
||||||
|
|
Loading…
Reference in New Issue