Search in sources :

Example 26 with TestPart

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

the class AssessmentTreeComponentRenderer method renderAssessmentItemLink.

/**
 * @param sb
 * @param component
 * @param itemNode
 * @return The event used or null
 */
private Event renderAssessmentItemLink(StringOutput sb, AssessmentTreeComponent component, TestPlanNode itemNode, Translator translator) {
    String key = itemNode.getKey().toString();
    Form form = component.getQtiItem().getRootForm();
    String dispatchId = component.getQtiItem().getFormDispatchId();
    TestSessionController testSessionController = component.getTestSessionController();
    TestSessionState testSessionState = testSessionController.getTestSessionState();
    TestPart testPart = testSessionController.getCurrentTestPart();
    TestPlanNodeKey currentTestPartKey = testSessionState.getCurrentTestPartKey();
    TestPartSessionState currentTestPartSessionState = testSessionState.getTestPartSessionStates().get(currentTestPartKey);
    Event event;
    if (testPart == null || testPart.getNavigationMode() == NavigationMode.NONLINEAR) {
        if (testSessionState.isEnded() || currentTestPartSessionState.isEnded()) {
            if (itemNode.getEffectiveItemSessionControl().isAllowReview() || itemNode.getEffectiveItemSessionControl().isShowFeedback()) {
                event = Event.reviewItem;
            } else {
                event = null;
            }
        } else {
            event = Event.selectItem;
        }
    } else {
        event = null;
    }
    if (event == null) {
        sb.append("<span class='o_assessmentitem_nav_disabled'>");
    } else {
        sb.append("<a href='javascript:;' onclick=\"").append(FormJSHelper.getXHRFnCallFor(form, dispatchId, 1, true, true, new NameValuePair("cid", event.name()), new NameValuePair("item", key))).append(";\" class='o_sel_assessmentitem'>");
    }
    String title;
    if (component.isShowTitles()) {
        title = StringHelper.escapeHtml(itemNode.getSectionPartTitle());
    } else {
        int num = component.getCandidateSessionContext().getNumber(itemNode);
        title = translator.translate("question.title", new String[] { Integer.toString(num) });
    }
    sb.append("<span class='questionTitle'>").append(title).append("</span>");
    if (event == null) {
        sb.append("</span>");
    } else {
        sb.append("</a>");
    }
    return event;
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) Form(org.olat.core.gui.components.form.flexible.impl.Form) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart) TestSessionController(uk.ac.ed.ph.jqtiplus.running.TestSessionController) Event(org.olat.ims.qti21.ui.QTIWorksAssessmentTestEvent.Event) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent) TestPartSessionState(uk.ac.ed.ph.jqtiplus.state.TestPartSessionState) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 27 with TestPart

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

the class AssessmentTestHelper method needManualCorrection.

public static boolean needManualCorrection(ResolvedAssessmentTest resolvedAssessmentTest) {
    AssessmentTest test = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
    boolean needManualCorrection = false;
    List<TestPart> parts = test.getChildAbstractParts();
    for (TestPart part : parts) {
        List<AssessmentSection> sections = part.getAssessmentSections();
        for (AssessmentSection section : sections) {
            if (needManualCorrection(section, resolvedAssessmentTest)) {
                needManualCorrection = true;
                break;
            }
        }
    }
    return needManualCorrection;
}
Also used : ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart)

Example 28 with TestPart

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

the class AssessmentTestHelper method visit.

/**
 * Go through the assessmentTest, visit recursively its test parts, sections and
 * assessment item refs.
 *
 * @param assessmentTest The assessment test to visit
 * @param visitor The visitor
 */
public static void visit(AssessmentTest assessmentTest, AssessmentTestVisitor visitor) {
    List<TestPart> testParts = assessmentTest.getTestParts();
    if (testParts != null && testParts.size() > 0) {
        for (TestPart testPart : testParts) {
            visitor.visit(testPart);
            List<AssessmentSection> sections = testPart.getAssessmentSections();
            if (sections != null && sections.size() > 0) {
                for (AssessmentSection section : sections) {
                    visit(section, visitor);
                }
            }
        }
    }
}
Also used : AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart)

Example 29 with TestPart

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

the class AssessmentTestDisplayController method confirmEndTestPart.

private void confirmEndTestPart(UserRequest ureq) {
    TestPlanNode nextTestPart = testSessionController.findNextEnterableTestPart();
    if (nextTestPart == null) {
        String title = translate("confirm.finish.test.title");
        String text = translate("confirm.finish.test.text");
        endTestPartDialog = activateOkCancelDialog(ureq, title, text, endTestPartDialog);
    } else {
        TestPart currentTestPart = testSessionController.getCurrentTestPart();
        if (currentTestPart == null) {
            processEndTestPart(ureq);
        } else {
            String title = translate("confirm.finish.testpart.title");
            String text = translate("confirm.finish.testpart.text");
            endTestPartDialog = activateOkCancelDialog(ureq, title, text, endTestPartDialog);
        }
    }
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart)

Example 30 with TestPart

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

the class AssessmentTestComponentRenderer method renderReviewAssessmentSection.

private void renderReviewAssessmentSection(AssessmentRenderer renderer, StringOutput sb, AssessmentTestComponent component, TestPlanNode sectionNode, URLBuilder ubu, Translator translator) {
    AssessmentSectionSessionState assessmentSessionSessionState = component.getTestSessionController().getTestSessionState().getAssessmentSectionSessionStates().get(sectionNode.getKey());
    TestPart currentTestPart = component.getTestPart(component.getCurrentTestPartNode().getIdentifier());
    // <xsl:if test="$currentTestPart/@navigationMode='nonlinear' or exists($assessmentSessionSessionState/@entryTime)">
    if (currentTestPart.getNavigationMode() == NavigationMode.NONLINEAR || assessmentSessionSessionState.getEntryTime() != null) {
        sb.append("<li class='o_assessmentsection'>").append("<header><h2>").append(StringHelper.escapeHtml(sectionNode.getSectionPartTitle())).append("</h2>");
        renderAssessmentSectionRubrickBlock(renderer, sb, component, sectionNode, ubu, translator);
        sb.append("</header>");
        sb.append("<ul class='o_testpartnavigation_inner list-unstyled'>");
        sectionNode.getChildren().forEach((childNode) -> renderReview(renderer, sb, component, childNode, ubu, translator));
        sb.append("</ul>");
    }
}
Also used : TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart) AssessmentSectionSessionState(uk.ac.ed.ph.jqtiplus.state.AssessmentSectionSessionState)

Aggregations

TestPart (uk.ac.ed.ph.jqtiplus.node.test.TestPart)50 AssessmentSection (uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)28 AssessmentTest (uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest)20 ResolvedAssessmentTest (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest)16 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)12 TreeNode (org.olat.core.gui.components.tree.TreeNode)12 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)12 File (java.io.File)8 ItemSessionControl (uk.ac.ed.ph.jqtiplus.node.test.ItemSessionControl)8 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)8 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)6 URI (java.net.URI)4 Date (java.util.Date)4 NameValuePair (org.olat.core.gui.components.form.flexible.impl.NameValuePair)4 CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)4 RubricBlock (uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock)4 Ordering (uk.ac.ed.ph.jqtiplus.node.test.Ordering)4 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)4 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)3 FileOutputStream (java.io.FileOutputStream)2