Search in sources :

Example 81 with UserCourseEnvironmentImpl

use of org.olat.course.run.userview.UserCourseEnvironmentImpl in project openolat by klemens.

the class CourseRuntimeController method getUserCourseEnvironment.

private UserCourseEnvironmentImpl getUserCourseEnvironment() {
    RunMainController run = getRunMainController();
    UserCourseEnvironmentImpl uce = run == null ? null : run.getUce();
    if (uce != null && uce.isCourseReadOnly() && overrideReadOnly) {
        uce.setCourseReadOnly(Boolean.FALSE);
    }
    return uce;
}
Also used : UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl)

Example 82 with UserCourseEnvironmentImpl

use of org.olat.course.run.userview.UserCourseEnvironmentImpl in project openolat by klemens.

the class CourseRuntimeController method processBusinessGroupModifiedEvent.

private void processBusinessGroupModifiedEvent(BusinessGroupModifiedEvent bgme) {
    Identity identity = getIdentity();
    // was adding or removing of the user
    if (bgme.wasMyselfAdded(identity) || bgme.wasMyselfRemoved(identity)) {
        reSecurity = repositoryManager.isAllowed(getIdentity(), roles, getRepositoryEntry());
        reloadGroupMemberships(reSecurity);
        loadRights(reSecurity);
        initToolbar();
    } else if (bgme.getCommand().equals(BusinessGroupModifiedEvent.GROUPRIGHTS_MODIFIED_EVENT)) {
        // check if this affects a right group where the user does participate.
        // if so, we need to rebuild the toolboxes
        UserCourseEnvironmentImpl uce = getUserCourseEnvironment();
        if (uce != null && (PersistenceHelper.listContainsObjectByKey(uce.getParticipatingGroups(), bgme.getModifiedGroupKey()) || PersistenceHelper.listContainsObjectByKey(uce.getCoachedGroups(), bgme.getModifiedGroupKey()))) {
            reSecurity = repositoryManager.isAllowed(getIdentity(), roles, getRepositoryEntry());
            reloadGroupMemberships(reSecurity);
            loadRights(reSecurity);
            initToolbar();
        }
    }
}
Also used : UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) Identity(org.olat.core.id.Identity)

Example 83 with UserCourseEnvironmentImpl

use of org.olat.course.run.userview.UserCourseEnvironmentImpl in project openolat by klemens.

the class RunMainController method loadUserCourseEnvironment.

private UserCourseEnvironmentImpl loadUserCourseEnvironment(UserRequest ureq, RepositoryEntrySecurity reSecurity) {
    CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
    List<BusinessGroup> coachedGroups;
    if (reSecurity.isGroupCoach()) {
        coachedGroups = cgm.getOwnedBusinessGroups(ureq.getIdentity());
    } else {
        coachedGroups = Collections.emptyList();
    }
    List<BusinessGroup> participatedGroups;
    if (reSecurity.isGroupParticipant()) {
        participatedGroups = cgm.getParticipatingBusinessGroups(ureq.getIdentity());
    } else {
        participatedGroups = Collections.emptyList();
    }
    List<BusinessGroup> waitingLists;
    if (reSecurity.isGroupWaiting()) {
        waitingLists = cgm.getWaitingListGroups(ureq.getIdentity());
    } else {
        waitingLists = Collections.emptyList();
    }
    return new UserCourseEnvironmentImpl(ureq.getUserSession().getIdentityEnvironment(), course.getCourseEnvironment(), getWindowControl(), coachedGroups, participatedGroups, waitingLists, reSecurity.isCourseCoach() || reSecurity.isGroupCoach(), reSecurity.isEntryAdmin(), reSecurity.isCourseParticipant() || reSecurity.isGroupParticipant(), reSecurity.isReadOnly());
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) BusinessGroup(org.olat.group.BusinessGroup)

Example 84 with UserCourseEnvironmentImpl

use of org.olat.course.run.userview.UserCourseEnvironmentImpl in project openolat by klemens.

the class QTI21ResetDataController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (courseNode instanceof IQTESTCourseNode) {
        IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
        RepositoryEntry testEntry = courseNode.getReferencedRepositoryEntry();
        RepositoryEntry courseEntry = courseEnv.getCourseGroupManager().getCourseEntry();
        ICourse course = CourseFactory.loadCourse(courseEntry);
        archiveData(course, options);
        qtiService.deleteAssessmentTestSession(identities, testEntry, courseEntry, courseNode.getIdent());
        for (Identity identity : identities) {
            ScoreEvaluation scoreEval = new ScoreEvaluation(null, null, AssessmentEntryStatus.notStarted, null, Boolean.FALSE, 0.0d, AssessmentRunStatus.notStarted, null);
            IdentityEnvironment ienv = new IdentityEnvironment(identity, studentRoles);
            UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, courseEnv);
            testCourseNode.updateUserScoreEvaluation(scoreEval, uce, getIdentity(), false, Role.coach);
            testCourseNode.updateCurrentCompletion(uce, getIdentity(), null, AssessmentRunStatus.notStarted, Role.coach);
        }
    } else if (assessedEntry != null) {
        archiveData(assessedEntry);
        qtiService.deleteAssessmentTestSession(identities, assessedEntry, null, null);
    }
    fireEvent(ureq, Event.CHANGED_EVENT);
}
Also used : IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) IdentityEnvironment(org.olat.core.id.IdentityEnvironment)

Aggregations

UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)84 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)60 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)58 ICourse (org.olat.course.ICourse)40 Identity (org.olat.core.id.Identity)32 RepositoryEntry (org.olat.repository.RepositoryEntry)28 CourseNode (org.olat.course.nodes.CourseNode)24 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)22 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)22 Roles (org.olat.core.id.Roles)14 ArrayList (java.util.ArrayList)12 NodeEvaluation (org.olat.course.run.userview.NodeEvaluation)12 VisibleTreeFilter (org.olat.course.run.userview.VisibleTreeFilter)12 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)10 BusinessGroup (org.olat.group.BusinessGroup)10 VFSContainer (org.olat.core.util.vfs.VFSContainer)8 TreeEvaluation (org.olat.course.run.userview.TreeEvaluation)8 Test (org.junit.Test)7 WebApplicationException (javax.ws.rs.WebApplicationException)6 TreeNode (org.olat.core.gui.components.tree.TreeNode)6