Search in sources :

Example 16 with QTI21DeliveryOptions

use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.

the class IQConfigurationController method doPreview.

private void doPreview(UserRequest ureq) {
    removeAsListenerAndDispose(previewLayoutCtr);
    RepositoryEntry re = getIQReference();
    if (re != null) {
        Controller previewController;
        if (OnyxModule.isOnyxTest(re.getOlatResource())) {
            showError("error.onyx");
        } else if (ImsQTI21Resource.TYPE_NAME.equals(re.getOlatResource().getResourceableTypeName())) {
            // clean up last session
            cleanUpQti21PreviewSession();
            // need to clean up the assessment test session
            QTI21DeliveryOptions deliveryOptions = qti21service.getDeliveryOptions(re);
            QTI21OverrideOptions overrideOptions = QTI21OverrideOptions.nothingOverriden();
            RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
            previewQTI21Ctrl = new AssessmentTestDisplayController(ureq, getWindowControl(), new InMemoryOutcomeListener(), re, courseEntry, courseNode.getIdent(), deliveryOptions, overrideOptions, true, true, true);
            listenTo(previewQTI21Ctrl);
            stackPanel.pushController(translate("preview"), previewQTI21Ctrl);
        } else {
            long courseResId = course.getResourceableId().longValue();
            previewController = iqManager.createIQDisplayController(moduleConfiguration, new IQPreviewSecurityCallback(), ureq, getWindowControl(), courseResId, courseNode.getIdent(), null);
            previewLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), previewController);
            stackPanel.pushController(translate("preview"), previewLayoutCtr);
        }
    }
}
Also used : QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions) InMemoryOutcomeListener(org.olat.ims.qti21.model.InMemoryOutcomeListener) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) QTI21OverrideOptions(org.olat.ims.qti21.ui.QTI21OverrideOptions) AssessmentTestDisplayController(org.olat.ims.qti21.ui.AssessmentTestDisplayController) RepositoryEntry(org.olat.repository.RepositoryEntry) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController) NodeEditController(org.olat.course.editor.NodeEditController) BasicController(org.olat.core.gui.control.controller.BasicController) Controller(org.olat.core.gui.control.Controller) AssessmentTestDisplayController(org.olat.ims.qti21.ui.AssessmentTestDisplayController) IQPreviewSecurityCallback(org.olat.modules.iq.IQPreviewSecurityCallback)

Example 17 with QTI21DeliveryOptions

use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.

the class QTI21RetrieveTestsController method getSignatureOptions.

private DigitalSignatureOptions getSignatureOptions(AssessmentTestSession session) {
    if (courseNode == null)
        return null;
    RepositoryEntry testEntry = session.getTestEntry();
    RepositoryEntry courseEntry = session.getRepositoryEntry();
    QTI21DeliveryOptions deliveryOptions = qtiService.getDeliveryOptions(testEntry);
    boolean digitalSignature = deliveryOptions.isDigitalSignature();
    boolean sendMail = deliveryOptions.isDigitalSignatureMail();
    ModuleConfiguration config = courseNode.getModuleConfiguration();
    digitalSignature = config.getBooleanSafe(IQEditController.CONFIG_DIGITAL_SIGNATURE, deliveryOptions.isDigitalSignature());
    sendMail = config.getBooleanSafe(IQEditController.CONFIG_DIGITAL_SIGNATURE_SEND_MAIL, deliveryOptions.isDigitalSignatureMail());
    DigitalSignatureOptions options = new DigitalSignatureOptions(digitalSignature, sendMail, courseEntry, testEntry);
    if (digitalSignature) {
        CourseEnvironment courseEnv = CourseFactory.loadCourse(courseEntry).getCourseEnvironment();
        QTI21AssessmentRunController.decorateCourseConfirmation(session, options, courseEnv, courseNode, testEntry, null, getLocale());
    }
    return options;
}
Also used : QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions) ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) DigitalSignatureOptions(org.olat.ims.qti21.model.DigitalSignatureOptions) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 18 with QTI21DeliveryOptions

use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.

the class IQSURVCourseNode method createStatisticNodeResult.

@Override
public StatisticResourceResult createStatisticNodeResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, StatisticResourceOption options, QTIType... types) {
    if (!isQTITypeAllowed(types))
        return null;
    Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
    OLATResourceable courseOres = OresHelper.createOLATResourceableInstance("CourseModule", courseId);
    RepositoryEntry qtiSurveyEntry = getReferencedRepositoryEntry();
    if (ImsQTI21Resource.TYPE_NAME.equals(qtiSurveyEntry.getOlatResource().getResourceableTypeName())) {
        RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
        QTI21StatisticSearchParams searchParams = new QTI21StatisticSearchParams(qtiSurveyEntry, courseEntry, getIdent());
        searchParams.setLimitToGroups(options.getParticipantsGroups());
        QTI21DeliveryOptions deliveryOptions = CoreSpringFactory.getImpl(QTI21Service.class).getDeliveryOptions(qtiSurveyEntry);
        boolean admin = userCourseEnv.isAdmin();
        QTI21StatisticsSecurityCallback secCallback = new QTI21StatisticsSecurityCallback(admin, admin && deliveryOptions.isAllowAnonym());
        return new QTI21StatisticResourceResult(qtiSurveyEntry, courseEntry, this, searchParams, secCallback);
    }
    QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(courseOres.getResourceableId(), getIdent());
    searchParams.setLimitToGroups(options.getParticipantsGroups());
    return new QTIStatisticResourceResult(courseOres, this, qtiSurveyEntry, searchParams);
}
Also used : QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions) QTIStatisticSearchParams(org.olat.ims.qti.statistics.QTIStatisticSearchParams) QTI21Service(org.olat.ims.qti21.QTI21Service) OLATResourceable(org.olat.core.id.OLATResourceable) QTI21StatisticSearchParams(org.olat.ims.qti21.model.QTI21StatisticSearchParams) QTI21StatisticResourceResult(org.olat.ims.qti21.ui.statistics.QTI21StatisticResourceResult) QTIStatisticResourceResult(org.olat.ims.qti.statistics.QTIStatisticResourceResult) QTI21StatisticsSecurityCallback(org.olat.ims.qti21.ui.statistics.QTI21StatisticsSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 19 with QTI21DeliveryOptions

use of org.olat.ims.qti21.QTI21DeliveryOptions in project OpenOLAT by OpenOLAT.

the class QTI12To21Converter method convert.

public AssessmentTest convert(VFSContainer originalContainer, QTIDocument doc, QTI21DeliveryOptions qti21Options) throws URISyntaxException {
    Assessment assessment = doc.getAssessment();
    AssessmentTest assessmentTest = new AssessmentTest();
    String assessmentTestIdentifier = IdentifierGenerator.newAssessmentTestFilename();
    File testFile = new File(unzippedDirRoot, assessmentTestIdentifier + ".xml");
    manifest.appendAssessmentTest(testFile.getName());
    assessmentTest.setIdentifier(assessmentTestIdentifier);
    assessmentTest.setTitle(assessment.getTitle());
    assessmentTest.setToolName(QTI21Constants.TOOLNAME);
    assessmentTest.setToolVersion(Settings.getVersion());
    convertDuration((Duration) assessment.getDuration(), assessmentTest);
    TestPart testPart = AssessmentTestFactory.createTestPart(assessmentTest);
    ItemSessionControl itemSessionControl = testPart.getItemSessionControl();
    Control tmpControl = QTIEditHelper.getControl(assessment);
    if (tmpControl.getSolution() == Control.CTRL_YES) {
        itemSessionControl.setShowSolution(Boolean.TRUE);
    }
    if (qti21Options != null) {
        qti21Options.setHideFeedbacks(false);
        if (assessment.isInheritControls() && tmpControl.getFeedback() != Control.CTRL_YES) {
            qti21Options.setHideFeedbacks(true);
        }
    }
    AssessmentTestBuilder assessmentTestBuilder = new AssessmentTestBuilder(assessmentTest);
    // root
    List<Section> sections = assessment.getSections();
    for (Section section : sections) {
        convert(section, testPart);
    }
    // this are lost in QTI 2.1
    // assessment.getSelection_ordering().getOrderType();
    // assessment.getSelection_ordering().getSelectionNumber();
    OutcomesProcessing outcomesProcessing = assessment.getOutcomes_processing();
    if (outcomesProcessing != null) {
        String cutValue = outcomesProcessing.getField(OutcomesProcessing.CUTVALUE);
        if (StringHelper.containsNonWhitespace(cutValue)) {
            try {
                assessmentTestBuilder.setCutValue(Double.valueOf(cutValue));
            } catch (NumberFormatException e) {
                log.error("Cannot parse cut value: " + cutValue, e);
            }
        }
    }
    assessmentTestBuilder.setMaxScore(atomicMaxScore.doubleValue());
    assessmentTest = assessmentTestBuilder.build();
    persistAssessmentObject(testFile, assessmentTest);
    manifest.write(new File(unzippedDirRoot, "imsmanifest.xml"));
    copyMaterial(originalContainer);
    return assessmentTest;
}
Also used : AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) ItemSessionControl(uk.ac.ed.ph.jqtiplus.node.test.ItemSessionControl) AssessmentTestBuilder(org.olat.ims.qti21.model.xml.AssessmentTestBuilder) ItemSessionControl(uk.ac.ed.ph.jqtiplus.node.test.ItemSessionControl) Control(org.olat.ims.qti.editor.beecom.objects.Control) Assessment(org.olat.ims.qti.editor.beecom.objects.Assessment) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart) OutcomesProcessing(org.olat.ims.qti.editor.beecom.objects.OutcomesProcessing) File(java.io.File) Section(org.olat.ims.qti.editor.beecom.objects.Section) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)

Example 20 with QTI21DeliveryOptions

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

the class IQIdentityListCourseNodeController method isSuspendEnable.

private boolean isSuspendEnable() {
    ModuleConfiguration config = courseNode.getModuleConfiguration();
    QTI21DeliveryOptions testOptions = qtiService.getDeliveryOptions(getReferencedRepositoryEntry());
    boolean configRef = config.getBooleanSafe(IQEditController.CONFIG_KEY_CONFIG_REF, false);
    boolean suspendEnabled = false;
    if (!configRef) {
        suspendEnabled = config.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESUSPEND, testOptions.isEnableSuspend());
    } else {
        suspendEnabled = testOptions.isEnableSuspend();
    }
    return suspendEnabled;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions)

Aggregations

QTI21DeliveryOptions (org.olat.ims.qti21.QTI21DeliveryOptions)22 RepositoryEntry (org.olat.repository.RepositoryEntry)14 File (java.io.File)6 ModuleConfiguration (org.olat.modules.ModuleConfiguration)6 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)4 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)4 QTI21Service (org.olat.ims.qti21.QTI21Service)4 DigitalSignatureOptions (org.olat.ims.qti21.model.DigitalSignatureOptions)4 OLATResource (org.olat.resource.OLATResource)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)2 Controller (org.olat.core.gui.control.Controller)2 BasicController (org.olat.core.gui.control.controller.BasicController)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 NodeEditController (org.olat.course.editor.NodeEditController)2 FileResourceManager (org.olat.fileresource.FileResourceManager)2 ImsQTI21Resource (org.olat.fileresource.types.ImsQTI21Resource)2 QTIEditorPackage (org.olat.ims.qti.editor.QTIEditorPackage)2 Assessment (org.olat.ims.qti.editor.beecom.objects.Assessment)2