Search in sources :

Example 16 with Preferences

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

the class EditLectureBlockController method updateLocationsPrefs.

private void updateLocationsPrefs(UserRequest ureq) {
    String location = lectureBlock.getLocation();
    if (StringHelper.containsNonWhitespace(location)) {
        List<LocationHistory> newLocations = new ArrayList<>(locations);
        LocationHistory newLocation = new LocationHistory(location, new Date());
        if (locations.contains(newLocation)) {
            int index = locations.indexOf(newLocation);
            locations.get(index).setLastUsed(new Date());
        } else {
            newLocations.add(newLocation);
            Collections.sort(newLocations, new LocationDateComparator());
            if (newLocations.size() > 10) {
                // pack it in a new list for XStream
                newLocations = new ArrayList<>(newLocations.subList(0, 10));
            }
        }
        Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
        if (guiPrefs != null) {
            guiPrefs.putAndSave(LectureBlock.class, getLocationsPrefsId(), newLocations);
        }
    }
}
Also used : LocationHistory(org.olat.modules.lecture.model.LocationHistory) ArrayList(java.util.ArrayList) Preferences(org.olat.core.util.prefs.Preferences) Date(java.util.Date)

Example 17 with Preferences

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

the class CheckListRunController method saveOpenPanel.

private void saveOpenPanel(UserRequest ureq, String panelId, boolean newValue) {
    Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
    if (guiPrefs != null) {
        guiPrefs.putAndSave(CheckListRunController.class, getOpenPanelId(panelId), Boolean.valueOf(newValue));
    }
    flc.getFormItemComponent().contextPut("in-" + panelId, Boolean.valueOf(newValue));
}
Also used : Preferences(org.olat.core.util.prefs.Preferences)

Example 18 with Preferences

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

the class MSCourseNodeRunController method isPanelOpen.

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

Example 19 with Preferences

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

the class PortfolioCourseNodeRunController method isPanelOpen.

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

Example 20 with Preferences

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

the class IQRunController method saveOpenPanel.

private void saveOpenPanel(UserRequest ureq, String panelId, boolean newValue) {
    Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
    if (guiPrefs != null) {
        guiPrefs.putAndSave(IQRunController.class, getOpenPanelId(panelId), new Boolean(newValue));
    }
    myContent.contextPut("in-" + panelId, new Boolean(newValue));
}
Also used : 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