Search in sources :

Example 36 with Material

use of org.olat.ims.qti.editor.beecom.objects.Material in project openolat by klemens.

the class QTI12To21Converter method convertFeedbackPerAnswers.

private void convertFeedbackPerAnswers(Item item, AssessmentItemBuilder itemBuilder, Map<String, Identifier> identToIdentifier) {
    Question question = item.getQuestion();
    List<ModalFeedbackBuilder> additionalFeedbacks = new ArrayList<>();
    for (Response response : question.getResponses()) {
        if (response instanceof ChoiceResponse) {
            Material responseFeedbackMat = QTIEditHelper.getFeedbackOlatRespMaterial(item, response.getIdent());
            if (responseFeedbackMat != null) {
                String feedbackCondition = responseFeedbackMat.renderAsHtmlForEditor();
                feedbackCondition = blockedHtml(feedbackCondition);
                ModalFeedbackCondition condition = new ModalFeedbackCondition();
                condition.setVariable(Variable.response);
                condition.setOperator(Operator.equals);
                condition.setValue(identToIdentifier.get(response.getIdent()).toString());
                List<ModalFeedbackCondition> conditions = new ArrayList<>(1);
                conditions.add(condition);
                ModalFeedbackBuilder feedback = new ModalFeedbackBuilder(itemBuilder.getAssessmentItem(), ModalFeedbackType.additional);
                feedback.setFeedbackConditions(conditions);
                feedback.setText(feedbackCondition);
                additionalFeedbacks.add(feedback);
            }
        }
    }
    itemBuilder.setAdditionalFeedbackBuilders(additionalFeedbacks);
}
Also used : FIBResponse(org.olat.ims.qti.editor.beecom.objects.FIBResponse) ChoiceResponse(org.olat.ims.qti.editor.beecom.objects.ChoiceResponse) Response(org.olat.ims.qti.editor.beecom.objects.Response) EssayResponse(org.olat.ims.qti.editor.beecom.objects.EssayResponse) ChoiceResponse(org.olat.ims.qti.editor.beecom.objects.ChoiceResponse) ModalFeedbackBuilder(org.olat.ims.qti21.model.xml.ModalFeedbackBuilder) ArrayList(java.util.ArrayList) EssayQuestion(org.olat.ims.qti.editor.beecom.objects.EssayQuestion) ChoiceQuestion(org.olat.ims.qti.editor.beecom.objects.ChoiceQuestion) Question(org.olat.ims.qti.editor.beecom.objects.Question) Material(org.olat.ims.qti.editor.beecom.objects.Material) ModalFeedbackCondition(org.olat.ims.qti21.model.xml.ModalFeedbackCondition)

Aggregations

Material (org.olat.ims.qti.editor.beecom.objects.Material)36 ArrayList (java.util.ArrayList)20 Response (org.olat.ims.qti.editor.beecom.objects.Response)20 FIBResponse (org.olat.ims.qti.editor.beecom.objects.FIBResponse)18 ChoiceResponse (org.olat.ims.qti.editor.beecom.objects.ChoiceResponse)16 Mattext (org.olat.ims.qti.editor.beecom.objects.Mattext)16 ChoiceQuestion (org.olat.ims.qti.editor.beecom.objects.ChoiceQuestion)14 List (java.util.List)12 EssayResponse (org.olat.ims.qti.editor.beecom.objects.EssayResponse)12 Question (org.olat.ims.qti.editor.beecom.objects.Question)12 QTIObject (org.olat.ims.qti.editor.beecom.objects.QTIObject)10 FIBQuestion (org.olat.ims.qti.editor.beecom.objects.FIBQuestion)8 Item (org.olat.ims.qti.editor.beecom.objects.Item)8 Iterator (java.util.Iterator)6 VFSItem (org.olat.core.util.vfs.VFSItem)6 Control (org.olat.ims.qti.editor.beecom.objects.Control)6 EssayQuestion (org.olat.ims.qti.editor.beecom.objects.EssayQuestion)6 Element (org.dom4j.Element)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 Feedback (org.olat.ims.qti.editor.beecom.objects.Feedback)4