use of org.olat.core.gui.components.download.DisplayOrDownloadComponent in project openolat by klemens.
the class MSCourseNodeRunController method exposeUserDataToVC.
private void exposeUserDataToVC(UserRequest ureq) {
AssessmentEntry assessmentEntry = courseNode.getUserAssessmentEntry(userCourseEnv);
if (assessmentEntry == null) {
myContent.contextPut("hasPassedValue", Boolean.FALSE);
myContent.contextPut("passed", Boolean.FALSE);
hasPassed = hasScore = hasComment = false;
} else {
String rawComment = assessmentEntry.getComment();
hasPassed = assessmentEntry.getPassed() != null;
hasScore = assessmentEntry.getScore() != null;
hasComment = courseNode.hasCommentConfigured() && StringHelper.containsNonWhitespace(rawComment);
boolean resultsVisible = overrideUserResultsVisiblity || assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
myContent.contextPut("resultsVisible", resultsVisible);
myContent.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
myContent.contextPut("hasPassedValue", (assessmentEntry.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
myContent.contextPut("passed", assessmentEntry.getPassed());
if (resultsVisible) {
if (hasComment) {
StringBuilder comment = Formatter.stripTabsAndReturns(rawComment);
myContent.contextPut("comment", StringHelper.xssScan(comment));
myContent.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
}
if (courseNode.hasIndividualAsssessmentDocuments()) {
List<File> docs = courseNode.getIndividualAssessmentDocuments(userCourseEnv);
mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
myContent.contextPut("docsMapperUri", mapperUri);
myContent.contextPut("docs", docs);
myContent.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
if (download == null) {
download = new DisplayOrDownloadComponent("", null);
myContent.put("download", download);
}
}
}
}
if (showLog) {
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
myContent.contextPut("log", am.getUserNodeLog(courseNode, userCourseEnv.getIdentityEnvironment().getIdentity()));
}
}
Aggregations