Search in sources :

Example 66 with AssessmentItemRef

use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project openolat by klemens.

the class AssessmentTestComposerController method doConfirmDelete.

private void doConfirmDelete(UserRequest ureq) {
    if (confirmDeleteCtrl != null)
        return;
    TreeNode selectedNode = menuTree.getSelectedNode();
    if (selectedNode == null) {
        showWarning("warning.atleastone");
        return;
    }
    Object uobject = selectedNode.getUserObject();
    if (uobject instanceof AssessmentTest) {
        showWarning("error.cannot.delete");
    } else if (uobject instanceof TestPart) {
        TestPart testPart = (TestPart) uobject;
        if (testPart.getParent().getTestParts().size() == 1) {
            showWarning("error.cannot.delete");
        }
        String msg = translate("delete.testPart");
        confirmDeleteCtrl = activateYesNoDialog(ureq, translate("tools.change.delete"), msg, confirmDeleteCtrl);
        confirmDeleteCtrl.setUserObject(selectedNode);
    } else {
        String msg;
        if (uobject instanceof AssessmentSection) {
            AssessmentSection section = (AssessmentSection) uobject;
            if (checkAtLeastOneSection(section)) {
                msg = translate("delete.section", selectedNode.getTitle());
            } else {
                showWarning("warning.atleastonesection");
                return;
            }
        } else if (uobject instanceof AssessmentItemRef) {
            msg = translate("delete.item", selectedNode.getTitle());
        } else {
            showError("error.cannot.delete");
            return;
        }
        confirmDeleteCtrl = activateYesNoDialog(ureq, translate("tools.change.delete"), msg, confirmDeleteCtrl);
        confirmDeleteCtrl.setUserObject(selectedNode);
    }
}
Also used : AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) TreeNode(org.olat.core.gui.components.tree.TreeNode) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)

Example 67 with AssessmentItemRef

use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project openolat by klemens.

the class AssessmentTestEditorAndComposerTreeModel method buildRecursively.

private void buildRecursively(AssessmentSection section, TreeNode parentNode) {
    GenericTreeNode sectionNode = new GenericTreeNode(section.getIdentifier().toString());
    sectionNode.setTitle(section.getTitle());
    sectionNode.setIconCssClass("o_icon o_mi_qtisection");
    sectionNode.setUserObject(section);
    parentNode.addChild(sectionNode);
    for (SectionPart part : section.getSectionParts()) {
        if (part instanceof AssessmentItemRef) {
            buildRecursively((AssessmentItemRef) part, sectionNode);
        } else if (part instanceof AssessmentSection) {
            buildRecursively((AssessmentSection) part, sectionNode);
        }
    }
}
Also used : SectionPart(uk.ac.ed.ph.jqtiplus.node.test.SectionPart) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)

Example 68 with AssessmentItemRef

use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project openolat by klemens.

the class QTI21PrintController method appendNodes.

private void appendNodes(UserRequest ureq, TreeNode node, QTI21StatisticResourceResult resourceResult, List<String> pageNames) {
    if (node.getUserObject() instanceof AssessmentItemRef) {
        Controller itemCtrl = resourceResult.getController(ureq, getWindowControl(), null, node, true);
        if (itemCtrl != null) {
            String itemPageName = "page" + count++;
            mainVC.put(itemPageName, itemCtrl.getInitialComponent());
            pageNames.add(itemPageName);
        }
    }
    for (int i = 0; i < node.getChildCount(); i++) {
        appendNodes(ureq, (TreeNode) node.getChildAt(i), resourceResult, pageNames);
    }
}
Also used : AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController)

Example 69 with AssessmentItemRef

use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project openolat by klemens.

the class QTI21StatisticResourceResult method buildRecursively.

private TreeNode buildRecursively(AssessmentSection section, TreeNode parentNode) {
    GenericTreeNode sectionNode = new GenericTreeNode();
    sectionNode.setTitle(section.getTitle());
    sectionNode.setIconCssClass("o_icon o_mi_qtisection");
    sectionNode.setUserObject(section);
    parentNode.addChild(sectionNode);
    TreeNode firstItem = null;
    for (SectionPart part : section.getSectionParts()) {
        TreeNode itemNode = null;
        if (part instanceof AssessmentItemRef) {
            itemNode = buildRecursively((AssessmentItemRef) part, sectionNode);
        } else if (part instanceof AssessmentSection) {
            itemNode = buildRecursively((AssessmentSection) part, sectionNode);
        }
        if (firstItem == null) {
            firstItem = itemNode;
        }
    }
    sectionNode.setDelegate(firstItem);
    return firstItem;
}
Also used : SectionPart(uk.ac.ed.ph.jqtiplus.node.test.SectionPart) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)

Example 70 with AssessmentItemRef

use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project openolat by klemens.

the class QTI21StatisticResourceResult method getAssessmentItems.

public List<AssessmentItem> getAssessmentItems() {
    List<AssessmentItemRef> itemRefs = resolvedAssessmentTest.getAssessmentItemRefs();
    List<AssessmentItem> items = new ArrayList<>(itemRefs.size());
    for (AssessmentItemRef itemRef : itemRefs) {
        AssessmentItem item = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef).getRootNodeLookup().extractIfSuccessful();
        items.add(item);
    }
    return items;
}
Also used : ArrayList(java.util.ArrayList) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)

Aggregations

AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)70 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)34 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)32 AssessmentSection (uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)28 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)22 TreeNode (org.olat.core.gui.components.tree.TreeNode)20 File (java.io.File)18 URI (java.net.URI)18 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)18 ResolvedAssessmentTest (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest)18 ArrayList (java.util.ArrayList)16 HashMap (java.util.HashMap)16 ManifestMetadataBuilder (org.olat.ims.qti21.model.xml.ManifestMetadataBuilder)12 AssessmentTest (uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest)12 TestPart (uk.ac.ed.ph.jqtiplus.node.test.TestPart)12 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)12 Identity (org.olat.core.id.Identity)10 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)10 SectionPart (uk.ac.ed.ph.jqtiplus.node.test.SectionPart)10 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)10