Search in sources :

Example 6 with CollaborationToolsFactory

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);
    }
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) CollaborationTools(org.olat.collaboration.CollaborationTools) CalendarUserConfiguration(org.olat.commons.calendar.model.CalendarUserConfiguration) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) CollaborationToolsFactory(org.olat.collaboration.CollaborationToolsFactory)

Aggregations

CollaborationTools (org.olat.collaboration.CollaborationTools)6 CollaborationToolsFactory (org.olat.collaboration.CollaborationToolsFactory)6 BusinessGroup (org.olat.group.BusinessGroup)6 CalendarUserConfiguration (org.olat.commons.calendar.model.CalendarUserConfiguration)4 KalendarRenderWrapper (org.olat.commons.calendar.ui.components.KalendarRenderWrapper)4 CalendarManager (org.olat.commons.calendar.CalendarManager)2 CalendarKey (org.olat.commons.calendar.model.CalendarKey)2 Identity (org.olat.core.id.Identity)2 BGArea (org.olat.group.area.BGArea)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2