Search in sources :

Example 11 with AssessedIdentityElementRow

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

the class IdentityListCourseNodeTableModel method filter.

@Override
public void filter(List<FlexiTableFilter> filters) {
    String key = filters == null || filters.isEmpty() || filters.get(0) == null ? null : filters.get(0).getFilter();
    if (StringHelper.containsNonWhitespace(key)) {
        List<AssessedIdentityElementRow> filteredRows = new ArrayList<>();
        if ("passed".equals(key)) {
            for (AssessedIdentityElementRow row : backups) {
                if (row.getPassed() != null && row.getPassed().booleanValue()) {
                    filteredRows.add(row);
                }
            }
        } else if ("failed".equals(key)) {
            for (AssessedIdentityElementRow row : backups) {
                if (row.getPassed() != null && !row.getPassed().booleanValue()) {
                    filteredRows.add(row);
                }
            }
        } else if (AssessmentEntryStatus.isValueOf(key)) {
            for (AssessedIdentityElementRow row : backups) {
                if (row.getAssessmentStatus() != null && key.equals(row.getAssessmentStatus().name())) {
                    filteredRows.add(row);
                }
            }
        } else {
            filteredRows.addAll(backups);
        }
        super.setObjects(filteredRows);
    } else {
        super.setObjects(backups);
    }
}
Also used : AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) ArrayList(java.util.ArrayList)

Example 12 with AssessedIdentityElementRow

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

the class GTAIdentityListCourseNodeController method loadTasksInModel.

private void loadTasksInModel(TaskList taskList) {
    List<Task> tasks = gtaManager.getTasks(taskList, (GTACourseNode) courseNode);
    Map<Long, Task> identityToTask = new HashMap<>();
    for (Task task : tasks) {
        if (task.getIdentity() != null) {
            identityToTask.put(task.getIdentity().getKey(), task);
        }
    }
    List<AssessedIdentityElementRow> rows = usersTableModel.getObjects();
    for (AssessedIdentityElementRow row : rows) {
        Task task = identityToTask.get(row.getIdentityKey());
        if (task != null && StringHelper.containsNonWhitespace(task.getTaskName())) {
            row.setDetails(task.getTaskName());
        }
    }
}
Also used : Task(org.olat.course.nodes.gta.Task) HashMap(java.util.HashMap) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow)

Example 13 with AssessedIdentityElementRow

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

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 14 with AssessedIdentityElementRow

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

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)

Example 15 with AssessedIdentityElementRow

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

the class IdentityListCourseNodeController method doConfirmVisible.

private void doConfirmVisible(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) {
            rows.add(row);
        }
    }
    if (rows == null || rows.isEmpty()) {
        showWarning("warning.bulk.done");
    } else {
        changeUserVisibilityCtrl = new ConfirmUserVisibilityController(ureq, getWindowControl(), rows);
        listenTo(changeUserVisibilityCtrl);
        String title = translate("change.visibility.title");
        cmc = new CloseableModalController(getWindowControl(), "close", changeUserVisibilityCtrl.getInitialComponent(), true, title);
        listenTo(cmc);
        cmc.activate();
    }
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) ArrayList(java.util.ArrayList)

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