Search in sources :

Example 66 with Preferences

use of org.olat.core.util.prefs.Preferences in project OpenOLAT by OpenOLAT.

the class AbstractTeacherOverviewController method isAllTeachersSwitch.

private boolean isAllTeachersSwitch(UserRequest ureq, boolean def) {
    Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
    Boolean showConfig = (Boolean) guiPrefs.get(AbstractTeacherOverviewController.class, switchPrefsId);
    return showConfig == null ? def : showConfig.booleanValue();
}
Also used : Preferences(org.olat.core.util.prefs.Preferences)

Example 67 with Preferences

use of org.olat.core.util.prefs.Preferences in project OpenOLAT by OpenOLAT.

the class EditLectureBlockController method getLocations.

private List<LocationHistory> getLocations(UserRequest ureq) {
    Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
    List<LocationHistory> showConfig = guiPrefs.getList(LectureBlock.class, getLocationsPrefsId(), LocationHistory.class);
    return showConfig == null ? new ArrayList<>() : showConfig;
}
Also used : LocationHistory(org.olat.modules.lecture.model.LocationHistory) Preferences(org.olat.core.util.prefs.Preferences)

Example 68 with Preferences

use of org.olat.core.util.prefs.Preferences in project openolat by klemens.

the class ShareLinkController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    UserSession usess = ureq.getUserSession();
    if (source == shareLinkVC && "setLandingPage".equals(event.getCommand()) && usess != null && usess.isAuthenticated()) {
        HistoryPoint p = usess.getLastHistoryPoint();
        if (p != null && StringHelper.containsNonWhitespace(p.getBusinessPath())) {
            List<ContextEntry> ces = p.getEntries();
            String landingPage = BusinessControlFactory.getInstance().getAsURIString(ces, true);
            int start = landingPage.indexOf("/url/");
            if (start != -1) {
                // start with / after /url
                landingPage = landingPage.substring(start + 4);
            }
            // update user prefs
            Preferences prefs = usess.getGuiPreferences();
            prefs.put(WindowManager.class, "landing-page", landingPage);
            prefs.save();
            getWindowControl().getWindowBackOffice().sendCommandTo(new JSCommand("showInfoBox(\"" + translate("info.header") + "\",\"" + translate("landingpage.set.message") + "\");"));
        }
    }
}
Also used : UserSession(org.olat.core.util.UserSession) JSCommand(org.olat.core.gui.control.winmgr.JSCommand) Preferences(org.olat.core.util.prefs.Preferences) HistoryPoint(org.olat.core.id.context.HistoryPoint) ContextEntry(org.olat.core.id.context.ContextEntry) HistoryPoint(org.olat.core.id.context.HistoryPoint)

Example 69 with Preferences

use of org.olat.core.util.prefs.Preferences in project openolat by klemens.

the class MetadatasController method openPanel.

private void openPanel(UserRequest ureq) {
    Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
    String guiPref = (String) guiPrefs.get(MetadatasController.class, GUIPREF_KEY_OPEN_PANEL);
    String openPanel = guiPref != null ? guiPrefToPanel(guiPref) : "general";
    mainVC.contextRemove("in-general");
    mainVC.contextRemove("in-question");
    mainVC.contextRemove("in-rights");
    mainVC.contextRemove("in-technical");
    mainVC.contextRemove("in-ratings");
    mainVC.contextRemove("in-pools");
    mainVC.contextRemove("in-shares");
    mainVC.contextPut("in-" + openPanel, "in");
}
Also used : Preferences(org.olat.core.util.prefs.Preferences)

Example 70 with Preferences

use of org.olat.core.util.prefs.Preferences in project openolat by klemens.

the class EditLectureBlockController method getLocations.

private List<LocationHistory> getLocations(UserRequest ureq) {
    Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
    List<LocationHistory> showConfig = guiPrefs.getList(LectureBlock.class, getLocationsPrefsId(), LocationHistory.class);
    return showConfig == null ? new ArrayList<>() : showConfig;
}
Also used : LocationHistory(org.olat.modules.lecture.model.LocationHistory) Preferences(org.olat.core.util.prefs.Preferences)

Aggregations

Preferences (org.olat.core.util.prefs.Preferences)92 ArrayList (java.util.ArrayList)12 I18nModule (org.olat.core.util.i18n.I18nModule)8 WindowManager (org.olat.core.gui.WindowManager)6 ContextEntry (org.olat.core.id.context.ContextEntry)6 UserSession (org.olat.core.util.UserSession)6 HashSet (java.util.HashSet)4 Locale (java.util.Locale)4 Map (java.util.Map)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 UserTool (org.olat.admin.user.tools.UserTool)4 UserToolExtension (org.olat.admin.user.tools.UserToolExtension)4 Component (org.olat.core.gui.components.Component)4 FlexiTableSort (org.olat.core.gui.components.form.flexible.elements.FlexiTableSort)4 ProgressBar (org.olat.core.gui.components.progressbar.ProgressBar)4 HistoryPoint (org.olat.core.id.context.HistoryPoint)4 I18nItem (org.olat.core.util.i18n.I18nItem)4 LocationHistory (org.olat.modules.lecture.model.LocationHistory)4 Date (java.util.Date)2 List (java.util.List)2