use of org.olat.commons.calendar.model.CalendarKey in project openolat by klemens.
the class ICalFileCalendarManager method getCalendarUserConfigurationsMap.
@Override
public Map<CalendarKey, CalendarUserConfiguration> getCalendarUserConfigurationsMap(IdentityRef identity, String... types) {
List<CalendarUserConfiguration> list = calendarUserConfigDao.getCalendarUserConfigurations(identity, types);
Map<CalendarKey, CalendarUserConfiguration> map = new HashMap<>();
for (CalendarUserConfiguration config : list) {
map.put(new CalendarKey(config.getCalendarId(), config.getType()), config);
}
return map;
}
use of org.olat.commons.calendar.model.CalendarKey in project openolat by klemens.
the class CourseCalendars method addCalendars.
private static void addCalendars(UserRequest ureq, UserCourseEnvironment courseEnv, List<BusinessGroup> groups, boolean isOwner, LinkProvider linkProvider, List<KalendarRenderWrapper> calendars) {
if (groups == null || groups.isEmpty())
return;
CollaborationToolsFactory collabFactory = CollaborationToolsFactory.getInstance();
CalendarManager calendarManager = CoreSpringFactory.getImpl(CalendarManager.class);
Map<CalendarKey, CalendarUserConfiguration> configMap = calendarManager.getCalendarUserConfigurationsMap(ureq.getIdentity(), CalendarManager.TYPE_GROUP);
for (BusinessGroup bGroup : groups) {
CollaborationTools collabTools = collabFactory.getOrCreateCollaborationTools(bGroup);
if (!collabTools.isToolEnabled(CollaborationTools.TOOL_CALENDAR)) {
continue;
}
boolean member = courseEnv.isIdentityInCourseGroup(bGroup.getKey());
KalendarRenderWrapper groupCalendarWrapper = calendarManager.getGroupCalendar(bGroup);
groupCalendarWrapper.setPrivateEventsVisible(member || isOwner);
// set calendar access
int iCalAccess = CollaborationTools.CALENDAR_ACCESS_OWNERS;
Long lCalAccess = collabTools.lookupCalendarAccess();
if (lCalAccess != null)
iCalAccess = lCalAccess.intValue();
if (iCalAccess == CollaborationTools.CALENDAR_ACCESS_OWNERS && !isOwner) {
groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
} else {
groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
}
CalendarUserConfiguration config = configMap.get(groupCalendarWrapper.getCalendarKey());
if (config != null) {
groupCalendarWrapper.setConfiguration(config);
}
groupCalendarWrapper.setLinkProvider(linkProvider);
calendars.add(groupCalendarWrapper);
}
}
use of org.olat.commons.calendar.model.CalendarKey in project openolat by klemens.
the class HomeCalendarManager method getListOfCalendarWrappers.
@Override
public List<KalendarRenderWrapper> getListOfCalendarWrappers(UserRequest ureq, WindowControl wControl) {
if (!calendarModule.isEnabled()) {
return new ArrayList<KalendarRenderWrapper>();
}
Identity identity = ureq.getIdentity();
List<KalendarRenderWrapper> calendars = new ArrayList<KalendarRenderWrapper>();
Map<CalendarKey, CalendarUserConfiguration> configMap = calendarManager.getCalendarUserConfigurationsMap(ureq.getIdentity());
appendPersonalCalendar(identity, calendars, configMap);
appendGroupCalendars(identity, calendars, configMap);
appendCourseCalendars(ureq, wControl, calendars, configMap);
// reload every hour
List<KalendarRenderWrapper> importedCalendars = importCalendarManager.getImportedCalendarsForIdentity(identity, true);
for (KalendarRenderWrapper importedCalendar : importedCalendars) {
importedCalendar.setPrivateEventsVisible(true);
}
calendars.addAll(importedCalendars);
return calendars;
}
Aggregations