use of org.olat.course.nodes.ms.DocumentsMapper in project openolat by klemens.
the class IQRunController method exposeUserTestDataToVC.
private void exposeUserTestDataToVC(UserRequest ureq) {
// config : show score info
Object enableScoreInfoObject = modConfig.get(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
if (enableScoreInfoObject != null) {
myContent.contextPut("enableScoreInfo", enableScoreInfoObject);
} else {
myContent.contextPut("enableScoreInfo", Boolean.TRUE);
}
// configuration data
myContent.contextPut("attemptsConfig", modConfig.get(IQEditController.CONFIG_KEY_ATTEMPTS));
// user data
Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
if (courseNode instanceof PersistentAssessableCourseNode) {
PersistentAssessableCourseNode acn = (PersistentAssessableCourseNode) courseNode;
AssessmentEntry assessmentEntry = acn.getUserAssessmentEntry(userCourseEnv);
if (assessmentEntry == null) {
myContent.contextPut("blockAfterSuccess", Boolean.FALSE);
myContent.contextPut("score", null);
myContent.contextPut("hasPassedValue", Boolean.FALSE);
myContent.contextPut("passed", Boolean.FALSE);
myContent.contextPut("comment", null);
myContent.contextPut("docs", null);
myContent.contextPut("attempts", 0);
} else {
// block if test passed (and config set to check it)
Boolean blockAfterSuccess = modConfig.getBooleanEntry(IQEditController.CONFIG_KEY_BLOCK_AFTER_SUCCESS);
Boolean blocked = Boolean.FALSE;
if (blockAfterSuccess != null && blockAfterSuccess.booleanValue()) {
Boolean passed = assessmentEntry.getPassed();
if (passed != null && passed.booleanValue()) {
blocked = Boolean.TRUE;
}
}
myContent.contextPut("blockAfterSuccess", blocked);
boolean resultsVisible = 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 (acn.hasCommentConfigured()) {
StringBuilder comment = Formatter.stripTabsAndReturns(assessmentEntry.getComment());
myContent.contextPut("comment", StringHelper.xssScan(comment));
myContent.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
}
if (acn.hasIndividualAsssessmentDocuments()) {
List<File> docs = acn.getIndividualAssessmentDocuments(userCourseEnv);
String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
myContent.contextPut("docsMapperUri", mapperUri);
myContent.contextPut("docs", docs);
myContent.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
}
}
myContent.contextPut("attempts", assessmentEntry.getAttempts() == null ? 0 : assessmentEntry.getAttempts());
}
}
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
myContent.contextPut("log", am.getUserNodeLog(courseNode, identity));
exposeResults(ureq);
}
use of org.olat.course.nodes.ms.DocumentsMapper in project openolat by klemens.
the class QTI21AssessmentRunController method initAssessment.
private void initAssessment(UserRequest ureq) {
// config : show score info
boolean enableScoreInfo = config.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
mainVC.contextPut("enableScoreInfo", Boolean.valueOf(enableScoreInfo));
// configuration data
int maxAttempts = deliveryOptions.getMaxAttempts();
if (maxAttempts > 0) {
mainVC.contextPut("attemptsConfig", Integer.valueOf(maxAttempts));
} else {
mainVC.contextPut("attemptsConfig", Boolean.FALSE);
}
// configure date period
mainVC.contextPut("blockDate", Boolean.valueOf(blockedBasedOnDate()));
// time limit
Long timeLimit = getAssessmentTestMaxTimeLimit();
if (timeLimit != null) {
mainVC.contextPut("timeLimit", Formatter.formatHourAndSeconds(timeLimit.longValue() * 1000l));
}
if (courseNode instanceof AssessableCourseNode) {
AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
if (assessableCourseNode.hasScoreConfigured() || userCourseEnv.isCoach()) {
HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), userCourseEnv, courseNode);
if (highScoreCtr.isViewHighscore()) {
Component highScoreComponent = highScoreCtr.getInitialComponent();
mainVC.put("highScore", highScoreComponent);
}
}
}
// user data
if (courseNode instanceof SelfAssessableCourseNode) {
SelfAssessableCourseNode acn = (SelfAssessableCourseNode) courseNode;
ScoreEvaluation scoreEval = acn.getUserScoreEvaluation(userCourseEnv);
Integer attempts = acn.getUserAttempts(userCourseEnv);
if (scoreEval != null) {
mainVC.contextPut("resultsVisible", Boolean.TRUE);
mainVC.contextPut("hasResults", Boolean.TRUE);
mainVC.contextPut("score", AssessmentHelper.getRoundedScore(scoreEval.getScore()));
mainVC.contextPut("hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
mainVC.contextPut("passed", scoreEval.getPassed());
// at least one attempt
mainVC.contextPut("attempts", attempts);
mainVC.contextPut("showChangeLog", Boolean.TRUE && enableScoreInfo);
exposeResults(ureq, true);
} else {
exposeResults(ureq, false);
}
} else if (courseNode instanceof IQTESTCourseNode) {
IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
AssessmentEntry assessmentEntry = testCourseNode.getUserAssessmentEntry(userCourseEnv);
if (assessmentEntry == null) {
mainVC.contextPut("blockAfterSuccess", Boolean.FALSE);
mainVC.contextPut("score", null);
mainVC.contextPut("hasPassedValue", Boolean.FALSE);
mainVC.contextPut("passed", Boolean.FALSE);
mainVC.contextPut("comment", null);
mainVC.contextPut("attempts", 0);
mainVC.contextPut("showChangeLog", Boolean.FALSE);
} else {
Boolean passed = assessmentEntry.getPassed();
// block if test passed (and config set to check it)
Boolean blocked = Boolean.FALSE;
boolean blockAfterSuccess = deliveryOptions.isBlockAfterSuccess();
if (blockAfterSuccess && passed != null && passed.booleanValue()) {
blocked = Boolean.TRUE;
}
mainVC.contextPut("blockAfterSuccess", blocked);
boolean resultsVisible = assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
mainVC.contextPut("resultsVisible", resultsVisible);
mainVC.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
mainVC.contextPut("hasPassedValue", (passed == null ? Boolean.FALSE : Boolean.TRUE));
mainVC.contextPut("passed", passed);
if (resultsVisible) {
if (testCourseNode.hasCommentConfigured()) {
StringBuilder comment = Formatter.stripTabsAndReturns(testCourseNode.getUserUserComment(userCourseEnv));
if (comment != null && comment.length() > 0) {
mainVC.contextPut("comment", StringHelper.xssScan(comment));
mainVC.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
}
}
if (testCourseNode.hasIndividualAsssessmentDocuments()) {
List<File> docs = testCourseNode.getIndividualAssessmentDocuments(userCourseEnv);
String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
mainVC.contextPut("docsMapperUri", mapperUri);
mainVC.contextPut("docs", docs);
mainVC.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
}
}
Integer attempts = assessmentEntry.getAttempts();
mainVC.contextPut("attempts", attempts == null ? new Integer(0) : attempts);
boolean showChangelog = (!anonym && enableScoreInfo && resultsVisible && isResultVisible(config));
mainVC.contextPut("showChangeLog", showChangelog);
if (deliveryOptions.isDigitalSignature()) {
AssessmentTestSession session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
if (session != null) {
File signature = qtiService.getAssessmentResultSignature(session);
if (signature != null && signature.exists()) {
signatureDownloadLink = LinkFactory.createLink("digital.signature.download.link", mainVC, this);
signatureDownloadLink.setIconLeftCSS("o_icon o_icon-fw o_icon_download");
signatureDownloadLink.setTarget("_blank");
Date issueDate = qtiService.getAssessmentResultSignatureIssueDate(session);
if (issueDate != null) {
mainVC.contextPut("signatureIssueDate", Formatter.getInstance(getLocale()).formatDateAndTime(issueDate));
}
}
}
}
exposeResults(ureq, resultsVisible);
}
}
}
use of org.olat.course.nodes.ms.DocumentsMapper in project openolat by klemens.
the class PortfolioCourseNodeRunController method updateAssessmentInfos.
private void updateAssessmentInfos(UserRequest ureq, Date returnDate) {
if (returnDate != null || copyBinder != null) {
String rDate = formatter.formatDateAndTime(returnDate);
uifactory.addStaticTextElement("map.returnDate", rDate, infosContainer);
// Fetch all score and passed and calculate score accounting for the entire course
ScoreAccounting scoreAccounting = userCourseEnv.getScoreAccounting();
scoreAccounting.evaluateAll();
ScoreEvaluation scoreEval = scoreAccounting.evalCourseNode(courseNode);
boolean resultsVisible = scoreEval.getUserVisible() == null || scoreEval.getUserVisible().booleanValue();
assessmentInfosContainer.contextPut("resultsVisible", resultsVisible);
// score
assessmentInfosContainer.contextPut("hasScoreField", new Boolean(courseNode.hasScoreConfigured()));
if (courseNode.hasScoreConfigured()) {
Float score = scoreEval.getScore();
Float minScore = courseNode.getMinScoreConfiguration();
Float maxScore = courseNode.getMaxScoreConfiguration();
assessmentInfosContainer.contextPut("scoreMin", AssessmentHelper.getRoundedScore(minScore));
assessmentInfosContainer.contextPut("scoreMax", AssessmentHelper.getRoundedScore(maxScore));
assessmentInfosContainer.contextPut("score", AssessmentHelper.getRoundedScore(score));
}
// passed
assessmentInfosContainer.contextPut("hasPassedField", new Boolean(courseNode.hasPassedConfigured()));
if (courseNode.hasPassedConfigured()) {
Boolean passed = scoreEval.getPassed();
assessmentInfosContainer.contextPut("passed", passed);
assessmentInfosContainer.contextPut("hasPassedValue", new Boolean(passed != null));
Float cutValue = courseNode.getCutValueConfiguration();
assessmentInfosContainer.contextPut("passedCutValue", AssessmentHelper.getRoundedScore(cutValue));
}
// get comment
if (resultsVisible) {
if (courseNode.hasCommentConfigured()) {
AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
String comment = am.getNodeComment(courseNode, getIdentity());
assessmentInfosContainer.contextPut("comment", comment);
assessmentInfosContainer.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
}
if (courseNode.hasIndividualAsssessmentDocuments()) {
List<File> docs = courseNode.getIndividualAssessmentDocuments(userCourseEnv);
String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
assessmentInfosContainer.contextPut("docsMapperUri", mapperUri);
assessmentInfosContainer.contextPut("docs", docs);
assessmentInfosContainer.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
}
}
assessmentInfosContainer.setVisible(true);
} else {
assessmentInfosContainer.setVisible(false);
}
}
Aggregations