Search in sources :

Example 21 with UserCourseEnvironmentImpl

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

the class CourseRuntimeController method initToolbar.

@Override
protected void initToolbar(Dropdown toolsDropdown, Dropdown settingsDropdown) {
    toolbarPanel.removeAllTools();
    if (corrupted)
        return;
    ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
    UserCourseEnvironmentImpl uce = getUserCourseEnvironment();
    if (!course.getCourseConfig().isToolbarEnabled() && !reSecurity.isEntryAdmin() && !reSecurity.isCourseCoach() && !reSecurity.isGroupCoach() && !hasCourseRight(CourseRights.RIGHT_COURSEEDITOR) && !hasCourseRight(CourseRights.RIGHT_MEMBERMANAGEMENT) && !hasCourseRight(CourseRights.RIGHT_GROUPMANAGEMENT) && !hasCourseRight(CourseRights.RIGHT_ARCHIVING) && !hasCourseRight(CourseRights.RIGHT_STATISTICS) && !hasCourseRight(CourseRights.RIGHT_DB) && !hasCourseRight(CourseRights.RIGHT_ASSESSMENT) && !hasCourseRight(CourseRights.RIGHT_ASSESSMENT_MODE)) {
        toolbarPanel.setToolbarEnabled(false);
    } else {
        toolbarPanel.setToolbarEnabled(true);
    }
    if (!isAssessmentLock()) {
        initTools(toolsDropdown, course, uce);
        initSettingsTools(settingsDropdown);
        initEditionTools(settingsDropdown);
        initDeleteTools(settingsDropdown, true);
    }
    initToolsMyCourse(course, uce);
    initGeneralTools(course);
    if (getRunMainController() != null) {
        getRunMainController().initToolbar();
    }
    setCourseClosedMessage(uce);
}
Also used : UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) ICourse(org.olat.course.ICourse)

Example 22 with UserCourseEnvironmentImpl

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

the class CourseRuntimeController method doAssessmentStatistics.

/**
 * Only an helper method for the 2 methods above. Don't call it directly, there is no request on close guard.
 * @param ureq
 * @param i18nCrumbKey
 * @param typeName
 * @param tool
 * @param types
 * @return
 */
private Activateable2 doAssessmentStatistics(UserRequest ureq, String i18nCrumbKey, String typeName, Link tool, QTIType... types) {
    OLATResourceable ores = OresHelper.createOLATResourceableType(typeName);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
    WindowControl swControl = addToHistory(ureq, ores, null);
    if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach() || hasCourseRight(CourseRights.RIGHT_STATISTICS)) {
        removeCustomCSS();
        UserCourseEnvironmentImpl uce = getUserCourseEnvironment();
        StatisticCourseNodesController ctrl = new StatisticCourseNodesController(ureq, swControl, toolbarPanel, reSecurity, uce, types);
        listenTo(ctrl);
        statsToolCtr = pushController(ureq, translate(i18nCrumbKey), ctrl);
        currentToolCtr = statsToolCtr;
        setActiveTool(tool);
        return statsToolCtr;
    }
    return null;
}
Also used : StatisticCourseNodesController(org.olat.course.statistic.StatisticCourseNodesController) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) OLATResourceable(org.olat.core.id.OLATResourceable) WindowControl(org.olat.core.gui.control.WindowControl)

Example 23 with UserCourseEnvironmentImpl

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

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 24 with UserCourseEnvironmentImpl

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

the class CourseRuntimeController method loadRights.

@Override
protected void loadRights(RepositoryEntrySecurity security) {
    super.loadRights(security);
    if (corrupted)
        return;
    ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
    CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
    // 3) all other rights are defined in the groupmanagement using the learning
    // group rights
    UserCourseEnvironmentImpl uce = getUserCourseEnvironment();
    if (uce != null) {
        uce.setUserRoles(security.isEntryAdmin(), security.isCourseCoach() || security.isGroupCoach(), security.isCourseParticipant() || security.isGroupParticipant());
        if (security.isReadOnly()) {
            if (overrideReadOnly) {
                uce.setCourseReadOnly(Boolean.FALSE);
            } else {
                uce.setCourseReadOnly(Boolean.TRUE);
            }
        } else {
            uce.setCourseReadOnly(Boolean.FALSE);
        }
    }
    courseRightsCache = new HashMap<>();
    if (!security.isEntryAdmin() && !isGuestOnly) {
        List<String> rights = cgm.getRights(getIdentity());
        courseRightsCache.put(CourseRights.RIGHT_GROUPMANAGEMENT, Boolean.valueOf(rights.contains(CourseRights.RIGHT_GROUPMANAGEMENT)));
        courseRightsCache.put(CourseRights.RIGHT_MEMBERMANAGEMENT, Boolean.valueOf(rights.contains(CourseRights.RIGHT_MEMBERMANAGEMENT)));
        courseRightsCache.put(CourseRights.RIGHT_COURSEEDITOR, Boolean.valueOf(rights.contains(CourseRights.RIGHT_COURSEEDITOR)));
        courseRightsCache.put(CourseRights.RIGHT_ARCHIVING, Boolean.valueOf(rights.contains(CourseRights.RIGHT_ARCHIVING)));
        courseRightsCache.put(CourseRights.RIGHT_ASSESSMENT, Boolean.valueOf(rights.contains(CourseRights.RIGHT_ASSESSMENT)));
        courseRightsCache.put(CourseRights.RIGHT_ASSESSMENT_MODE, Boolean.valueOf(rights.contains(CourseRights.RIGHT_ASSESSMENT_MODE)));
        courseRightsCache.put(CourseRights.RIGHT_GLOSSARY, Boolean.valueOf(rights.contains(CourseRights.RIGHT_GLOSSARY)));
        courseRightsCache.put(CourseRights.RIGHT_STATISTICS, Boolean.valueOf(rights.contains(CourseRights.RIGHT_STATISTICS)));
        courseRightsCache.put(CourseRights.RIGHT_DB, Boolean.valueOf(rights.contains(CourseRights.RIGHT_DB)));
    }
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) ICourse(org.olat.course.ICourse)

Example 25 with UserCourseEnvironmentImpl

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

the class EPFrontendManager method submitMap.

private void submitMap(PortfolioStructureMap map, boolean logActivity, Role by) {
    // add an exception
    if (!(map instanceof EPStructuredMap))
        return;
    EPStructuredMap submittedMap = (EPStructuredMap) map;
    structureManager.submitMap(submittedMap);
    EPTargetResource resource = submittedMap.getTargetResource();
    OLATResourceable courseOres = resource.getOLATResourceable();
    ICourse course = CourseFactory.loadCourse(courseOres);
    AssessmentManager am = course.getCourseEnvironment().getAssessmentManager();
    CourseNode courseNode = course.getRunStructure().getNode(resource.getSubPath());
    List<Identity> owners = policyManager.getOwners(submittedMap);
    for (Identity owner : owners) {
        if (courseNode != null) {
            // courseNode might have been deleted meanwhile
            IdentityEnvironment ienv = new IdentityEnvironment();
            ienv.setIdentity(owner);
            UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
            if (logActivity) {
                am.incrementNodeAttempts(courseNode, owner, uce, by);
            } else {
                am.incrementNodeAttemptsInBackground(courseNode, owner, uce);
            }
            RepositoryEntry referenceEntry = courseNode.getReferencedRepositoryEntry();
            RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
            assessmentService.updateAssessmentEntry(owner, courseEntry, courseNode.getIdent(), referenceEntry, AssessmentEntryStatus.inReview);
        }
        assessmentNotificationsHandler.markPublisherNews(owner, course.getResourceableId());
        log.audit("Map " + map + " from " + owner.getName() + " has been submitted.");
    }
}
Also used : EPStructuredMap(org.olat.portfolio.model.structel.EPStructuredMap) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) EPTargetResource(org.olat.portfolio.model.structel.EPTargetResource) OLATResourceable(org.olat.core.id.OLATResourceable) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessmentManager(org.olat.course.assessment.AssessmentManager) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) 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