Search in sources :

Example 16 with AssessedIdentityElementRow

use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project OpenOLAT by OpenOLAT.

the class IdentityListCourseNodeController method getSelectedIdentities.

@Override
public List<IdentityRef> getSelectedIdentities() {
    Set<Integer> selections = tableEl.getMultiSelectedIndex();
    List<AssessedIdentityElementRow> rows = new ArrayList<>(selections.size());
    for (Integer i : selections) {
        AssessedIdentityElementRow row = usersTableModel.getObject(i.intValue());
        if (row != null && row.getAssessmentStatus() != AssessmentEntryStatus.done) {
            rows.add(row);
        }
    }
    if (rows == null || rows.isEmpty()) {
        return Collections.emptyList();
    }
    List<IdentityRef> selectedIdentities = new ArrayList<>();
    for (AssessedIdentityElementRow row : rows) {
        selectedIdentities.add(new IdentityRefImpl(row.getIdentityKey()));
    }
    return selectedIdentities;
}
Also used : IdentityRefImpl(org.olat.basesecurity.model.IdentityRefImpl) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) IdentityRef(org.olat.basesecurity.IdentityRef) ArrayList(java.util.ArrayList)

Example 17 with AssessedIdentityElementRow

use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project OpenOLAT by OpenOLAT.

the class IdentityListCourseNodeController method doSetDone.

private void doSetDone(UserRequest ureq) {
    Set<Integer> selections = tableEl.getMultiSelectedIndex();
    List<AssessedIdentityElementRow> rows = new ArrayList<>(selections.size());
    for (Integer i : selections) {
        AssessedIdentityElementRow row = usersTableModel.getObject(i.intValue());
        if (row != null && row.getAssessmentStatus() != AssessmentEntryStatus.done) {
            rows.add(row);
        }
    }
    if (rows == null || rows.isEmpty()) {
        showWarning("warning.bulk.done");
    } else if (courseNode instanceof AssessableCourseNode) {
        ICourse course = CourseFactory.loadCourse(courseEntry);
        AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
        for (AssessedIdentityElementRow row : rows) {
            Identity assessedIdentity = securityManager.loadIdentityByKey(row.getIdentityKey());
            Roles roles = securityManager.getRoles(assessedIdentity);
            IdentityEnvironment identityEnv = new IdentityEnvironment(assessedIdentity, roles);
            UserCourseEnvironment assessedUserCourseEnv = new UserCourseEnvironmentImpl(identityEnv, course.getCourseEnvironment(), coachCourseEnv.isCourseReadOnly());
            assessedUserCourseEnv.getScoreAccounting().evaluateAll();
            ScoreEvaluation scoreEval = assessableCourseNode.getUserScoreEvaluation(assessedUserCourseEnv);
            ScoreEvaluation doneEval = new ScoreEvaluation(scoreEval.getScore(), scoreEval.getPassed(), AssessmentEntryStatus.done, null, scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), scoreEval.getAssessmentID());
            assessableCourseNode.updateUserScoreEvaluation(doneEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
        }
        loadModel(ureq);
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) Roles(org.olat.core.id.Roles) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) Identity(org.olat.core.id.Identity) IdentityEnvironment(org.olat.core.id.IdentityEnvironment)

Example 18 with AssessedIdentityElementRow

use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project OpenOLAT by OpenOLAT.

the class STIdentityListCourseNodeController method loadModel.

@Override
protected void loadModel(UserRequest ureq) {
    Map<Long, Date> initialLaunchDates = userInfosMgr.getInitialLaunchDates(getCourseRepositoryEntry().getOlatResource());
    super.loadModel(ureq);
    List<AssessedIdentityElementRow> rows = usersTableModel.getObjects();
    for (AssessedIdentityElementRow row : rows) {
        Date initialLaunchDate = initialLaunchDates.get(row.getIdentityKey());
        row.setInitialCourseLaunchDate(initialLaunchDate);
    }
    AssessmentToolContainer toolContainer = getToolContainer();
    if (toolContainer.getCertificateMap() == null) {
        List<CertificateLight> certificates = certificatesManager.getLastCertificates(getCourseRepositoryEntry().getOlatResource());
        ConcurrentMap<Long, CertificateLight> certificateMap = new ConcurrentHashMap<>();
        for (CertificateLight certificate : certificates) {
            certificateMap.put(certificate.getIdentityKey(), certificate);
        }
        toolContainer.setCertificateMap(certificateMap);
    }
    usersTableModel.setCertificateMap(toolContainer.getCertificateMap());
}
Also used : AssessmentToolContainer(org.olat.modules.assessment.ui.AssessmentToolContainer) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Date(java.util.Date) CertificateLight(org.olat.course.certificate.CertificateLight)

Example 19 with AssessedIdentityElementRow

use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project openolat by klemens.

the class IdentityListCourseNodeController method doSetVisibility.

private void doSetVisibility(UserRequest ureq, Boolean visibility, List<AssessedIdentityElementRow> rows) {
    ICourse course = CourseFactory.loadCourse(courseEntry);
    AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
    for (AssessedIdentityElementRow row : rows) {
        Identity assessedIdentity = securityManager.loadIdentityByKey(row.getIdentityKey());
        Roles roles = securityManager.getRoles(assessedIdentity);
        IdentityEnvironment identityEnv = new IdentityEnvironment(assessedIdentity, roles);
        UserCourseEnvironment assessedUserCourseEnv = new UserCourseEnvironmentImpl(identityEnv, course.getCourseEnvironment(), coachCourseEnv.isCourseReadOnly());
        assessedUserCourseEnv.getScoreAccounting().evaluateAll();
        ScoreEvaluation scoreEval = assessableCourseNode.getUserScoreEvaluation(assessedUserCourseEnv);
        ScoreEvaluation doneEval = new ScoreEvaluation(scoreEval.getScore(), scoreEval.getPassed(), scoreEval.getAssessmentStatus(), visibility, scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), scoreEval.getAssessmentID());
        assessableCourseNode.updateUserScoreEvaluation(doneEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
    }
    loadModel(ureq);
}
Also used : CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) ICourse(org.olat.course.ICourse) Roles(org.olat.core.id.Roles) Identity(org.olat.core.id.Identity) IdentityEnvironment(org.olat.core.id.IdentityEnvironment)

Example 20 with AssessedIdentityElementRow

use of org.olat.modules.assessment.ui.AssessedIdentityElementRow in project openolat by klemens.

the class IdentityListCourseNodeController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    String filter = null;
    List<FlexiTableFilter> extendedFilters = null;
    if (state instanceof AssessedIdentityListState) {
        AssessedIdentityListState listState = (AssessedIdentityListState) state;
        if (StringHelper.containsNonWhitespace(listState.getFilter())) {
            filter = listState.getFilter();
        }
        extendedFilters = listState.getExtendedFilters();
    }
    tableEl.setSelectedFilterKey(filter);
    if (extendedFilters != null) {
        tableEl.setSelectedExtendedFilters(extendedFilters);
    }
    loadModel(ureq);
    if (entries != null && entries.size() > 0) {
        ContextEntry entry = entries.get(0);
        String resourceType = entry.getOLATResourceable().getResourceableTypeName();
        if ("Identity".equals(resourceType)) {
            Long identityKey = entries.get(0).getOLATResourceable().getResourceableId();
            for (int i = usersTableModel.getRowCount(); i-- > 0; ) {
                AssessedIdentityElementRow row = usersTableModel.getObject(i);
                if (row.getIdentityKey().equals(identityKey)) {
                    Controller ctrl = doSelect(ureq, row);
                    if (ctrl instanceof Activateable2) {
                        List<ContextEntry> subEntries = entries.subList(1, entries.size());
                        ((Activateable2) ctrl).activate(ureq, subEntries, entry.getTransientState());
                    }
                }
            }
        }
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) AssessedIdentityListState(org.olat.modules.assessment.ui.AssessedIdentityListState) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) AssessedIdentityController(org.olat.modules.assessment.ui.AssessedIdentityController) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) Controller(org.olat.core.gui.control.Controller) ContextEntry(org.olat.core.id.context.ContextEntry)

Aggregations

AssessedIdentityElementRow (org.olat.modules.assessment.ui.AssessedIdentityElementRow)22 ArrayList (java.util.ArrayList)10 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)6 Identity (org.olat.core.id.Identity)6 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)6 Roles (org.olat.core.id.Roles)6 ICourse (org.olat.course.ICourse)6 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)6 CalculatedAssessableCourseNode (org.olat.course.nodes.CalculatedAssessableCourseNode)6 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)6 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)6 UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)6 HashMap (java.util.HashMap)4 IdentityRef (org.olat.basesecurity.IdentityRef)4 IdentityRefImpl (org.olat.basesecurity.model.IdentityRefImpl)4 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)4 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)4 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)4 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)4 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)4