public function SaveAsDefault()
 {
     $sSettings = $this->serialize();
     appUserPreferences::SetPref($this->GetPrefsKey(null), $sSettings);
     return true;
 }
Beispiel #2
0
 case 'search_form':
     $oPage->SetContentType('text/html');
     $sClass = utils::ReadParam('className', '', false, 'class');
     $sRootClass = utils::ReadParam('baseClass', '', false, 'class');
     $currentId = utils::ReadParam('currentId', '');
     $sTableId = utils::ReadParam('_table_id_', null, false, 'raw_data');
     $sAction = utils::ReadParam('action', '');
     $oFilter = new DBObjectSearch($sClass);
     $oSet = new CMDBObjectSet($oFilter);
     $sHtml = cmdbAbstractObject::GetSearchForm($oPage, $oSet, array('currentId' => $currentId, 'baseClass' => $sRootClass, 'action' => $sAction, 'table_id' => $sTableId));
     $oPage->add($sHtml);
     break;
 case 'set_pref':
     $sCode = utils::ReadPostedParam('code', '');
     $sValue = utils::ReadPostedParam('value', '', 'raw_data');
     appUserPreferences::SetPref($sCode, $sValue);
     break;
 case 'erase_all_pref':
     // Can be useful in case a user got some corrupted prefs...
     appUserPreferences::ClearPreferences();
     break;
 case 'on_form_cancel':
     // Called when a creation/modification form is cancelled by the end-user
     // Let's take this opportunity to inform the plug-ins so that they can perform some cleanup
     $iTransactionId = utils::ReadParam('transaction_id', 0);
     $sTempId = session_id() . '_' . $iTransactionId;
     foreach (MetaModel::EnumPlugins('iApplicationUIExtension') as $oExtensionInstance) {
         $oExtensionInstance->OnFormCancel($sTempId);
     }
     break;
 case 'reload_dashboard':
Beispiel #3
0
            DisplayPreferences($oPage);
            break;
        case 'apply_language':
            $sLangCode = utils::ReadParam('language', 'EN US');
            $oUser = UserRights::GetUserObject();
            $oUser->Set('language', $sLangCode);
            $oUser->DBUpdate();
            // Redirect to force a reload/display of the page with the new language
            $oAppContext = new ApplicationContext();
            $sURL = utils::GetAbsoluteUrlAppRoot() . 'pages/preferences.php?' . $oAppContext->GetForLink();
            $oPage->add_header('Location: ' . $sURL);
            break;
        case 'apply_others':
            $iDefaultPageSize = (int) utils::ReadParam('default_page_size', -1);
            if ($iDefaultPageSize > 0) {
                appUserPreferences::SetPref('default_page_size', $iDefaultPageSize);
            }
            DisplayPreferences($oPage);
            break;
        case 'display':
        default:
            DisplayPreferences($oPage);
    }
    $oPage->output();
} catch (CoreException $e) {
    require_once APPROOT . '/setup/setuppage.class.inc.php';
    $oP = new SetupPage(Dict::S('UI:PageTitle:FatalError'));
    $oP->add("<h1>" . Dict::S('UI:FatalErrorMessage') . "</h1>\n");
    $oP->error(Dict::Format('UI:Error_Details', $e->getHtmlDesc()));
    $oP->output();
    if (MetaModel::IsLogEnabledIssue()) {