use of uk.ac.ed.ph.jqtiplus.state.TestSessionState in project openolat by klemens.
the class AssessmentTreeComponent method getCurrentTestPartNode.
public TestPlanNode getCurrentTestPartNode() {
TestSessionState sessionState = getTestSessionController().getTestSessionState();
TestPlanNodeKey testPlanNodeKey = sessionState.getCurrentTestPartKey();
return testPlanNodeKey == null ? null : sessionState.getTestPlan().getNode(testPlanNodeKey);
}
use of uk.ac.ed.ph.jqtiplus.state.TestSessionState in project openolat by klemens.
the class AssessmentTreeComponentRenderer method renderTestEvent.
private void renderTestEvent(TestSessionController testSessionController, AssessmentRenderer renderer, StringOutput target, AssessmentTreeComponent component, URLBuilder ubu, Translator translator, RenderingRequest options) {
CandidateSessionContext candidateSessionContext = component.getCandidateSessionContext();
CandidateEvent candidateEvent = candidateSessionContext.getLastEvent();
CandidateTestEventType testEventType = candidateEvent.getTestEventType();
final TestSessionState testSessionState = testSessionController.getTestSessionState();
if (!candidateSessionContext.isTerminated() && !testSessionState.isExited()) {
if (testEventType == CandidateTestEventType.REVIEW_ITEM) {
renderer.setReviewMode(true);
} else if (testEventType == CandidateTestEventType.SOLUTION_ITEM) {
renderer.setSolutionMode(true);
}
renderNavigation(renderer, target, component, ubu, translator, options);
}
}
use of uk.ac.ed.ph.jqtiplus.state.TestSessionState 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.state.TestSessionState in project openolat by klemens.
the class AssessmentTreeComponentRenderer method renderNavigationAssessmentItem.
private void renderNavigationAssessmentItem(StringOutput sb, AssessmentTreeComponent component, TestPlanNode itemNode, Translator translator, RenderingRequest options) {
// check if currently rendered item is the active item
boolean active = false;
TestSessionController sessionCtr = component.getTestSessionController();
if (sessionCtr != null && itemNode != null) {
TestSessionState sessionState = sessionCtr.getTestSessionState();
if (sessionState != null && sessionState.getCurrentItemKey() != null) {
TestPlanNodeKey testPlanNodeKey = sessionState.getCurrentItemKey();
active = (testPlanNodeKey.getIdentifier().equals(itemNode.getIdentifier()));
}
}
sb.append("<li class='o_assessmentitem").append(" active", active).append("'>");
try {
renderAssessmentItemMark(sb, component, itemNode, translator);
renderAssessmentItemAttempts(sb, component, itemNode, translator);
renderItemStatus(sb, component, itemNode, translator, options);
renderAssessmentItemLink(sb, component, itemNode, translator);
} catch (IllegalStateException ex) {
log.error("", ex);
sb.append("<span class='o_danger'>ERROR</span>");
}
sb.append("</li>");
}
use of uk.ac.ed.ph.jqtiplus.state.TestSessionState in project OpenOLAT by OpenOLAT.
the class QTI21IdentityListCourseNodeToolsController method doOpenCorrection.
private void doOpenCorrection(UserRequest ureq) {
File unzippedDirRoot = FileResourceManager.getInstance().unzipFileResource(testEntry.getOlatResource());
ResolvedAssessmentTest resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
ManifestBuilder manifestBuilder = ManifestBuilder.read(new File(unzippedDirRoot, "imsmanifest.xml"));
TestSessionState testSessionState = qtiService.loadTestSessionState(lastSession);
Map<Identity, AssessmentTestSession> lastSessionMap = new HashMap<>();
lastSessionMap.put(assessedIdentity, lastSession);
CorrectionOverviewModel model = new CorrectionOverviewModel(courseEntry, testCourseNode.getIdent(), testEntry, resolvedAssessmentTest, manifestBuilder, lastSessionMap, Collections.singletonMap(assessedIdentity, testSessionState));
correctionCtrl = new CorrectionIdentityAssessmentItemListController(ureq, getWindowControl(), stackPanel, model, lastSession, assessedIdentity);
listenTo(correctionCtrl);
stackPanel.pushController(translate("tool.correction"), correctionCtrl);
}
Aggregations