Search in sources :

Example 6 with KPrimAssessmentItemBuilder

use of org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder in project openolat by klemens.

the class CSVToAssessmentItemConverter method processType.

private void processType(String[] parts) {
    if (currentItem != null) {
        build();
        items.add(currentItem);
        currentItem = null;
    }
    if (parts.length > 1) {
        String type = parts[1].toLowerCase();
        AssessmentItemBuilder itemBuilder;
        switch(type) {
            case "fib":
                {
                    FIBAssessmentItemBuilder fibItemBuilder = new FIBAssessmentItemBuilder("Gap text", EntryType.text, qtiSerializer);
                    itemBuilder = initFIBAssessmentItemBuilder(fibItemBuilder);
                    break;
                }
            case "mc":
                {
                    MultipleChoiceAssessmentItemBuilder mcItemBuilder = new MultipleChoiceAssessmentItemBuilder("Multiple choice", "New answer", qtiSerializer);
                    itemBuilder = initMultipleChoiceAssessmentItemBuilder(mcItemBuilder);
                    break;
                }
            case "sc":
                {
                    SingleChoiceAssessmentItemBuilder scItemBuilder = new SingleChoiceAssessmentItemBuilder("Single choice", "New answer", qtiSerializer);
                    itemBuilder = initSingleChoiceAssessmentItemBuilder(scItemBuilder);
                    break;
                }
            case "kprim":
                {
                    kprimPosition = 0;
                    itemBuilder = new KPrimAssessmentItemBuilder("Kprim", "New answer", qtiSerializer);
                    break;
                }
            case "essay":
                {
                    itemBuilder = new EssayAssessmentItemBuilder("Essay", qtiSerializer);
                    break;
                }
            case "matrix":
                {
                    MatchAssessmentItemBuilder matchBuilder = new MatchAssessmentItemBuilder("Matrix", QTI21Constants.CSS_MATCH_MATRIX, qtiSerializer);
                    itemBuilder = initMatchAssessmentItemBuilder(matchBuilder);
                    break;
                }
            case "drag&drop":
                {
                    MatchAssessmentItemBuilder matchBuilder = new MatchAssessmentItemBuilder("Matrix", QTI21Constants.CSS_MATCH_DRAG_AND_DROP, qtiSerializer);
                    itemBuilder = initMatchAssessmentItemBuilder(matchBuilder);
                    break;
                }
            case "truefalse":
                {
                    Translator trans = Util.createPackageTranslator(AssessmentItemEditorController.class, locale);
                    MatchAssessmentItemBuilder matchBuilder = new MatchAssessmentItemBuilder("Matrix", QTI21Constants.CSS_MATCH_TRUE_FALSE, trans.translate("match.unanswered"), trans.translate("match.true"), trans.translate("match.false"), qtiSerializer);
                    itemBuilder = initMatchAssessmentItemBuilderForTrueFalse(matchBuilder);
                    break;
                }
            default:
                {
                    itemBuilder = null;
                }
        }
        if (itemBuilder != null) {
            currentItem = new AssessmentItemAndMetadata(itemBuilder);
        } else {
            log.warn("Question type not supported: " + type);
            currentItem = null;
        }
    }
}
Also used : FIBAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder) KPrimAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder) SingleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SingleChoiceAssessmentItemBuilder) Translator(org.olat.core.gui.translator.Translator) AssessmentItemEditorController(org.olat.ims.qti21.ui.editor.AssessmentItemEditorController) EssayAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.EssayAssessmentItemBuilder) SimpleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder) EssayAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.EssayAssessmentItemBuilder) FIBAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder) MatchAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MatchAssessmentItemBuilder) SingleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SingleChoiceAssessmentItemBuilder) AssessmentItemBuilder(org.olat.ims.qti21.model.xml.AssessmentItemBuilder) KPrimAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder) MultipleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MultipleChoiceAssessmentItemBuilder) MultipleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MultipleChoiceAssessmentItemBuilder) MatchAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MatchAssessmentItemBuilder)

Example 7 with KPrimAssessmentItemBuilder

use of org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder in project openolat by klemens.

the class AssessmentItemBuilderTest method buildAssessmentItem_kprim.

@Test
public void buildAssessmentItem_kprim() throws IOException, URISyntaxException {
    QtiSerializer qtiSerializer = new QtiSerializer(new JqtiExtensionManager());
    KPrimAssessmentItemBuilder itemBuilder = new KPrimAssessmentItemBuilder("Kprim", "New answer", qtiSerializer);
    if (build.booleanValue()) {
        itemBuilder.build();
    }
    AssessmentItem singleChoiceItem = itemBuilder.getAssessmentItem();
    ItemValidationResult itemResult = serializeAndReload(singleChoiceItem);
    AssessmentItem reloadedItem = itemResult.getResolvedAssessmentItem().getItemLookup().extractIfSuccessful();
    List<Interaction> interactions = reloadedItem.getItemBody().findInteractions();
    Assert.assertNotNull(interactions);
    Assert.assertEquals(1, interactions.size());
    Assert.assertTrue(interactions.get(0) instanceof MatchInteraction);
    MatchInteraction interaction = (MatchInteraction) interactions.get(0);
    Assert.assertNotNull(interaction.getResponseIdentifier());
    ResponseDeclaration responseDeclaration = reloadedItem.getResponseDeclaration(interaction.getResponseIdentifier());
    Assert.assertNotNull(responseDeclaration);
    Assert.assertEquals(2, interaction.getSimpleMatchSets().size());
    SimpleMatchSet matchSet = interaction.getSimpleMatchSets().get(0);
    Assert.assertEquals(4, matchSet.getSimpleAssociableChoices().size());
    SimpleMatchSet correctWrongSet = interaction.getSimpleMatchSets().get(1);
    Assert.assertEquals(2, correctWrongSet.getSimpleAssociableChoices().size());
}
Also used : MatchInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.MatchInteraction) SimpleMatchSet(uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleMatchSet) KPrimAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder) JqtiExtensionManager(uk.ac.ed.ph.jqtiplus.JqtiExtensionManager) QtiSerializer(uk.ac.ed.ph.jqtiplus.serialization.QtiSerializer) TextEntryInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.TextEntryInteraction) ExtendedTextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction) HotspotInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.HotspotInteraction) Interaction(uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction) ChoiceInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction) MatchInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.MatchInteraction) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) ResponseDeclaration(uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration) ItemValidationResult(uk.ac.ed.ph.jqtiplus.validation.ItemValidationResult) Test(org.junit.Test)

Example 8 with KPrimAssessmentItemBuilder

use of org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder in project openolat by klemens.

the class AssessmentItemEditorController method initKPrimChoiceEditors.

private AssessmentItemBuilder initKPrimChoiceEditors(UserRequest ureq, AssessmentItem item) {
    KPrimAssessmentItemBuilder kprimItemBuilder = new KPrimAssessmentItemBuilder(item, qtiService.qtiSerializer());
    itemEditor = new KPrimEditorController(ureq, getWindowControl(), kprimItemBuilder, rootDirectory, rootContainer, itemFile, restrictedEdit, readOnly);
    listenTo(itemEditor);
    scoreEditor = new MinimalScoreController(ureq, getWindowControl(), kprimItemBuilder, itemRef, restrictedEdit, readOnly, "Test editor QTI 2.1 in detail#details_testeditor_score");
    listenTo(scoreEditor);
    feedbackEditor = new FeedbacksEditorController(ureq, getWindowControl(), kprimItemBuilder, rootDirectory, rootContainer, itemFile, FeedbacksEnabler.standardFeedbacks(), restrictedEdit, readOnly);
    listenTo(feedbackEditor);
    tabbedPane.addTab(translate("form.kprim"), itemEditor);
    tabbedPane.addTab(translate("form.score"), scoreEditor);
    tabbedPane.addTab(translate("form.feedback"), feedbackEditor);
    return kprimItemBuilder;
}
Also used : KPrimAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder) KPrimEditorController(org.olat.ims.qti21.ui.editor.interactions.KPrimEditorController)

Example 9 with KPrimAssessmentItemBuilder

use of org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder in project OpenOLAT by OpenOLAT.

the class AssessmentTestComposerController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (menuTree == source) {
        if (event instanceof TreeEvent) {
            TreeEvent te = (TreeEvent) event;
            String cmd = te.getCommand();
            if (MenuTree.COMMAND_TREENODE_CLICKED.equals(cmd)) {
                TreeNode selectedNode = menuTree.getTreeModel().getNodeById(te.getNodeId());
                partEditorFactory(ureq, selectedNode);
            }
        } else if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_DROP)) {
            TreeDropEvent tde = (TreeDropEvent) event;
            doDrop(ureq, tde.getDroppedNodeId(), tde.getTargetNodeId(), tde.isAsChild());
        }
    } else if (newSectionLink == source) {
        doNewSection(ureq, menuTree.getSelectedNode());
    } else if (newTestPartLink == source) {
        doNewTestPart(ureq);
    } else if (newSingleChoiceLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new SingleChoiceAssessmentItemBuilder(translate("new.sc"), translate("new.answer"), qtiService.qtiSerializer()));
    } else if (newMultipleChoiceLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new MultipleChoiceAssessmentItemBuilder(translate("new.mc"), translate("new.answer"), qtiService.qtiSerializer()));
    } else if (newKPrimLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new KPrimAssessmentItemBuilder(translate("new.kprim"), translate("new.answer"), qtiService.qtiSerializer()));
    } else if (newMatchLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new MatchAssessmentItemBuilder(translate("new.match"), QTI21Constants.CSS_MATCH_MATRIX, qtiService.qtiSerializer()));
    } else if (newMatchDragAndDropLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new MatchAssessmentItemBuilder(translate("new.matchdraganddrop"), QTI21Constants.CSS_MATCH_DRAG_AND_DROP, qtiService.qtiSerializer()));
    } else if (newMatchTrueFalseLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new MatchAssessmentItemBuilder(translate("new.matchtruefalse"), QTI21Constants.CSS_MATCH_TRUE_FALSE, translate("match.unanswered"), translate("match.true"), translate("match.false"), qtiService.qtiSerializer()));
    } else if (newFIBLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new FIBAssessmentItemBuilder(translate("new.fib"), EntryType.text, qtiService.qtiSerializer()));
    } else if (newNumericalLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new FIBAssessmentItemBuilder(translate("new.fib.numerical"), EntryType.numerical, qtiService.qtiSerializer()));
    } else if (newHotspotLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new HotspotAssessmentItemBuilder(translate("new.hotspot"), qtiService.qtiSerializer()));
    } else if (newHottextLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new HottextAssessmentItemBuilder(translate("new.hottext"), translate("new.hottext.start"), translate("new.hottext.text"), qtiService.qtiSerializer()));
    } else if (newEssayLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new EssayAssessmentItemBuilder(translate("new.essay"), qtiService.qtiSerializer()));
    } else if (newUploadLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new UploadAssessmentItemBuilder(translate("new.upload"), qtiService.qtiSerializer()));
    } else if (newDrawingLink == source) {
        doNewAssessmentItem(ureq, menuTree.getSelectedNode(), new DrawingAssessmentItemBuilder(translate("new.drawing"), qtiService.qtiSerializer()));
    } else if (importFromPoolLink == source) {
        doSelectQItem(ureq);
    } else if (importFromTableLink == source) {
        doImportTable(ureq);
    } else if (exportToPoolLink == source) {
        doExportPool();
    } else if (exportToDocxLink == source) {
        doExportDocx(ureq);
    } else if (deleteLink == source) {
        doConfirmDelete(ureq);
    } else if (copyLink == source) {
        doCopy(ureq);
    } else if (reloadInCacheLink == source) {
        doForceReloadFiles(ureq);
    }
}
Also used : HottextAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.HottextAssessmentItemBuilder) SingleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SingleChoiceAssessmentItemBuilder) EssayAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.EssayAssessmentItemBuilder) MultipleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MultipleChoiceAssessmentItemBuilder) MatchAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MatchAssessmentItemBuilder) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) FIBAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder) KPrimAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder) TreeNode(org.olat.core.gui.components.tree.TreeNode) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) HotspotAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.HotspotAssessmentItemBuilder) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent) UploadAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.UploadAssessmentItemBuilder) DrawingAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.DrawingAssessmentItemBuilder)

Example 10 with KPrimAssessmentItemBuilder

use of org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder in project OpenOLAT by OpenOLAT.

the class AssessmentItemEditorController method initKPrimChoiceEditors.

private AssessmentItemBuilder initKPrimChoiceEditors(UserRequest ureq, AssessmentItem item) {
    KPrimAssessmentItemBuilder kprimItemBuilder = new KPrimAssessmentItemBuilder(item, qtiService.qtiSerializer());
    itemEditor = new KPrimEditorController(ureq, getWindowControl(), kprimItemBuilder, rootDirectory, rootContainer, itemFile, restrictedEdit, readOnly);
    listenTo(itemEditor);
    scoreEditor = new MinimalScoreController(ureq, getWindowControl(), kprimItemBuilder, itemRef, restrictedEdit, readOnly, "Test editor QTI 2.1 in detail#details_testeditor_score");
    listenTo(scoreEditor);
    feedbackEditor = new FeedbacksEditorController(ureq, getWindowControl(), kprimItemBuilder, rootDirectory, rootContainer, itemFile, FeedbacksEnabler.standardFeedbacks(), restrictedEdit, readOnly);
    listenTo(feedbackEditor);
    tabbedPane.addTab(translate("form.kprim"), itemEditor);
    tabbedPane.addTab(translate("form.score"), scoreEditor);
    tabbedPane.addTab(translate("form.feedback"), feedbackEditor);
    return kprimItemBuilder;
}
Also used : KPrimAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder) KPrimEditorController(org.olat.ims.qti21.ui.editor.interactions.KPrimEditorController)

Aggregations

KPrimAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder)14 EssayAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.EssayAssessmentItemBuilder)8 FIBAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder)8 MatchAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.MatchAssessmentItemBuilder)8 MultipleChoiceAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.MultipleChoiceAssessmentItemBuilder)8 SingleChoiceAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.SingleChoiceAssessmentItemBuilder)8 AssessmentItemBuilder (org.olat.ims.qti21.model.xml.AssessmentItemBuilder)6 Translator (org.olat.core.gui.translator.Translator)4 DrawingAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.DrawingAssessmentItemBuilder)4 HotspotAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.HotspotAssessmentItemBuilder)4 HottextAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.HottextAssessmentItemBuilder)4 SimpleChoiceAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder)4 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)4 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)4 UploadAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.UploadAssessmentItemBuilder)3 File (java.io.File)2 Test (org.junit.Test)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 TreeDropEvent (org.olat.core.gui.components.tree.TreeDropEvent)2 TreeEvent (org.olat.core.gui.components.tree.TreeEvent)2