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);
}
}
}
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;
}
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);
}
}
}
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();
}
}
}
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);
}
}
}
}
Aggregations