Search in sources :

Example 1 with CalWebService

use of org.olat.commons.calendar.restapi.CalWebService in project OpenOLAT by OpenOLAT.

the class CourseWebService method getCourseCalendarWebService.

@Path("calendar")
public CalWebService getCourseCalendarWebService(@Context HttpServletRequest request) {
    CalendarModule calendarModule = CoreSpringFactory.getImpl(CalendarModule.class);
    if (calendarModule.isEnabled() && (calendarModule.isEnableCourseToolCalendar() || calendarModule.isEnableCourseElementCalendar()) && course.getCourseConfig().isCalendarEnabled()) {
        UserRequest ureq = getUserRequest(request);
        IdentityEnvironment ienv = new IdentityEnvironment();
        ienv.setIdentity(ureq.getIdentity());
        ienv.setRoles(ureq.getUserSession().getRoles());
        UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
        KalendarRenderWrapper wrapper = CourseCalendars.getCourseCalendarWrapper(ureq, userCourseEnv, null);
        return new CalWebService(wrapper);
    }
    return null;
}
Also used : UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) CalWebService(org.olat.commons.calendar.restapi.CalWebService) CalendarModule(org.olat.commons.calendar.CalendarModule) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) IdentityEnvironment(org.olat.core.id.IdentityEnvironment) RestSecurityHelper.getUserRequest(org.olat.restapi.security.RestSecurityHelper.getUserRequest) UserRequest(org.olat.core.gui.UserRequest) Path(javax.ws.rs.Path)

Example 2 with CalWebService

use of org.olat.commons.calendar.restapi.CalWebService in project openolat by klemens.

the class CourseWebService method getCourseCalendarWebService.

@Path("calendar")
public CalWebService getCourseCalendarWebService(@Context HttpServletRequest request) {
    CalendarModule calendarModule = CoreSpringFactory.getImpl(CalendarModule.class);
    if (calendarModule.isEnabled() && (calendarModule.isEnableCourseToolCalendar() || calendarModule.isEnableCourseElementCalendar()) && course.getCourseConfig().isCalendarEnabled()) {
        UserRequest ureq = getUserRequest(request);
        IdentityEnvironment ienv = new IdentityEnvironment();
        ienv.setIdentity(ureq.getIdentity());
        ienv.setRoles(ureq.getUserSession().getRoles());
        UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
        KalendarRenderWrapper wrapper = CourseCalendars.getCourseCalendarWrapper(ureq, userCourseEnv, null);
        return new CalWebService(wrapper);
    }
    return null;
}
Also used : UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) CalWebService(org.olat.commons.calendar.restapi.CalWebService) CalendarModule(org.olat.commons.calendar.CalendarModule) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) IdentityEnvironment(org.olat.core.id.IdentityEnvironment) RestSecurityHelper.getUserRequest(org.olat.restapi.security.RestSecurityHelper.getUserRequest) UserRequest(org.olat.core.gui.UserRequest) Path(javax.ws.rs.Path)

Aggregations

Path (javax.ws.rs.Path)2 CalendarModule (org.olat.commons.calendar.CalendarModule)2 CalWebService (org.olat.commons.calendar.restapi.CalWebService)2 KalendarRenderWrapper (org.olat.commons.calendar.ui.components.KalendarRenderWrapper)2 UserRequest (org.olat.core.gui.UserRequest)2 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)2 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)2 UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)2 RestSecurityHelper.getUserRequest (org.olat.restapi.security.RestSecurityHelper.getUserRequest)2