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);
}
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;
}
}
}
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();
}
}
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);
}
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();
}
}
Aggregations