Search in sources :

Example 6 with QTI21AssessmentResultsOptions

use of org.olat.ims.qti21.QTI21AssessmentResultsOptions in project openolat by klemens.

the class QTI21AssessmentRunController method exposeResults.

/**
 * WARNING! The variables  and are not used
 * in the velocity template and the CONFIG_KEY_RESULT_ON_HOME_PAGE is not editable
 * in the configuration of the course element for QTI 2.1!!!!
 *
 * Provides the show results button if results available or a message with the visibility period.
 *
 * @param ureq
 */
private void exposeResults(UserRequest ureq, boolean resultsVisible) {
    // migration: check if old tests have no summary configured
    boolean showResultsOnHomePage = config.getBooleanSafe(IQEditController.CONFIG_KEY_RESULT_ON_HOME_PAGE);
    QTI21AssessmentResultsOptions showSummary = deliveryOptions.getAssessmentResultsOptions();
    if (resultsVisible && !showSummary.none()) {
        mainVC.contextPut("showResultsOnHomePage", Boolean.valueOf(showResultsOnHomePage));
        boolean dateRelatedVisibility = isResultVisible(config);
        if (showResultsOnHomePage && dateRelatedVisibility) {
            mainVC.contextPut("showResultsVisible", Boolean.TRUE);
            showResultsButton = LinkFactory.createLink("command.showResults", "command.showResults", getTranslator(), mainVC, this, Link.LINK | Link.NONTRANSLATED);
            showResultsButton.setCustomDisplayText(translate("showResults.title"));
            showResultsButton.setElementCssClass("o_qti_show_assessment_results");
            showResultsButton.setIconLeftCSS("o_icon o_icon-fw o_icon_open_togglebox");
            hideResultsButton = LinkFactory.createLink("command.hideResults", "command.hideResults", getTranslator(), mainVC, this, Link.LINK | Link.NONTRANSLATED);
            hideResultsButton.setCustomDisplayText(translate("showResults.title"));
            hideResultsButton.setElementCssClass("o_qti_hide_assessment_results");
            hideResultsButton.setIconLeftCSS("o_icon o_icon-fw o_icon_close_togglebox");
            if (isPanelOpen(ureq, "results", true)) {
                doShowResults(ureq);
            }
        } else if (showResultsOnHomePage) {
            exposeVisiblityPeriod();
            mainVC.contextPut("showResultsVisible", Boolean.FALSE);
        } else {
            exposeVisiblityPeriod();
            mainVC.contextPut("showResultsVisible", Boolean.FALSE);
        }
    } else {
        exposeVisiblityPeriod();
        mainVC.contextPut("showResultsVisible", Boolean.FALSE);
        mainVC.contextPut("showResultsOnHomePage", Boolean.valueOf(showResultsOnHomePage && !showSummary.none()));
    }
    if (!anonym && resultsVisible) {
        UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
        mainVC.contextPut("log", am.getUserNodeLog(courseNode, getIdentity()));
    }
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions)

Example 7 with QTI21AssessmentResultsOptions

use of org.olat.ims.qti21.QTI21AssessmentResultsOptions in project openolat by klemens.

the class QTI21EditForm method initFormReport.

protected void initFormReport(FormItemContainer formLayout) {
    boolean testDateDependent = modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_DATE_DEPENDENT_TEST);
    testDateDependentEl = uifactory.addCheckboxesHorizontal("qti_datetest", "qti.form.test.date", formLayout, new String[] { "xx" }, new String[] { null });
    testDateDependentEl.select("xx", testDateDependent);
    testDateDependentEl.setHelpTextKey("qti.form.test.date.help", null);
    testDateDependentEl.addActionListener(FormEvent.ONCLICK);
    Date startTestDate = modConfig.getDateValue(IQEditController.CONFIG_KEY_RESULTS_START_TEST_DATE);
    startTestDateElement = uifactory.addDateChooser("qti_form_start_test_date", "qti.form.date.start", startTestDate, formLayout);
    startTestDateElement.setDateChooserTimeEnabled(true);
    startTestDateElement.setMandatory(true);
    Date endTestDate = modConfig.getDateValue(IQEditController.CONFIG_KEY_RESULTS_END_TEST_DATE);
    endTestDateElement = uifactory.addDateChooser("qti_form_end_test_date", "qti.form.date.end", endTestDate, formLayout);
    endTestDateElement.setDateChooserTimeEnabled(true);
    String[] correctionModeValues = new String[] { translate("correction.auto"), translate("correction.manual") };
    correctionModeEl = uifactory.addRadiosVertical("correction.mode", "correction.mode", formLayout, correctionModeKeys, correctionModeValues);
    correctionModeEl.setHelpText(translate("correction.mode.help"));
    correctionModeEl.setHelpUrlForManualPage("Test editor QTI 2.1 in detail#details_testeditor_test_konf_kurs");
    String mode = modConfig.getStringValue(IQEditController.CONFIG_CORRECTION_MODE);
    boolean selected = false;
    for (String correctionModeKey : correctionModeKeys) {
        if (correctionModeKey.equals(mode)) {
            correctionModeEl.select(correctionModeKey, true);
            selected = true;
        }
    }
    if (!selected) {
        if (needManualCorrection) {
            correctionModeEl.select(correctionModeKeys[1], true);
        } else {
            correctionModeEl.select(correctionModeKeys[0], true);
        }
    }
    // Show score informations on start page
    boolean enableScoreInfos = modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
    scoreInfo = uifactory.addCheckboxesHorizontal("qti_scoreInfo", "qti.form.scoreinfo", formLayout, new String[] { "xx" }, new String[] { null });
    if (enableScoreInfos) {
        scoreInfo.select("xx", enableScoreInfos);
    }
    scoreInfo.addActionListener(FormEvent.ONCLICK);
    boolean showResultOnHomePage = modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_RESULT_ON_HOME_PAGE);
    showResultsOnHomePage = uifactory.addCheckboxesHorizontal("qti_enableResultsOnHomePage", "qti.form.results.onhomepage", formLayout, new String[] { "xx" }, new String[] { null });
    if (showResultOnHomePage) {
        showResultsOnHomePage.select("xx", showResultOnHomePage);
    }
    showResultsOnHomePage.setElementCssClass("o_sel_results_on_homepage");
    showResultsOnHomePage.addActionListener(FormEvent.ONCLICK);
    boolean showResultsDateDependent = modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_DATE_DEPENDENT_RESULTS);
    showResultsDateDependentButton = uifactory.addCheckboxesHorizontal("qti_showresult", "qti.form.show.results", formLayout, new String[] { "xx" }, new String[] { null });
    showResultsDateDependentButton.select("xx", showResultsDateDependent);
    showResultsDateDependentButton.addActionListener(FormEvent.ONCLICK);
    Date startDate = modConfig.getDateValue(IQEditController.CONFIG_KEY_RESULTS_START_DATE);
    startDateElement = uifactory.addDateChooser("qti_form_start_date", "qti.form.date.start", null, formLayout);
    startDateElement.setDateChooserTimeEnabled(true);
    startDateElement.setDate(startDate);
    startDateElement.setMandatory(true);
    Date endDate = modConfig.getDateValue(IQEditController.CONFIG_KEY_RESULTS_END_DATE);
    endDateElement = uifactory.addDateChooser("qti_form_end_date", "qti.form.date.end", null, formLayout);
    endDateElement.setDateChooserTimeEnabled(true);
    endDateElement.setDate(endDate);
    QTI21AssessmentResultsOptions resultsOptions = deliveryOptions.getAssessmentResultsOptions();
    if (!AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT.equals(modConfig.getStringValue(IQEditController.CONFIG_KEY_SUMMARY))) {
        resultsOptions = QTI21AssessmentResultsOptions.parseString(modConfig.getStringValue(IQEditController.CONFIG_KEY_SUMMARY, AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT));
    }
    showResultsOnFinishEl = uifactory.addCheckboxesHorizontal("resultOnFinish", "qti.form.results.onfinish", formLayout, onKeys, onValues);
    showResultsOnFinishEl.setElementCssClass("o_sel_qti_show_results");
    showResultsOnFinishEl.addActionListener(FormEvent.ONCHANGE);
    showResultsOnFinishEl.setHelpText(translate("qti.form.results.onfinish.help"));
    Boolean showResultOnFinish = modConfig.getBooleanEntry(IQEditController.CONFIG_KEY_RESULT_ON_FINISH);
    if (showResultOnFinish == null) {
        // not set -> back the default
        if (!resultsOptions.none()) {
            showResultsOnFinishEl.select(onKeys[0], true);
        }
    } else if (showResultOnFinish.booleanValue()) {
        showResultsOnFinishEl.select(onKeys[0], true);
    }
    String[] resultsOptionsValues = new String[] { translate("qti.form.summary.metadata"), translate("qti.form.summary.sections"), translate("qti.form.summary.questions.metadata"), translate("qti.form.summary.responses"), translate("qti.form.summary.solutions") };
    assessmentResultsOnFinishEl = uifactory.addCheckboxesVertical("typeResultOnFinish", "qti.form.summary", formLayout, resultsOptionsKeys, resultsOptionsValues, 1);
    assessmentResultsOnFinishEl.setElementCssClass("o_sel_qti_show_results_options");
    assessmentResultsOnFinishEl.setHelpText(translate("qti.form.summary.help"));
    assessmentResultsOnFinishEl.setHelpUrlForManualPage("Test editor QTI 2.1 in detail#overview_results");
    uifactory.addFormSubmitButton("submit", formLayout);
    // setup the values
    update();
    updateAssessmentResultsOnFinish(resultsOptions);
}
Also used : Date(java.util.Date) QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions)

Example 8 with QTI21AssessmentResultsOptions

use of org.olat.ims.qti21.QTI21AssessmentResultsOptions in project OpenOLAT by OpenOLAT.

the class ImsQTI21Test method qti21TestFlow_timeLimits_results.

/**
 * Test with time limit and wait for the results at the end.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21TestFlow_timeLimits_results(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // upload a test
    String qtiTestTitle = "Timed QTI 2.1 " + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/test_time_limits.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile).clickToolbarRootCrumb();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    qtiPage.options().showResults(Boolean.TRUE, new QTI21AssessmentResultsOptions(true, true, false, false, false)).save();
    // check simple time limit
    qtiPage.clickToolbarBack().assertOnAssessmentItem("Single choice").answerSingleChoiceWithParagraph("Correct answer").saveAnswer().assertOnAssessmentItem("Last choice").answerSingleChoiceWithParagraph("True").saveAnswer().assertOnAssessmentResults(15).assertOnAssessmentTestPassed().assertOnAssessmentTestMaxScore(2).assertOnAssessmentTestScore(2);
}
Also used : UserVO(org.olat.user.restapi.UserVO) File(java.io.File) URL(java.net.URL) QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 9 with QTI21AssessmentResultsOptions

use of org.olat.ims.qti21.QTI21AssessmentResultsOptions in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentRunController method exposeResults.

/**
 * WARNING! The variables  and are not used
 * in the velocity template and the CONFIG_KEY_RESULT_ON_HOME_PAGE is not editable
 * in the configuration of the course element for QTI 2.1!!!!
 *
 * Provides the show results button if results available or a message with the visibility period.
 *
 * @param ureq
 */
private void exposeResults(UserRequest ureq, boolean resultsVisible) {
    // migration: check if old tests have no summary configured
    boolean showResultsOnHomePage = config.getBooleanSafe(IQEditController.CONFIG_KEY_RESULT_ON_HOME_PAGE);
    QTI21AssessmentResultsOptions showSummary = deliveryOptions.getAssessmentResultsOptions();
    if (resultsVisible && !showSummary.none()) {
        mainVC.contextPut("showResultsOnHomePage", Boolean.valueOf(showResultsOnHomePage));
        boolean dateRelatedVisibility = isResultVisible(config);
        if (showResultsOnHomePage && dateRelatedVisibility) {
            mainVC.contextPut("showResultsVisible", Boolean.TRUE);
            showResultsButton = LinkFactory.createLink("command.showResults", "command.showResults", getTranslator(), mainVC, this, Link.LINK | Link.NONTRANSLATED);
            showResultsButton.setCustomDisplayText(translate("showResults.title"));
            showResultsButton.setElementCssClass("o_qti_show_assessment_results");
            showResultsButton.setIconLeftCSS("o_icon o_icon-fw o_icon_open_togglebox");
            hideResultsButton = LinkFactory.createLink("command.hideResults", "command.hideResults", getTranslator(), mainVC, this, Link.LINK | Link.NONTRANSLATED);
            hideResultsButton.setCustomDisplayText(translate("showResults.title"));
            hideResultsButton.setElementCssClass("o_qti_hide_assessment_results");
            hideResultsButton.setIconLeftCSS("o_icon o_icon-fw o_icon_close_togglebox");
            if (isPanelOpen(ureq, "results", true)) {
                doShowResults(ureq);
            }
        } else if (showResultsOnHomePage) {
            exposeVisiblityPeriod();
            mainVC.contextPut("showResultsVisible", Boolean.FALSE);
        } else {
            exposeVisiblityPeriod();
            mainVC.contextPut("showResultsVisible", Boolean.FALSE);
        }
    } else {
        exposeVisiblityPeriod();
        mainVC.contextPut("showResultsVisible", Boolean.FALSE);
        mainVC.contextPut("showResultsOnHomePage", Boolean.valueOf(showResultsOnHomePage && !showSummary.none()));
    }
    if (!anonym && resultsVisible) {
        UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
        mainVC.contextPut("log", am.getUserNodeLog(courseNode, getIdentity()));
    }
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions)

Example 10 with QTI21AssessmentResultsOptions

use of org.olat.ims.qti21.QTI21AssessmentResultsOptions in project openolat by klemens.

the class ImsQTI21Test method qti21TestFlow_timeLimits_results.

/**
 * Test with time limit and wait for the results at the end.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21TestFlow_timeLimits_results(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // upload a test
    String qtiTestTitle = "Timed QTI 2.1 " + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/test_time_limits.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile).clickToolbarRootCrumb();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    qtiPage.options().showResults(Boolean.TRUE, new QTI21AssessmentResultsOptions(true, true, false, false, false)).save();
    // check simple time limit
    qtiPage.clickToolbarBack().assertOnAssessmentItem("Single choice").answerSingleChoiceWithParagraph("Correct answer").saveAnswer().assertOnAssessmentItem("Last choice").answerSingleChoiceWithParagraph("True").saveAnswer().assertOnAssessmentResults(15).assertOnAssessmentTestPassed().assertOnAssessmentTestMaxScore(2).assertOnAssessmentTestScore(2);
}
Also used : UserVO(org.olat.user.restapi.UserVO) File(java.io.File) URL(java.net.URL) QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

QTI21AssessmentResultsOptions (org.olat.ims.qti21.QTI21AssessmentResultsOptions)10 File (java.io.File)2 URL (java.net.URL)2 Date (java.util.Date)2 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)2 Test (org.junit.Test)2 UserNodeAuditManager (org.olat.course.auditing.UserNodeAuditManager)2 QTI21Page (org.olat.selenium.page.qti.QTI21Page)2 UserRestClient (org.olat.test.rest.UserRestClient)2 UserVO (org.olat.user.restapi.UserVO)2