use of org.olat.modules.lecture.model.LocationHistory 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);
}
}
}
use of org.olat.modules.lecture.model.LocationHistory in project openolat by klemens.
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);
}
}
}
use of org.olat.modules.lecture.model.LocationHistory 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;
}
use of org.olat.modules.lecture.model.LocationHistory 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;
}
Aggregations