Search in sources :

Example 1 with CertificateAndEfficiencyStatement

use of org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement in project OpenOLAT by OpenOLAT.

the class CertificateAndEfficiencyStatementListController method doShowStatement.

private void doShowStatement(UserRequest ureq, CertificateAndEfficiencyStatement statement) {
    RepositoryEntry entry = repositoryService.loadByResourceKey(statement.getResourceKey());
    EfficiencyStatement efficiencyStatment = esm.getUserEfficiencyStatementByKey(statement.getEfficiencyStatementKey());
    CertificateAndEfficiencyStatementController efficiencyCtrl = new CertificateAndEfficiencyStatementController(getWindowControl(), ureq, assessedIdentity, null, statement.getResourceKey(), entry, efficiencyStatment, false);
    listenTo(efficiencyCtrl);
    stackPanel.pushController(statement.getDisplayName(), efficiencyCtrl);
}
Also used : RepositoryEntry(org.olat.repository.RepositoryEntry) EfficiencyStatement(org.olat.course.assessment.EfficiencyStatement) CertificateAndEfficiencyStatement(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement)

Example 2 with CertificateAndEfficiencyStatement

use of org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement in project OpenOLAT by OpenOLAT.

the class CertificateAndEfficiencyStatementListController method updateStatement.

private void updateStatement(Long resourceKey, Long certificateKey) {
    List<CertificateAndEfficiencyStatement> statements = tableModel.getObjects();
    for (int i = statements.size(); i-- > 0; ) {
        CertificateAndEfficiencyStatement statement = statements.get(i);
        if (resourceKey.equals(statement.getResourceKey())) {
            CertificateLight certificate = certificatesManager.getCertificateLightById(certificateKey);
            statement.setCertificate(certificate);
            break;
        }
    }
}
Also used : CertificateAndEfficiencyStatement(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement) CertificateLight(org.olat.course.certificate.CertificateLight)

Example 3 with CertificateAndEfficiencyStatement

use of org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement in project OpenOLAT by OpenOLAT.

the class CertificateAndEfficiencyStatementListController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == confirmDeleteCtr) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            CertificateAndEfficiencyStatement statement = (CertificateAndEfficiencyStatement) confirmDeleteCtr.getUserObject();
            doDelete(statement.getEfficiencyStatementKey());
        }
    } else if (collectorCtrl == source) {
        cmc.deactivate();
        cleanUp();
    } else if (cmc == source) {
        cleanUp();
    }
}
Also used : CertificateAndEfficiencyStatement(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement)

Example 4 with CertificateAndEfficiencyStatement

use of org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement in project OpenOLAT by OpenOLAT.

the class CertificateAndEfficiencyStatementListController method loadModel.

private void loadModel() {
    Map<Long, CertificateAndEfficiencyStatement> resourceKeyToStatments = new HashMap<>();
    List<CertificateAndEfficiencyStatement> statments = new ArrayList<>();
    List<UserEfficiencyStatementLight> efficiencyStatementsList = esm.findEfficiencyStatementsLight(assessedIdentity);
    for (UserEfficiencyStatementLight efficiencyStatement : efficiencyStatementsList) {
        CertificateAndEfficiencyStatement wrapper = new CertificateAndEfficiencyStatement();
        wrapper.setDisplayName(efficiencyStatement.getShortTitle());
        wrapper.setPassed(efficiencyStatement.getPassed());
        wrapper.setScore(efficiencyStatement.getScore());
        wrapper.setEfficiencyStatementKey(efficiencyStatement.getKey());
        wrapper.setResourceKey(efficiencyStatement.getArchivedResourceKey());
        wrapper.setLastModified(efficiencyStatement.getLastModified());
        statments.add(wrapper);
        resourceKeyToStatments.put(efficiencyStatement.getArchivedResourceKey(), wrapper);
    }
    List<CertificateLight> certificates = certificatesManager.getLastCertificates(assessedIdentity);
    for (CertificateLight certificate : certificates) {
        Long resourceKey = certificate.getOlatResourceKey();
        CertificateAndEfficiencyStatement wrapper = resourceKeyToStatments.get(resourceKey);
        if (wrapper == null) {
            wrapper = new CertificateAndEfficiencyStatement();
            wrapper.setDisplayName(certificate.getCourseTitle());
            resourceKeyToStatments.put(resourceKey, wrapper);
            statments.add(wrapper);
        } else {
            if (!StringHelper.containsNonWhitespace(wrapper.getDisplayName())) {
                wrapper.setDisplayName(certificate.getCourseTitle());
            }
            wrapper.setResourceKey(resourceKey);
        }
        if (resourceKey != null && wrapper.getResourceKey() == null) {
            wrapper.setResourceKey(resourceKey);
        }
        wrapper.setCertificate(certificate);
    }
    for (CertificateAndEfficiencyStatement statment : statments) {
        if (!StringHelper.containsNonWhitespace(statment.getDisplayName()) && statment.getResourceKey() != null) {
            String displayName = repositoryManager.lookupDisplayNameByResourceKey(statment.getResourceKey());
            statment.setDisplayName(displayName);
        }
    }
    tableModel.setObjects(statments);
}
Also used : HashMap(java.util.HashMap) CertificateAndEfficiencyStatement(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement) ArrayList(java.util.ArrayList) UserEfficiencyStatementLight(org.olat.course.assessment.model.UserEfficiencyStatementLight) CertificateLight(org.olat.course.certificate.CertificateLight)

Example 5 with CertificateAndEfficiencyStatement

use of org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement in project openolat by klemens.

the class CertificateAndEfficiencyStatementListController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == confirmDeleteCtr) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            CertificateAndEfficiencyStatement statement = (CertificateAndEfficiencyStatement) confirmDeleteCtr.getUserObject();
            doDelete(statement.getEfficiencyStatementKey());
        }
    } else if (collectorCtrl == source) {
        cmc.deactivate();
        cleanUp();
    } else if (cmc == source) {
        cleanUp();
    }
}
Also used : CertificateAndEfficiencyStatement(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement)

Aggregations

CertificateAndEfficiencyStatement (org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement)10 CertificateLight (org.olat.course.certificate.CertificateLight)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2 EfficiencyStatement (org.olat.course.assessment.EfficiencyStatement)2 UserEfficiencyStatementLight (org.olat.course.assessment.model.UserEfficiencyStatementLight)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2