Search in sources :

Example 6 with SectionPart

use of uk.ac.ed.ph.jqtiplus.node.test.SectionPart in project OpenOLAT by OpenOLAT.

the class QTI21ArchiveFormat method collectElementInfos.

private void collectElementInfos(AssessmentSection section) {
    numOfSections++;
    SectionInfos sectionInfos = new SectionInfos(section);
    elementInfos.add(sectionInfos);
    List<SectionPart> parts = section.getChildAbstractParts();
    for (SectionPart part : parts) {
        if (part instanceof AssessmentItemRef) {
            AssessmentItemRef itemRef = (AssessmentItemRef) part;
            ResolvedAssessmentItem resolvedItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
            AssessmentItem item = resolvedItem.getRootNodeLookup().extractIfSuccessful();
            if (item != null) {
                ItemInfos itemInfo = new ItemInfos(itemRef, item, item.getItemBody().findInteractions());
                elementInfos.add(itemInfo);
                sectionInfos.getItemInfos().add(itemInfo);
            }
        } else if (part instanceof AssessmentSection) {
            collectElementInfos((AssessmentSection) part);
        }
    }
}
Also used : SectionPart(uk.ac.ed.ph.jqtiplus.node.test.SectionPart) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection) 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)

Example 7 with SectionPart

use of uk.ac.ed.ph.jqtiplus.node.test.SectionPart in project OpenOLAT by OpenOLAT.

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 8 with SectionPart

use of uk.ac.ed.ph.jqtiplus.node.test.SectionPart in project OpenOLAT by OpenOLAT.

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 9 with SectionPart

use of uk.ac.ed.ph.jqtiplus.node.test.SectionPart in project OpenOLAT by OpenOLAT.

the class QTI21WordExport method renderAssessmentSection.

public void renderAssessmentSection(AssessmentSection assessmentSection, OpenXMLDocument document, boolean withResponses, Translator translator) {
    String title = assessmentSection.getTitle();
    document.appendHeading1(title, null);
    List<RubricBlock> rubricBlocks = assessmentSection.getRubricBlocks();
    for (RubricBlock rubricBlock : rubricBlocks) {
        String htmlRubric = htmlBuilder.blocksString(rubricBlock.getBlocks());
        document.appendHtmlText(htmlRubric, true);
    }
    for (SectionPart sectionPart : assessmentSection.getChildAbstractParts()) {
        if (sectionPart instanceof AssessmentSection) {
            renderAssessmentSection((AssessmentSection) sectionPart, document, withResponses, translator);
        } else if (sectionPart instanceof AssessmentItemRef) {
            AssessmentItemRef itemRef = (AssessmentItemRef) sectionPart;
            ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
            AssessmentItem assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
            URI itemUri = resolvedAssessmentTest.getSystemIdByItemRefMap().get(itemRef);
            renderAssessmentItem(assessmentItem, new File(itemUri), mediaDir, document, withResponses, translator, htmlBuilder);
            document.appendPageBreak();
        }
    }
}
Also used : SectionPart(uk.ac.ed.ph.jqtiplus.node.test.SectionPart) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection) 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) RubricBlock(uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock) URI(java.net.URI) File(java.io.File)

Example 10 with SectionPart

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

the class AssessmentTestHelper method visit.

/**
 * Go through the section part (assessmentSection or assessmentItemRef), visit recursively
 * the sections and assessment item refs.
 *
 * @param sectionPart
 * @param visitor
 */
public static void visit(SectionPart sectionPart, AssessmentTestVisitor visitor) {
    visitor.visit(sectionPart);
    if (sectionPart instanceof AssessmentSection) {
        AssessmentSection section = (AssessmentSection) sectionPart;
        List<SectionPart> childParts = section.getChildAbstractParts();
        if (childParts != null && childParts.size() > 0) {
            for (SectionPart childPart : childParts) {
                visit(childPart, visitor);
            }
        }
    }
}
Also used : SectionPart(uk.ac.ed.ph.jqtiplus.node.test.SectionPart) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)

Aggregations

SectionPart (uk.ac.ed.ph.jqtiplus.node.test.SectionPart)12 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)10 AssessmentSection (uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)10 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)6 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)6 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)4 File (java.io.File)2 URI (java.net.URI)2 DoubleAdder (java.util.concurrent.atomic.DoubleAdder)2 TreeNode (org.olat.core.gui.components.tree.TreeNode)2 AssessmentTestVisitor (org.olat.ims.qti21.AssessmentTestHelper.AssessmentTestVisitor)2 RubricBlock (uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock)2 AssessmentTest (uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest)2 TestPart (uk.ac.ed.ph.jqtiplus.node.test.TestPart)2 ResolvedAssessmentTest (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest)2