use of org.olat.collaboration.CollaborationToolsFactory in project openolat by klemens.
the class CourseCalendarController method addCalendars.
private void addCalendars(List<BusinessGroup> groups, boolean isOwner, LinkProvider linkProvider, List<KalendarRenderWrapper> calendars) {
CollaborationToolsFactory collabFactory = CollaborationToolsFactory.getInstance();
for (BusinessGroup bGroup : groups) {
CollaborationTools collabTools = collabFactory.getOrCreateCollaborationTools(bGroup);
if (!collabTools.isToolEnabled(CollaborationTools.TOOL_CALENDAR))
continue;
KalendarRenderWrapper groupCalendarWrapper = calendarManager.getGroupCalendar(bGroup);
groupCalendarWrapper.setPrivateEventsVisible(true);
// 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 = calendarManager.findCalendarConfigForIdentity(groupCalendarWrapper.getKalendar(), getIdentity());
if (config != null) {
groupCalendarWrapper.setConfiguration(config);
}
groupCalendarWrapper.setLinkProvider(linkProvider);
calendars.add(groupCalendarWrapper);
}
}
Aggregations