use of uk.ac.ed.ph.jqtiplus.running.TestSessionController in project openolat by klemens.
the class AssessmentTestDisplayController method createTestSessionController.
public TestSessionController createTestSessionController(TestSessionState testSessionState, NotificationRecorder notificationRecorder) {
/* Try to resolve the underlying JQTI+ object */
final TestProcessingMap testProcessingMap = getTestProcessingMap();
if (testProcessingMap == null) {
return null;
}
/* Create config for TestSessionController */
final TestSessionControllerSettings testSessionControllerSettings = new TestSessionControllerSettings();
testSessionControllerSettings.setTemplateProcessingLimit(computeTemplateProcessingLimit());
/* Create controller and wire up notification recorder (if passed) */
final TestSessionController result = new TestSessionController(qtiService.jqtiExtensionManager(), testSessionControllerSettings, testProcessingMap, testSessionState);
if (notificationRecorder != null) {
result.addNotificationListener(notificationRecorder);
}
return result;
}
use of uk.ac.ed.ph.jqtiplus.running.TestSessionController in project openolat by klemens.
the class AssessmentTestComponentRenderer method render.
@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
AssessmentTestComponent cmp = (AssessmentTestComponent) source;
TestSessionController testSessionController = cmp.getTestSessionController();
if (testSessionController.getTestSessionState().isEnded()) {
renderTerminated(sb, translator);
} else {
/* Create appropriate options that link back to this controller */
TestSessionState testSessionState = testSessionController.getTestSessionState();
CandidateSessionContext candidateSessionContext = cmp.getCandidateSessionContext();
final AssessmentTestSession candidateSession = candidateSessionContext.getCandidateSession();
if (candidateSession.isExploded()) {
renderExploded(sb, translator);
} else if (candidateSessionContext.isTerminated()) {
renderTerminated(sb, translator);
} else {
/* Touch the session's duration state if appropriate */
if (testSessionState.isEntered() && !testSessionState.isEnded()) {
final Date timestamp = candidateSessionContext.getCurrentRequestTimestamp();
testSessionController.touchDurations(timestamp);
}
/* Render event */
AssessmentRenderer renderHints = new AssessmentRenderer(renderer);
renderTestEvent(testSessionController, renderHints, sb, cmp, ubu, translator);
}
}
}
use of uk.ac.ed.ph.jqtiplus.running.TestSessionController in project openolat by klemens.
the class AssessmentTreeComponentRenderer method render.
@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
AssessmentTreeComponent component = (AssessmentTreeComponent) source;
TestSessionController testSessionController = component.getTestSessionController();
if (!testSessionController.getTestSessionState().isEnded()) {
CandidateSessionContext candidateSessionContext = component.getCandidateSessionContext();
final AssessmentTestSession candidateSession = candidateSessionContext.getCandidateSession();
if (!candidateSession.isExploded() && !candidateSessionContext.isTerminated()) {
CandidateEvent candidateEvent = candidateSessionContext.getLastEvent();
CandidateTestEventType testEventType = candidateEvent.getTestEventType();
RenderingRequest options;
if (testEventType == CandidateTestEventType.REVIEW_ITEM) {
options = RenderingRequest.getItemReview();
} else if (testEventType == CandidateTestEventType.SOLUTION_ITEM) {
options = RenderingRequest.getItemSolution();
} else {
options = RenderingRequest.getItem(testSessionController);
}
AssessmentRenderer renderHints = new AssessmentRenderer(renderer);
renderTestEvent(testSessionController, renderHints, sb, component, ubu, translator, options);
}
}
}
Aggregations