Search in sources :

Example 56 with IdentifierValue

use of uk.ac.ed.ph.jqtiplus.value.IdentifierValue in project openolat by klemens.

the class AssessmentObjectComponentRenderer method renderTestItemModalFeedback_feedbackModal.

/**
 * Render the feedback modal generated by OpenOLAT editor.
 *
 * @param renderer
 * @param sb
 * @param modalFeedback
 * @param component
 * @param resolvedAssessmentItem
 * @param itemSessionState
 * @param ubu
 * @param translator
 */
private void renderTestItemModalFeedback_feedbackModal(AssessmentRenderer renderer, StringOutput sb, ModalFeedback modalFeedback, AssessmentObjectComponent component, ResolvedAssessmentItem resolvedAssessmentItem, ItemSessionState itemSessionState, URLBuilder ubu, Translator translator) {
    sb.append("<div class='modalFeedback o_info clearfix");
    Value feedbackBasic = itemSessionState.getOutcomeValue(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
    if (feedbackBasic != null && feedbackBasic.hasBaseType(BaseType.IDENTIFIER) && feedbackBasic instanceof IdentifierValue) {
        IdentifierValue identifierValue = (IdentifierValue) feedbackBasic;
        if (AssessmentItemFactory.matchAdditionalFeedback(resolvedAssessmentItem.getRootNodeLookup().extractAssumingSuccessful(), modalFeedback)) {
            sb.append(" o_additional_modal_feedback");
        } else if (QTI21Constants.CORRECT_IDENTIFIER_VALUE.equals(identifierValue)) {
            sb.append(" o_correct_modal_feedback");
        } else if (QTI21Constants.INCORRECT_IDENTIFIER_VALUE.equals(identifierValue)) {
            sb.append(" o_incorrect_modal_feedback");
        } else if (QTI21Constants.EMPTY_IDENTIFIER_VALUE.equals(identifierValue)) {
            sb.append(" o_empty_modal_feedback");
        }
    }
    sb.append("'>");
    Attribute<?> title = modalFeedback.getAttributes().get("title");
    if (title != null && title.getValue() != null) {
        String feedbackTitle = title.getValue().toString();
        if (StringHelper.containsNonWhitespace(feedbackTitle)) {
            sb.append("<h4>");
            if (modalFeedback.getIdentifier() != null && QTI21Constants.HINT_IDENTIFIER.equals(modalFeedback.getIdentifier())) {
                sb.append("<i class='o_icon o_icon_help'> </i> ");
            }
            sb.append(StringHelper.escapeHtml(feedbackTitle)).append("</h4>");
        }
    }
    modalFeedback.getFlowStatics().forEach((flow) -> renderFlow(renderer, sb, component, resolvedAssessmentItem, itemSessionState, flow, ubu, translator));
    sb.append("</div>");
}
Also used : 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) IdentifierValue(uk.ac.ed.ph.jqtiplus.value.IdentifierValue) AssessmentRenderFunctions.contentAsString(org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.contentAsString)

Aggregations

IdentifierValue (uk.ac.ed.ph.jqtiplus.value.IdentifierValue)56 BaseValue (uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue)26 SingleValue (uk.ac.ed.ph.jqtiplus.value.SingleValue)24 Value (uk.ac.ed.ph.jqtiplus.value.Value)22 ResponseDeclaration (uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration)18 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)18 Variable (uk.ac.ed.ph.jqtiplus.node.expression.general.Variable)16 SetOutcomeValue (uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue)16 FieldValue (uk.ac.ed.ph.jqtiplus.node.shared.FieldValue)16 MultipleValue (uk.ac.ed.ph.jqtiplus.value.MultipleValue)16 IntegerValue (uk.ac.ed.ph.jqtiplus.value.IntegerValue)14 ResponseIf (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf)12 OrderedValue (uk.ac.ed.ph.jqtiplus.value.OrderedValue)12 Match (uk.ac.ed.ph.jqtiplus.node.expression.operator.Match)10 CorrectResponse (uk.ac.ed.ph.jqtiplus.node.item.CorrectResponse)10 ResponseCondition (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)10 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)8 IsNull (uk.ac.ed.ph.jqtiplus.node.expression.operator.IsNull)8 MapEntry (uk.ac.ed.ph.jqtiplus.node.item.response.declaration.MapEntry)8