use of org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement in project openolat by klemens.
the class CertificateAndEfficiencyStatementListController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent te = (SelectionEvent) event;
String cmd = te.getCommand();
CertificateAndEfficiencyStatement statement = tableModel.getObject(te.getIndex());
if (CMD_LAUNCH_COURSE.equals(cmd)) {
doLaunchCourse(ureq, statement.getResourceKey());
} else if (CMD_DELETE.equals(cmd)) {
doConfirmDelete(ureq, statement);
} else if (CMD_SHOW.equals(cmd)) {
doShowStatement(ureq, statement);
} else if (CMD_ARTEFACT.equals(cmd)) {
doCollectArtefact(ureq, statement.getDisplayName(), statement.getEfficiencyStatementKey());
} else if (CMD_MEDIA.equals(cmd)) {
doCollectMedia(ureq, statement.getDisplayName(), statement.getEfficiencyStatementKey());
}
}
} else if (coachingToolButton == source) {
doLaunchCoachingTool(ureq);
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement in project OpenOLAT by OpenOLAT.
the class CertificateAndEfficiencyStatementListController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent te = (SelectionEvent) event;
String cmd = te.getCommand();
CertificateAndEfficiencyStatement statement = tableModel.getObject(te.getIndex());
if (CMD_LAUNCH_COURSE.equals(cmd)) {
doLaunchCourse(ureq, statement.getResourceKey());
} else if (CMD_DELETE.equals(cmd)) {
doConfirmDelete(ureq, statement);
} else if (CMD_SHOW.equals(cmd)) {
doShowStatement(ureq, statement);
} else if (CMD_ARTEFACT.equals(cmd)) {
doCollectArtefact(ureq, statement.getDisplayName(), statement.getEfficiencyStatementKey());
} else if (CMD_MEDIA.equals(cmd)) {
doCollectMedia(ureq, statement.getDisplayName(), statement.getEfficiencyStatementKey());
}
}
} else if (coachingToolButton == source) {
doLaunchCoachingTool(ureq);
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement in project openolat by klemens.
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 klemens.
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 klemens.
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);
}
Aggregations