Search in sources :

Example 16 with TestSessionController

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;
}
Also used : TestSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.TestSessionControllerSettings) TestProcessingMap(uk.ac.ed.ph.jqtiplus.state.TestProcessingMap) TestSessionController(uk.ac.ed.ph.jqtiplus.running.TestSessionController)

Example 17 with TestSessionController

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);
        }
    }
}
Also used : CandidateSessionContext(org.olat.ims.qti21.ui.CandidateSessionContext) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) TestSessionController(uk.ac.ed.ph.jqtiplus.running.TestSessionController) Date(java.util.Date)

Example 18 with TestSessionController

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);
        }
    }
}
Also used : CandidateSessionContext(org.olat.ims.qti21.ui.CandidateSessionContext) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) CandidateTestEventType(org.olat.ims.qti21.model.audit.CandidateTestEventType) TestSessionController(uk.ac.ed.ph.jqtiplus.running.TestSessionController) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Aggregations

TestSessionController (uk.ac.ed.ph.jqtiplus.running.TestSessionController)18 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)12 NameValuePair (org.olat.core.gui.components.form.flexible.impl.NameValuePair)6 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)6 Date (java.util.Date)4 Form (org.olat.core.gui.components.form.flexible.impl.Form)4 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)4 CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)4 CandidateSessionContext (org.olat.ims.qti21.ui.CandidateSessionContext)4 AssessmentRenderFunctions.contentAsString (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.contentAsString)4 TestSessionControllerSettings (uk.ac.ed.ph.jqtiplus.running.TestSessionControllerSettings)4 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)4 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)4 TestProcessingMap (uk.ac.ed.ph.jqtiplus.state.TestProcessingMap)4 Component (org.olat.core.gui.components.Component)2 RenderResult (org.olat.core.gui.render.RenderResult)2 CandidateTestEventType (org.olat.ims.qti21.model.audit.CandidateTestEventType)2 Event (org.olat.ims.qti21.ui.QTIWorksAssessmentTestEvent.Event)2 TestPart (uk.ac.ed.ph.jqtiplus.node.test.TestPart)2 NotificationRecorder (uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder)2