Search in sources :

Example 46 with CourseGroupManager

use of org.olat.course.groupsandrights.CourseGroupManager in project OpenOLAT by OpenOLAT.

the class PreviewConfigHelper method getPreviewCourseEnvironment.

public static CourseEnvironment getPreviewCourseEnvironment(boolean isCoach, boolean isCourseAdmin, ICourse course) {
    // generateEnvironment();
    final RepositoryEntry courseResource = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    final CourseGroupManager cgm = new PreviewCourseGroupManager(courseResource, new ArrayList<BusinessGroup>(), new ArrayList<BGArea>(), isCoach, isCourseAdmin);
    final UserNodeAuditManager auditman = new PreviewAuditManager();
    final AssessmentManager am = new PreviewAssessmentManager();
    final CoursePropertyManager cpm = new PreviewCoursePropertyManager();
    final Structure runStructure = course.getEditorTreeModel().createStructureForPreview();
    final String title = course.getCourseTitle();
    final CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
    CourseEnvironment previewCourseEnvironment = new PreviewCourseEnvironment(title, runStructure, new Date(), course.getCourseFolderContainer(), course.getCourseBaseContainer(), course.getResourceableId(), cpm, cgm, auditman, am, courseConfig);
    return previewCourseEnvironment;
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) BusinessGroup(org.olat.group.BusinessGroup) AssessmentManager(org.olat.course.assessment.AssessmentManager) RepositoryEntry(org.olat.repository.RepositoryEntry) Date(java.util.Date) CourseConfig(org.olat.course.config.CourseConfig) UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) BGArea(org.olat.group.area.BGArea) Structure(org.olat.course.Structure) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 47 with CourseGroupManager

use of org.olat.course.groupsandrights.CourseGroupManager in project OpenOLAT by OpenOLAT.

the class RunMainController method reloadGroupMemberships.

/**
 * Initialize the users group memberships for groups used within this course
 *
 * @param identity
 */
protected void reloadGroupMemberships(RepositoryEntrySecurity reSecurity) {
    CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
    List<BusinessGroup> coachedGroups;
    if (reSecurity.isGroupCoach()) {
        coachedGroups = cgm.getOwnedBusinessGroups(getIdentity());
    } else {
        coachedGroups = Collections.emptyList();
    }
    List<BusinessGroup> participatedGroups;
    if (reSecurity.isGroupParticipant()) {
        participatedGroups = cgm.getParticipatingBusinessGroups(getIdentity());
    } else {
        participatedGroups = Collections.emptyList();
    }
    List<BusinessGroup> waitingLists;
    if (reSecurity.isGroupWaiting()) {
        waitingLists = cgm.getWaitingListGroups(getIdentity());
    } else {
        waitingLists = Collections.emptyList();
    }
    uce.setCourseReadOnly(reSecurity.isReadOnly());
    uce.setGroupMemberships(coachedGroups, participatedGroups, waitingLists);
    needsRebuildAfterRunDone = true;
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) BusinessGroup(org.olat.group.BusinessGroup)

Example 48 with CourseGroupManager

use of org.olat.course.groupsandrights.CourseGroupManager in project OpenOLAT by OpenOLAT.

the class UserCourseEnvironmentImpl method isAdmin.

@Override
public boolean isAdmin() {
    if (admin != null) {
        return admin.booleanValue();
    }
    // lazy loading
    CourseGroupManager cgm = courseEnvironment.getCourseGroupManager();
    boolean admiLazy = cgm.isIdentityCourseAdministrator(identityEnvironment.getIdentity());
    admin = new Boolean(admiLazy);
    return admiLazy;
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager)

Example 49 with CourseGroupManager

use of org.olat.course.groupsandrights.CourseGroupManager in project OpenOLAT by OpenOLAT.

the class UserCourseEnvironmentImpl method isParticipant.

@Override
public boolean isParticipant() {
    if (participant != null) {
        return participant.booleanValue();
    }
    // lazy loading
    CourseGroupManager cgm = courseEnvironment.getCourseGroupManager();
    boolean partLazy = cgm.isIdentityCourseParticipant(identityEnvironment.getIdentity());
    participant = new Boolean(partLazy);
    return partLazy;
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager)

Example 50 with CourseGroupManager

use of org.olat.course.groupsandrights.CourseGroupManager in project OpenOLAT by OpenOLAT.

the class UserCourseEnvironmentImpl method isCoachOfAnyCourse.

@Override
public boolean isCoachOfAnyCourse() {
    if (coachAnyCourse != null) {
        return coachAnyCourse.booleanValue();
    }
    CourseGroupManager cgm = courseEnvironment.getCourseGroupManager();
    boolean coachLazy = cgm.isIdentityAnyCourseCoach(identityEnvironment.getIdentity());
    coachAnyCourse = new Boolean(coachLazy);
    return coachLazy;
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager)

Aggregations

CourseGroupManager (org.olat.course.groupsandrights.CourseGroupManager)84 Identity (org.olat.core.id.Identity)28 ICourse (org.olat.course.ICourse)28 BusinessGroup (org.olat.group.BusinessGroup)26 RepositoryEntry (org.olat.repository.RepositoryEntry)22 HashSet (java.util.HashSet)12 Roles (org.olat.core.id.Roles)12 ArrayList (java.util.ArrayList)10 BusinessGroupService (org.olat.group.BusinessGroupService)10 KalendarRenderWrapper (org.olat.commons.calendar.ui.components.KalendarRenderWrapper)8 UserRequest (org.olat.core.gui.UserRequest)8 CourseEditorEnv (org.olat.course.editor.CourseEditorEnv)8 PersistingCourseGroupManager (org.olat.course.groupsandrights.PersistingCourseGroupManager)8 OLATResource (org.olat.resource.OLATResource)8 File (java.io.File)6 Date (java.util.Date)6 CalendarManager (org.olat.commons.calendar.CalendarManager)6 Publisher (org.olat.core.commons.services.notifications.Publisher)6 OLATResourceable (org.olat.core.id.OLATResourceable)6 AssertException (org.olat.core.logging.AssertException)6