Search in sources :

Example 1 with DownloadeableMediaResource

use of org.olat.fileresource.DownloadeableMediaResource in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentRunController method doDownloadSignature.

private void doDownloadSignature(UserRequest ureq) {
    MediaResource resource = null;
    if (courseNode instanceof IQTESTCourseNode) {
        IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
        AssessmentEntry assessmentEntry = testCourseNode.getUserAssessmentEntry(userCourseEnv);
        AssessmentTestSession session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
        File signature = qtiService.getAssessmentResultSignature(session);
        if (signature.exists()) {
            resource = new DownloadeableMediaResource(signature);
        }
    }
    if (resource == null) {
        resource = new NotFoundMediaResource();
    }
    ureq.getDispatchResult().setResultingMediaResource(resource);
}
Also used : NotFoundMediaResource(org.olat.core.gui.media.NotFoundMediaResource) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) DownloadeableMediaResource(org.olat.fileresource.DownloadeableMediaResource) MediaResource(org.olat.core.gui.media.MediaResource) DownloadeableMediaResource(org.olat.fileresource.DownloadeableMediaResource) NotFoundMediaResource(org.olat.core.gui.media.NotFoundMediaResource) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File)

Example 2 with DownloadeableMediaResource

use of org.olat.fileresource.DownloadeableMediaResource in project openolat by klemens.

the class QTI21AssessmentRunController method doDownloadSignature.

private void doDownloadSignature(UserRequest ureq) {
    MediaResource resource = null;
    if (courseNode instanceof IQTESTCourseNode) {
        IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
        AssessmentEntry assessmentEntry = testCourseNode.getUserAssessmentEntry(userCourseEnv);
        AssessmentTestSession session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
        File signature = qtiService.getAssessmentResultSignature(session);
        if (signature.exists()) {
            resource = new DownloadeableMediaResource(signature);
        }
    }
    if (resource == null) {
        resource = new NotFoundMediaResource();
    }
    ureq.getDispatchResult().setResultingMediaResource(resource);
}
Also used : NotFoundMediaResource(org.olat.core.gui.media.NotFoundMediaResource) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) DownloadeableMediaResource(org.olat.fileresource.DownloadeableMediaResource) MediaResource(org.olat.core.gui.media.MediaResource) DownloadeableMediaResource(org.olat.fileresource.DownloadeableMediaResource) NotFoundMediaResource(org.olat.core.gui.media.NotFoundMediaResource) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File)

Aggregations

File (java.io.File)2 MediaResource (org.olat.core.gui.media.MediaResource)2 NotFoundMediaResource (org.olat.core.gui.media.NotFoundMediaResource)2 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)2 DownloadeableMediaResource (org.olat.fileresource.DownloadeableMediaResource)2 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)2 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)2