/** * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, * org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event) */ public void event(UserRequest urequest, Controller source, Event event) { if (source == displayController) { if (event instanceof IQSubmittedEvent) { // Save results in case of test if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) { exposeUserTestDataToVC(urequest); } // Save results in case of questionnaire else if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SURVEY)) { exposeUserQuestionnaireDataToVC(); if (displayContainerController != null) { displayContainerController.deactivate(urequest); } else { getWindowControl().pop(); } OLATResourceable ores = OresHelper.createOLATResourceableInstance("test", -1l); addToHistory(urequest, ores, null); } // Don't save results in case of self-test // but do safe attempts ! else if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SELF)) { // am.incrementNodeAttempts(courseNode, urequest.getIdentity(), userCourseEnv); } } else if (event.equals(Event.DONE_EVENT)) { stopAssessment(urequest, event); } else if (IQEvent.TEST_PULLED.equals(event.getCommand())) { stopAssessment(urequest, event); showWarning("error.assessment.pulled"); } else if (IQEvent.TEST_STOPPED.equals(event.getCommand())) { stopAssessment(urequest, event); showWarning("error.assessment.stopped"); } } }
private void stopAssessment(UserRequest ureq, Event event) { if (displayContainerController != null) { displayContainerController.deactivate(ureq); } else { getWindowControl().pop(); } removeHistory(ureq); OLATResourceable ores = OresHelper.createOLATResourceableInstance("test", -1l); addToHistory(ureq, ores, null); if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS) && !assessmentStopped) { assessmentStopped = true; AssessmentEvent assessmentStoppedEvent = new AssessmentEvent(AssessmentEvent.TYPE.STOPPED, userSession); singleUserEventCenter.deregisterFor(this, assessmentInstanceOres); singleUserEventCenter.fireEventToListenersOf(assessmentStoppedEvent, assessmentEventOres); } fireEvent(ureq, event); }