Search in sources :

Example 1 with ResourcesMapper

use of org.olat.ims.qti21.ui.ResourcesMapper in project openolat by klemens.

the class QTI21AssessmentRunController method doShowResults.

private void doShowResults(UserRequest ureq) {
    removeAsListenerAndDispose(resultCtrl);
    AssessmentTestSession session = null;
    if (courseNode instanceof SelfAssessableCourseNode) {
        RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
        session = qtiService.getLastAssessmentTestSessions(courseEntry, courseNode.getIdent(), testEntry, getIdentity());
    } else {
        AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
        AssessmentEntry assessmentEntry = am.getAssessmentEntry(courseNode, getIdentity());
        if (assessmentEntry.getAssessmentId() != null) {
            session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
        } else {
            RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
            session = qtiService.getLastAssessmentTestSessions(courseEntry, courseNode.getIdent(), testEntry, getIdentity());
        }
    }
    if (session == null) {
        mainVC.contextPut("showResults", Boolean.FALSE);
    } else {
        FileResourceManager frm = FileResourceManager.getInstance();
        File fUnzippedDirRoot = frm.unzipFileResource(session.getTestEntry().getOlatResource());
        URI assessmentObjectUri = qtiService.createAssessmentTestUri(fUnzippedDirRoot);
        File submissionDir = qtiService.getAssessmentResultFile(session);
        String mapperUri = registerCacheableMapper(ureq, "QTI21CNResults::" + session.getTestEntry().getKey(), new ResourcesMapper(assessmentObjectUri, submissionDir));
        resultCtrl = new AssessmentResultController(ureq, getWindowControl(), getIdentity(), true, session, fUnzippedDirRoot, mapperUri, null, getDeliveryOptions().getAssessmentResultsOptions(), false, false, true);
        listenTo(resultCtrl);
        mainVC.put("resultReport", resultCtrl.getInitialComponent());
        mainVC.contextPut("showResults", Boolean.TRUE);
    }
    saveOpenPanel(ureq, "results", Boolean.TRUE);
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) FileResourceManager(org.olat.fileresource.FileResourceManager) AssessmentManager(org.olat.course.assessment.AssessmentManager) ResourcesMapper(org.olat.ims.qti21.ui.ResourcesMapper) RepositoryEntry(org.olat.repository.RepositoryEntry) AssessmentResultController(org.olat.ims.qti21.ui.AssessmentResultController) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File) URI(java.net.URI) SelfAssessableCourseNode(org.olat.course.nodes.SelfAssessableCourseNode)

Example 2 with ResourcesMapper

use of org.olat.ims.qti21.ui.ResourcesMapper in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentRunController method doShowResults.

private void doShowResults(UserRequest ureq) {
    removeAsListenerAndDispose(resultCtrl);
    AssessmentTestSession session = null;
    if (courseNode instanceof SelfAssessableCourseNode) {
        RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
        session = qtiService.getLastAssessmentTestSessions(courseEntry, courseNode.getIdent(), testEntry, getIdentity());
    } else {
        AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
        AssessmentEntry assessmentEntry = am.getAssessmentEntry(courseNode, getIdentity());
        if (assessmentEntry.getAssessmentId() != null) {
            session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
        } else {
            RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
            session = qtiService.getLastAssessmentTestSessions(courseEntry, courseNode.getIdent(), testEntry, getIdentity());
        }
    }
    if (session == null) {
        mainVC.contextPut("showResults", Boolean.FALSE);
    } else {
        FileResourceManager frm = FileResourceManager.getInstance();
        File fUnzippedDirRoot = frm.unzipFileResource(session.getTestEntry().getOlatResource());
        URI assessmentObjectUri = qtiService.createAssessmentTestUri(fUnzippedDirRoot);
        File submissionDir = qtiService.getAssessmentResultFile(session);
        String mapperUri = registerCacheableMapper(ureq, "QTI21CNResults::" + session.getTestEntry().getKey(), new ResourcesMapper(assessmentObjectUri, submissionDir));
        resultCtrl = new AssessmentResultController(ureq, getWindowControl(), getIdentity(), true, session, fUnzippedDirRoot, mapperUri, null, getDeliveryOptions().getAssessmentResultsOptions(), false, false, true);
        listenTo(resultCtrl);
        mainVC.put("resultReport", resultCtrl.getInitialComponent());
        mainVC.contextPut("showResults", Boolean.TRUE);
    }
    saveOpenPanel(ureq, "results", Boolean.TRUE);
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) FileResourceManager(org.olat.fileresource.FileResourceManager) AssessmentManager(org.olat.course.assessment.AssessmentManager) ResourcesMapper(org.olat.ims.qti21.ui.ResourcesMapper) RepositoryEntry(org.olat.repository.RepositoryEntry) AssessmentResultController(org.olat.ims.qti21.ui.AssessmentResultController) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File) URI(java.net.URI) SelfAssessableCourseNode(org.olat.course.nodes.SelfAssessableCourseNode)

Aggregations

File (java.io.File)2 URI (java.net.URI)2 AssessmentManager (org.olat.course.assessment.AssessmentManager)2 SelfAssessableCourseNode (org.olat.course.nodes.SelfAssessableCourseNode)2 FileResourceManager (org.olat.fileresource.FileResourceManager)2 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)2 AssessmentResultController (org.olat.ims.qti21.ui.AssessmentResultController)2 ResourcesMapper (org.olat.ims.qti21.ui.ResourcesMapper)2 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2