Search in sources :

Example 1 with WeeklyCalendarController

use of org.olat.commons.calendar.ui.WeeklyCalendarController in project OpenOLAT by OpenOLAT.

the class CollaborationTools method createCalendarController.

/**
 * Creates a calendar controller
 * @param ureq
 * @param wControl
 * @param resourceableId
 * @return Configured WeeklyCalendarController
 */
public CalendarController createCalendarController(UserRequest ureq, WindowControl wControl, BusinessGroup businessGroup, boolean isAdmin, boolean isMember) {
    CollaborationManager collaborationManager = CoreSpringFactory.getImpl(CollaborationManager.class);
    KalendarRenderWrapper calRenderWrapper = collaborationManager.getCalendar(businessGroup, ureq, isAdmin);
    calRenderWrapper.setPrivateEventsVisible(isAdmin || isMember);
    // add linking
    List<RepositoryEntry> repoEntries = CoreSpringFactory.getImpl(BusinessGroupService.class).findRepositoryEntries(Collections.singleton(businessGroup), 0, -1);
    List<ICourse> courses = new ArrayList<>(repoEntries.size());
    for (RepositoryEntry repoEntry : repoEntries) {
        if (repoEntry.getOlatResource().getResourceableTypeName().equals(CourseModule.getCourseTypeName())) {
            ICourse course = CourseFactory.loadCourse(repoEntry);
            courses.add(course);
        }
    }
    if (!courses.isEmpty()) {
        CourseLinkProviderController clp = new CourseLinkProviderController(null, courses, ureq, wControl);
        calRenderWrapper.setLinkProvider(clp);
    }
    List<KalendarRenderWrapper> calendars = new ArrayList<>();
    calendars.add(calRenderWrapper);
    return new WeeklyCalendarController(ureq, wControl, calendars, WeeklyCalendarController.CALLER_COLLAB, businessGroup, false);
}
Also used : BusinessGroupService(org.olat.group.BusinessGroupService) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) CourseLinkProviderController(org.olat.course.run.calendar.CourseLinkProviderController) WeeklyCalendarController(org.olat.commons.calendar.ui.WeeklyCalendarController) RepositoryEntry(org.olat.repository.RepositoryEntry) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper)

Example 2 with WeeklyCalendarController

use of org.olat.commons.calendar.ui.WeeklyCalendarController in project OpenOLAT by OpenOLAT.

the class UserInfoMainController method doOpenCalendar.

private WeeklyCalendarController doOpenCalendar(UserRequest ureq) {
    removeAsListenerAndDispose(calendarController);
    KalendarRenderWrapper calendarWrapper = calendarManager.getPersonalCalendar(chosenIdentity);
    CalendarUserConfiguration config = calendarManager.findCalendarConfigForIdentity(calendarWrapper.getKalendar(), getIdentity());
    if (config != null) {
        calendarWrapper.setConfiguration(config);
    }
    calendarWrapper.setPrivateEventsVisible(chosenIdentity.equals(ureq.getIdentity()));
    if (chosenIdentity.equals(ureq.getIdentity())) {
        calendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
    } else {
        calendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
    }
    List<KalendarRenderWrapper> calendars = new ArrayList<KalendarRenderWrapper>();
    calendars.add(calendarWrapper);
    OLATResourceable ores = OresHelper.createOLATResourceableType(CMD_CALENDAR);
    WindowControl bwControl = addToHistory(ureq, ores, null);
    OLATResourceable callerOres = OresHelper.createOLATResourceableInstance(chosenIdentity.getName(), chosenIdentity.getKey());
    calendarController = new WeeklyCalendarController(ureq, bwControl, calendars, WeeklyCalendarController.CALLER_PROFILE, callerOres, false);
    listenTo(calendarController);
    return calendarController;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) ArrayList(java.util.ArrayList) WeeklyCalendarController(org.olat.commons.calendar.ui.WeeklyCalendarController) CalendarUserConfiguration(org.olat.commons.calendar.model.CalendarUserConfiguration) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) WindowControl(org.olat.core.gui.control.WindowControl)

Example 3 with WeeklyCalendarController

use of org.olat.commons.calendar.ui.WeeklyCalendarController in project OpenOLAT by OpenOLAT.

the class GroupInfoMainController method getCalendarController.

private WeeklyCalendarController getCalendarController(UserRequest ureq) {
    if (calendarController == null) {
        OLATResourceable ores = OresHelper.createOLATResourceableInstance("Calendar", 0l);
        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl());
        List<KalendarRenderWrapper> calendarWrappers = new ArrayList<>(2);
        KalendarRenderWrapper groupCalendar = calendarManager.getGroupCalendar(businessGroup);
        groupCalendar.setPrivateEventsVisible(false);
        calendarWrappers.add(groupCalendar);
        calendarController = new WeeklyCalendarController(ureq, bwControl, calendarWrappers, WeeklyCalendarController.CALLER_COLLAB, businessGroup, false);
        listenTo(calendarController);
    }
    layoutController.setCol3(calendarController.getInitialComponent());
    addToHistory(ureq, calendarController);
    return calendarController;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) ArrayList(java.util.ArrayList) WeeklyCalendarController(org.olat.commons.calendar.ui.WeeklyCalendarController) WindowControl(org.olat.core.gui.control.WindowControl) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper)

Example 4 with WeeklyCalendarController

use of org.olat.commons.calendar.ui.WeeklyCalendarController in project openolat by klemens.

the class CollaborationTools method createCalendarController.

/**
 * Creates a calendar controller
 * @param ureq
 * @param wControl
 * @param resourceableId
 * @return Configured WeeklyCalendarController
 */
public CalendarController createCalendarController(UserRequest ureq, WindowControl wControl, BusinessGroup businessGroup, boolean isAdmin, boolean isMember) {
    CollaborationManager collaborationManager = CoreSpringFactory.getImpl(CollaborationManager.class);
    KalendarRenderWrapper calRenderWrapper = collaborationManager.getCalendar(businessGroup, ureq, isAdmin);
    calRenderWrapper.setPrivateEventsVisible(isAdmin || isMember);
    // add linking
    List<RepositoryEntry> repoEntries = CoreSpringFactory.getImpl(BusinessGroupService.class).findRepositoryEntries(Collections.singleton(businessGroup), 0, -1);
    List<ICourse> courses = new ArrayList<>(repoEntries.size());
    for (RepositoryEntry repoEntry : repoEntries) {
        if (repoEntry.getOlatResource().getResourceableTypeName().equals(CourseModule.getCourseTypeName())) {
            ICourse course = CourseFactory.loadCourse(repoEntry);
            courses.add(course);
        }
    }
    if (!courses.isEmpty()) {
        CourseLinkProviderController clp = new CourseLinkProviderController(null, courses, ureq, wControl);
        calRenderWrapper.setLinkProvider(clp);
    }
    List<KalendarRenderWrapper> calendars = new ArrayList<>();
    calendars.add(calRenderWrapper);
    return new WeeklyCalendarController(ureq, wControl, calendars, WeeklyCalendarController.CALLER_COLLAB, businessGroup, false);
}
Also used : BusinessGroupService(org.olat.group.BusinessGroupService) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) CourseLinkProviderController(org.olat.course.run.calendar.CourseLinkProviderController) WeeklyCalendarController(org.olat.commons.calendar.ui.WeeklyCalendarController) RepositoryEntry(org.olat.repository.RepositoryEntry) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper)

Example 5 with WeeklyCalendarController

use of org.olat.commons.calendar.ui.WeeklyCalendarController in project openolat by klemens.

the class UserInfoMainController method doOpenCalendar.

private WeeklyCalendarController doOpenCalendar(UserRequest ureq) {
    removeAsListenerAndDispose(calendarController);
    KalendarRenderWrapper calendarWrapper = calendarManager.getPersonalCalendar(chosenIdentity);
    CalendarUserConfiguration config = calendarManager.findCalendarConfigForIdentity(calendarWrapper.getKalendar(), getIdentity());
    if (config != null) {
        calendarWrapper.setConfiguration(config);
    }
    calendarWrapper.setPrivateEventsVisible(chosenIdentity.equals(ureq.getIdentity()));
    if (chosenIdentity.equals(ureq.getIdentity())) {
        calendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
    } else {
        calendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
    }
    List<KalendarRenderWrapper> calendars = new ArrayList<KalendarRenderWrapper>();
    calendars.add(calendarWrapper);
    OLATResourceable ores = OresHelper.createOLATResourceableType(CMD_CALENDAR);
    WindowControl bwControl = addToHistory(ureq, ores, null);
    OLATResourceable callerOres = OresHelper.createOLATResourceableInstance(chosenIdentity.getName(), chosenIdentity.getKey());
    calendarController = new WeeklyCalendarController(ureq, bwControl, calendars, WeeklyCalendarController.CALLER_PROFILE, callerOres, false);
    listenTo(calendarController);
    return calendarController;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) ArrayList(java.util.ArrayList) WeeklyCalendarController(org.olat.commons.calendar.ui.WeeklyCalendarController) CalendarUserConfiguration(org.olat.commons.calendar.model.CalendarUserConfiguration) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) WindowControl(org.olat.core.gui.control.WindowControl)

Aggregations

ArrayList (java.util.ArrayList)6 WeeklyCalendarController (org.olat.commons.calendar.ui.WeeklyCalendarController)6 KalendarRenderWrapper (org.olat.commons.calendar.ui.components.KalendarRenderWrapper)6 WindowControl (org.olat.core.gui.control.WindowControl)4 OLATResourceable (org.olat.core.id.OLATResourceable)4 CalendarUserConfiguration (org.olat.commons.calendar.model.CalendarUserConfiguration)2 ICourse (org.olat.course.ICourse)2 CourseLinkProviderController (org.olat.course.run.calendar.CourseLinkProviderController)2 BusinessGroupService (org.olat.group.BusinessGroupService)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2