Search in sources :

Example 1 with DocumentsMapper

use of org.olat.course.nodes.ms.DocumentsMapper in project OpenOLAT by OpenOLAT.

the class CheckListRunController method exposeUserDataToVC.

private void exposeUserDataToVC(UserRequest ureq, FormLayoutContainer layoutCont) {
    AssessmentEntry scoreEval = courseNode.getUserAssessmentEntry(userCourseEnv);
    if (scoreEval == null) {
        layoutCont.contextPut("score", null);
        layoutCont.contextPut("hasPassedValue", Boolean.FALSE);
        layoutCont.contextPut("passed", null);
        layoutCont.contextPut("comment", null);
        layoutCont.contextPut("docs", null);
    } else {
        boolean resultsVisible = scoreEval.getUserVisibility() == null || scoreEval.getUserVisibility().booleanValue();
        layoutCont.contextPut("resultsVisible", resultsVisible);
        layoutCont.contextPut("score", AssessmentHelper.getRoundedScore(scoreEval.getScore()));
        layoutCont.contextPut("hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
        layoutCont.contextPut("passed", scoreEval.getPassed());
        if (resultsVisible) {
            if (courseNode.hasCommentConfigured()) {
                StringBuilder comment = Formatter.stripTabsAndReturns(scoreEval.getComment());
                layoutCont.contextPut("comment", StringHelper.xssScan(comment));
                layoutCont.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
            }
            if (courseNode.hasIndividualAsssessmentDocuments()) {
                List<File> docs = courseNode.getIndividualAssessmentDocuments(userCourseEnv);
                String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
                layoutCont.contextPut("docsMapperUri", mapperUri);
                layoutCont.contextPut("docs", docs);
                layoutCont.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
            }
        } else {
            layoutCont.contextPut("comment", null);
            layoutCont.contextPut("docs", null);
        }
    }
    UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
    layoutCont.contextPut("log", am.getUserNodeLog(courseNode, userCourseEnv.getIdentityEnvironment().getIdentity()));
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) DocumentsMapper(org.olat.course.nodes.ms.DocumentsMapper) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File)

Example 2 with DocumentsMapper

use of org.olat.course.nodes.ms.DocumentsMapper in project OpenOLAT by OpenOLAT.

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);
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentManager(org.olat.course.assessment.AssessmentManager) ScoreAccounting(org.olat.course.run.scoring.ScoreAccounting) DocumentsMapper(org.olat.course.nodes.ms.DocumentsMapper) File(java.io.File)

Example 3 with DocumentsMapper

use of org.olat.course.nodes.ms.DocumentsMapper in project OpenOLAT by OpenOLAT.

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);
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) PersistentAssessableCourseNode(org.olat.course.nodes.PersistentAssessableCourseNode) Identity(org.olat.core.id.Identity) DocumentsMapper(org.olat.course.nodes.ms.DocumentsMapper) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File)

Example 4 with DocumentsMapper

use of org.olat.course.nodes.ms.DocumentsMapper in project OpenOLAT by OpenOLAT.

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);
        }
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) HighScoreRunController(org.olat.course.highscore.ui.HighScoreRunController) DocumentsMapper(org.olat.course.nodes.ms.DocumentsMapper) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Date(java.util.Date) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) SelfAssessableCourseNode(org.olat.course.nodes.SelfAssessableCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) List(java.util.List) Component(org.olat.core.gui.components.Component) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) File(java.io.File) SelfAssessableCourseNode(org.olat.course.nodes.SelfAssessableCourseNode)

Example 5 with DocumentsMapper

use of org.olat.course.nodes.ms.DocumentsMapper in project openolat by klemens.

the class CheckListRunController method exposeUserDataToVC.

private void exposeUserDataToVC(UserRequest ureq, FormLayoutContainer layoutCont) {
    AssessmentEntry scoreEval = courseNode.getUserAssessmentEntry(userCourseEnv);
    if (scoreEval == null) {
        layoutCont.contextPut("score", null);
        layoutCont.contextPut("hasPassedValue", Boolean.FALSE);
        layoutCont.contextPut("passed", null);
        layoutCont.contextPut("comment", null);
        layoutCont.contextPut("docs", null);
    } else {
        boolean resultsVisible = scoreEval.getUserVisibility() == null || scoreEval.getUserVisibility().booleanValue();
        layoutCont.contextPut("resultsVisible", resultsVisible);
        layoutCont.contextPut("score", AssessmentHelper.getRoundedScore(scoreEval.getScore()));
        layoutCont.contextPut("hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
        layoutCont.contextPut("passed", scoreEval.getPassed());
        if (resultsVisible) {
            if (courseNode.hasCommentConfigured()) {
                StringBuilder comment = Formatter.stripTabsAndReturns(scoreEval.getComment());
                layoutCont.contextPut("comment", StringHelper.xssScan(comment));
                layoutCont.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
            }
            if (courseNode.hasIndividualAsssessmentDocuments()) {
                List<File> docs = courseNode.getIndividualAssessmentDocuments(userCourseEnv);
                String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
                layoutCont.contextPut("docsMapperUri", mapperUri);
                layoutCont.contextPut("docs", docs);
                layoutCont.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
            }
        } else {
            layoutCont.contextPut("comment", null);
            layoutCont.contextPut("docs", null);
        }
    }
    UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
    layoutCont.contextPut("log", am.getUserNodeLog(courseNode, userCourseEnv.getIdentityEnvironment().getIdentity()));
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) DocumentsMapper(org.olat.course.nodes.ms.DocumentsMapper) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File)

Aggregations

File (java.io.File)8 DocumentsMapper (org.olat.course.nodes.ms.DocumentsMapper)8 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)6 UserNodeAuditManager (org.olat.course.auditing.UserNodeAuditManager)4 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)4 Date (java.util.Date)2 List (java.util.List)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 Component (org.olat.core.gui.components.Component)2 Identity (org.olat.core.id.Identity)2 AssessmentManager (org.olat.course.assessment.AssessmentManager)2 HighScoreRunController (org.olat.course.highscore.ui.HighScoreRunController)2 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)2 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)2 PersistentAssessableCourseNode (org.olat.course.nodes.PersistentAssessableCourseNode)2 SelfAssessableCourseNode (org.olat.course.nodes.SelfAssessableCourseNode)2 ScoreAccounting (org.olat.course.run.scoring.ScoreAccounting)2 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)2