Search in sources :

Example 1 with AssessmentRenderFunctions.getResponseValue

use of org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getResponseValue in project OpenOLAT by OpenOLAT.

the class AssessmentObjectComponentRenderer method renderExtendedTextBox.

protected void renderExtendedTextBox(AssessmentRenderer renderer, StringOutput sb, AssessmentObjectComponent component, AssessmentItem assessmentItem, ItemSessionState itemSessionState, ExtendedTextInteraction interaction) {
    ResponseData responseInput = getResponseInput(itemSessionState, interaction.getResponseIdentifier());
    ResponseDeclaration responseDeclaration = getResponseDeclaration(assessmentItem, interaction.getResponseIdentifier());
    Cardinality cardinality = responseDeclaration == null ? null : responseDeclaration.getCardinality();
    if (cardinality != null && (cardinality.isRecord() || cardinality.isSingle())) {
        String responseInputString = extractSingleCardinalityResponseInput(responseInput);
        renderExtendedTextBox(renderer, sb, component, assessmentItem, itemSessionState, interaction, responseInputString);
    } else {
        if (interaction.getMaxStrings() != null) {
            int maxStrings = interaction.getMaxStrings().intValue();
            for (int i = 0; i < maxStrings; i++) {
                String responseInputString = extractResponseInputAt(responseInput, i);
                renderExtendedTextBox(renderer, sb, component, assessmentItem, itemSessionState, interaction, responseInputString);
            }
        } else {
            // <xsl:with-param name="stringsCount" select="if (exists($responseValue)) then max(($minStrings, qw:get-cardinality-size($responseValue))) else $minStrings"/>
            int stringCounts = interaction.getMinStrings();
            Value responseValue = AssessmentRenderFunctions.getResponseValue(assessmentItem, itemSessionState, interaction.getResponseIdentifier(), renderer.isSolutionMode());
            if (exists(responseValue)) {
                stringCounts = java.lang.Math.max(interaction.getMinStrings(), getCardinalitySize(responseValue));
            }
            for (int i = 0; i < stringCounts; i++) {
                String responseInputString = extractResponseInputAt(responseInput, i);
                renderExtendedTextBox(renderer, sb, component, assessmentItem, itemSessionState, interaction, responseInputString);
            }
        }
    }
}
Also used : Cardinality(uk.ac.ed.ph.jqtiplus.value.Cardinality) ResponseData(uk.ac.ed.ph.jqtiplus.types.ResponseData) AssessmentRenderFunctions.getOutcomeValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getOutcomeValue) AssessmentRenderFunctions.extractRecordFieldValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.extractRecordFieldValue) Value(uk.ac.ed.ph.jqtiplus.value.Value) AssessmentRenderFunctions.getHtmlAttributeValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getHtmlAttributeValue) AssessmentRenderFunctions.renderOrderedCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderOrderedCardinalityValue) AssessmentRenderFunctions.isMultipleCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isMultipleCardinalityValue) AssessmentRenderFunctions.renderSingleCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderSingleCardinalityValue) AssessmentRenderFunctions.renderMultipleCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderMultipleCardinalityValue) IdentifierValue(uk.ac.ed.ph.jqtiplus.value.IdentifierValue) AssessmentRenderFunctions.getTemplateValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getTemplateValue) AssessmentRenderFunctions.renderRecordCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderRecordCardinalityValue) AssessmentRenderFunctions.getResponseValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getResponseValue) AssessmentRenderFunctions.isNullValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isNullValue) AssessmentRenderFunctions.isSingleCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isSingleCardinalityValue) AssessmentRenderFunctions.isRecordCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isRecordCardinalityValue) AssessmentRenderFunctions.isOrderedCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isOrderedCardinalityValue) AssessmentRenderFunctions.isMathsContentValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isMathsContentValue) SingleValue(uk.ac.ed.ph.jqtiplus.value.SingleValue) AssessmentRenderFunctions.contentAsString(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.contentAsString) ResponseDeclaration(uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration) AssessmentRenderFunctions.getResponseDeclaration(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getResponseDeclaration)

Example 2 with AssessmentRenderFunctions.getResponseValue

use of org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getResponseValue in project openolat by klemens.

the class AssessmentObjectComponentRenderer method renderExtendedTextBox.

protected void renderExtendedTextBox(AssessmentRenderer renderer, StringOutput sb, AssessmentObjectComponent component, AssessmentItem assessmentItem, ItemSessionState itemSessionState, ExtendedTextInteraction interaction) {
    ResponseData responseInput = getResponseInput(itemSessionState, interaction.getResponseIdentifier());
    ResponseDeclaration responseDeclaration = getResponseDeclaration(assessmentItem, interaction.getResponseIdentifier());
    Cardinality cardinality = responseDeclaration == null ? null : responseDeclaration.getCardinality();
    if (cardinality != null && (cardinality.isRecord() || cardinality.isSingle())) {
        String responseInputString = extractSingleCardinalityResponseInput(responseInput);
        renderExtendedTextBox(renderer, sb, component, assessmentItem, itemSessionState, interaction, responseInputString);
    } else {
        if (interaction.getMaxStrings() != null) {
            int maxStrings = interaction.getMaxStrings().intValue();
            for (int i = 0; i < maxStrings; i++) {
                String responseInputString = extractResponseInputAt(responseInput, i);
                renderExtendedTextBox(renderer, sb, component, assessmentItem, itemSessionState, interaction, responseInputString);
            }
        } else {
            // <xsl:with-param name="stringsCount" select="if (exists($responseValue)) then max(($minStrings, qw:get-cardinality-size($responseValue))) else $minStrings"/>
            int stringCounts = interaction.getMinStrings();
            Value responseValue = AssessmentRenderFunctions.getResponseValue(assessmentItem, itemSessionState, interaction.getResponseIdentifier(), renderer.isSolutionMode());
            if (exists(responseValue)) {
                stringCounts = java.lang.Math.max(interaction.getMinStrings(), getCardinalitySize(responseValue));
            }
            for (int i = 0; i < stringCounts; i++) {
                String responseInputString = extractResponseInputAt(responseInput, i);
                renderExtendedTextBox(renderer, sb, component, assessmentItem, itemSessionState, interaction, responseInputString);
            }
        }
    }
}
Also used : Cardinality(uk.ac.ed.ph.jqtiplus.value.Cardinality) ResponseData(uk.ac.ed.ph.jqtiplus.types.ResponseData) AssessmentRenderFunctions.getOutcomeValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getOutcomeValue) AssessmentRenderFunctions.extractRecordFieldValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.extractRecordFieldValue) Value(uk.ac.ed.ph.jqtiplus.value.Value) AssessmentRenderFunctions.getHtmlAttributeValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getHtmlAttributeValue) AssessmentRenderFunctions.renderOrderedCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderOrderedCardinalityValue) AssessmentRenderFunctions.isMultipleCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isMultipleCardinalityValue) AssessmentRenderFunctions.renderSingleCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderSingleCardinalityValue) AssessmentRenderFunctions.renderMultipleCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderMultipleCardinalityValue) IdentifierValue(uk.ac.ed.ph.jqtiplus.value.IdentifierValue) AssessmentRenderFunctions.getTemplateValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getTemplateValue) AssessmentRenderFunctions.renderRecordCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderRecordCardinalityValue) AssessmentRenderFunctions.getResponseValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getResponseValue) AssessmentRenderFunctions.isNullValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isNullValue) AssessmentRenderFunctions.isSingleCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isSingleCardinalityValue) AssessmentRenderFunctions.isRecordCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isRecordCardinalityValue) AssessmentRenderFunctions.isOrderedCardinalityValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isOrderedCardinalityValue) AssessmentRenderFunctions.isMathsContentValue(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isMathsContentValue) SingleValue(uk.ac.ed.ph.jqtiplus.value.SingleValue) AssessmentRenderFunctions.contentAsString(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.contentAsString) ResponseDeclaration(uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration) AssessmentRenderFunctions.getResponseDeclaration(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getResponseDeclaration)

Aggregations

AssessmentRenderFunctions.contentAsString (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.contentAsString)2 AssessmentRenderFunctions.extractRecordFieldValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.extractRecordFieldValue)2 AssessmentRenderFunctions.getHtmlAttributeValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getHtmlAttributeValue)2 AssessmentRenderFunctions.getOutcomeValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getOutcomeValue)2 AssessmentRenderFunctions.getResponseDeclaration (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getResponseDeclaration)2 AssessmentRenderFunctions.getResponseValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getResponseValue)2 AssessmentRenderFunctions.getTemplateValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.getTemplateValue)2 AssessmentRenderFunctions.isMathsContentValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isMathsContentValue)2 AssessmentRenderFunctions.isMultipleCardinalityValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isMultipleCardinalityValue)2 AssessmentRenderFunctions.isNullValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isNullValue)2 AssessmentRenderFunctions.isOrderedCardinalityValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isOrderedCardinalityValue)2 AssessmentRenderFunctions.isRecordCardinalityValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isRecordCardinalityValue)2 AssessmentRenderFunctions.isSingleCardinalityValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.isSingleCardinalityValue)2 AssessmentRenderFunctions.renderMultipleCardinalityValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderMultipleCardinalityValue)2 AssessmentRenderFunctions.renderOrderedCardinalityValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderOrderedCardinalityValue)2 AssessmentRenderFunctions.renderRecordCardinalityValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderRecordCardinalityValue)2 AssessmentRenderFunctions.renderSingleCardinalityValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderSingleCardinalityValue)2 ResponseDeclaration (uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration)2 ResponseData (uk.ac.ed.ph.jqtiplus.types.ResponseData)2 Cardinality (uk.ac.ed.ph.jqtiplus.value.Cardinality)2