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