Package org.olat.commons.calendar.model

Examples of org.olat.commons.calendar.model.KalendarConfig


      if (iCalAccess == CollaborationTools.CALENDAR_ACCESS_OWNERS && !isOwner) {
        groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
      } else {
        groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
      }
      KalendarConfig config = calendarManager.findKalendarConfigForIdentity(groupCalendarWrapper.getKalendar(), ureq);
      if (config != null) {
        groupCalendarWrapper.getKalendarConfig().setCss(config.getCss());
        groupCalendarWrapper.getKalendarConfig().setVis(config.isVis());
      }
      groupCalendarWrapper.setLinkProvider(linkProvider);
      calendars.add(groupCalendarWrapper);
    }
  }
View Full Code Here


   
    // get the personal calendar
    CalendarManager calendarManager = CalendarManagerFactory.getInstance().getCalendarManager();
    KalendarRenderWrapper calendarWrapper = calendarManager.getPersonalCalendar(ureq.getIdentity());
    calendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
    KalendarConfig personalKalendarConfig = calendarManager.findKalendarConfigForIdentity(
        calendarWrapper.getKalendar(), ureq);
    if (personalKalendarConfig != null) {
      calendarWrapper.getKalendarConfig().setCss(personalKalendarConfig.getCss());
      calendarWrapper.getKalendarConfig().setVis(personalKalendarConfig.isVis());
    }
    calendars.add(calendarWrapper);
   
    // get group calendars
    BusinessGroupManager bgManager = BusinessGroupManagerImpl.getInstance();
    List<BusinessGroup> ownerGroups = bgManager.findBusinessGroupsOwnedBy(null, ureq.getIdentity(), null);
    addCalendars(ureq, ownerGroups, true, calendars);
    List<BusinessGroup> attendedGroups = bgManager.findBusinessGroupsAttendedBy(null, ureq.getIdentity(), null);
    for (Iterator<BusinessGroup> ownerGroupsIterator = ownerGroups.iterator(); ownerGroupsIterator.hasNext();) {
      BusinessGroup ownerGroup = ownerGroupsIterator.next();
      if (attendedGroups.contains(ownerGroup))
        attendedGroups.remove(ownerGroup);
    }
    addCalendars(ureq, attendedGroups, false, calendars);
   
    // add course calendars
    List<String> subscribedCourseCalendarIDs = CourseCalendarSubscription.getSubscribedCourseCalendarIDs(
        ureq.getUserSession().getGuiPreferences());
   
    RepositoryManager repoManager = RepositoryManager.getInstance();
    List<String> calendarIDsToBeRemoved = new ArrayList<String>();
    for (Iterator<String> iter = subscribedCourseCalendarIDs.iterator(); iter.hasNext();) {
      String courseCalendarID = iter.next();
      final long courseResourceableID = Long.parseLong(courseCalendarID);
     
      RepositoryEntry repoEntry = repoManager.lookupRepositoryEntry(new OLATResourceable() {

        public Long getResourceableId() { return new Long(courseResourceableID); }
        public String getResourceableTypeName() { return CourseModule.getCourseTypeName(); }
      }, false);
      if (repoEntry == null) {
        // mark calendar ID for cleanup
        calendarIDsToBeRemoved.add(courseCalendarID);
        continue;
      }
      ICourse course = CourseFactory.loadCourse(new Long(courseResourceableID));
      //calendar course aren't enabled per default but course node of type calendar are always possible
      //REVIEW if (!course.getCourseEnvironment().getCourseConfig().isCalendarEnabled()) continue;
      // add course calendar
      KalendarRenderWrapper courseCalendarWrapper = calendarManager.getCourseCalendar(course);
      CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
      boolean isPrivileged = cgm.isIdentityCourseAdministrator(ureq.getIdentity())
        || cgm.hasRight(ureq.getIdentity(), CourseRights.RIGHT_COURSEEDITOR);
      if (isPrivileged) {
        courseCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
      } else {
        courseCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
      }
      KalendarConfig courseKalendarConfig = calendarManager.findKalendarConfigForIdentity(courseCalendarWrapper.getKalendar(), ureq);
      if (courseKalendarConfig != null) {
        courseCalendarWrapper.getKalendarConfig().setCss(courseKalendarConfig.getCss());
        courseCalendarWrapper.getKalendarConfig().setVis(courseKalendarConfig.isVis());
      }
      courseCalendarWrapper.setLinkProvider(new CourseLinkProviderController(course, ureq, wControl));
      calendars.add(courseCalendarWrapper);
    }
View Full Code Here

  }

  public KalendarRenderWrapper getPersonalCalendar(Identity identity) {
    Kalendar cal = getCalendar(CalendarManager.TYPE_USER, identity.getName());
    KalendarRenderWrapper calendarWrapper = new KalendarRenderWrapper(cal);
    KalendarConfig config = new KalendarConfig(identity.getName(), KalendarRenderWrapper.CALENDAR_COLOR_BLUE, true);
    calendarWrapper.setKalendarConfig(config);
    return calendarWrapper;
  }
View Full Code Here

  }

  public KalendarRenderWrapper getImportedCalendar(Identity identity, String calendarName) {
    Kalendar cal = getCalendar(CalendarManager.TYPE_USER, ImportCalendarManager.getImportedCalendarID(identity, calendarName));
    KalendarRenderWrapper calendarWrapper = new KalendarRenderWrapper(cal);
    KalendarConfig config = new KalendarConfig(calendarName, KalendarRenderWrapper.CALENDAR_COLOR_BLUE, true);
    calendarWrapper.setKalendarConfig(config);
    return calendarWrapper;
  }
View Full Code Here

  }
 
  public KalendarRenderWrapper getGroupCalendar(BusinessGroup businessGroup) {
    Kalendar cal = getCalendar(CalendarManager.TYPE_GROUP, businessGroup.getResourceableId().toString());
    KalendarRenderWrapper calendarWrapper = new KalendarRenderWrapper(cal);
    KalendarConfig config = new KalendarConfig(businessGroup.getName(), KalendarRenderWrapper.CALENDAR_COLOR_ORANGE, true);
    calendarWrapper.setKalendarConfig(config);
    return calendarWrapper;
  }
View Full Code Here

  }
 
  public KalendarRenderWrapper getCourseCalendar(ICourse course) {
    Kalendar cal = getCalendar(CalendarManager.TYPE_COURSE, course.getResourceableId().toString());
    KalendarRenderWrapper calendarWrapper = new KalendarRenderWrapper(cal);
    KalendarConfig config = new KalendarConfig(course.getCourseTitle(), KalendarRenderWrapper.CALENDAR_COLOR_GREEN, true);
    calendarWrapper.setKalendarConfig(config);
    return calendarWrapper;
  }
View Full Code Here

      if (iCalAccess == CollaborationTools.CALENDAR_ACCESS_OWNERS && !isOwner) {
        groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
      } else {
        groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
      }
      KalendarConfig groupKalendarConfig = calendarManager.findKalendarConfigForIdentity(groupCalendarWrapper.getKalendar(), ureq);
      if (groupKalendarConfig != null) {
        groupCalendarWrapper.getKalendarConfig().setCss(groupKalendarConfig.getCss());
        groupCalendarWrapper.getKalendarConfig().setVis(groupKalendarConfig.isVis());
      }
      calendars.add(groupCalendarWrapper);
    }
  }
View Full Code Here

      Property calendarProperty = (Property)propertyIter.next();
      String calendarName = calendarProperty.getName();
      KalendarRenderWrapper calendarWrapper = calManager.getImportedCalendar(ureq.getIdentity(), calendarName);
      calendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
      calendarWrapper.setImported(true);
      KalendarConfig importedKalendarConfig = calManager.findKalendarConfigForIdentity(
          calendarWrapper.getKalendar(), ureq);
      if (importedKalendarConfig != null) {
        calendarWrapper.getKalendarConfig().setCss(importedKalendarConfig.getCss());
        calendarWrapper.getKalendarConfig().setVis(importedKalendarConfig.isVis());
      }
      calendars.add(calendarWrapper);
    }
    Collections.sort(calendars, KalendarComparator.getInstance());
    return calendars;
View Full Code Here

TOP

Related Classes of org.olat.commons.calendar.model.KalendarConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.