Search in sources :

Example 21 with ModalFeedback

use of uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback in project OpenOLAT by OpenOLAT.

the class AssessmentItemBuilder method appendCorrectSolutionAndIncorrectModalFeedback.

protected void appendCorrectSolutionAndIncorrectModalFeedback(List<ModalFeedback> modalFeedbacks, List<ResponseRule> responseRules) {
    Identifier correctSolutionFeedbackIdentifier = null;
    if (correctSolutionFeedback != null) {
        correctSolutionFeedbackIdentifier = correctSolutionFeedback.getIdentifier();
        ModalFeedback modalFeedback = AssessmentItemFactory.createModalFeedback(assessmentItem, QTI21Constants.CORRECT_SOLUTION_IDENTIFIER, correctSolutionFeedback.getIdentifier(), correctSolutionFeedback.getTitle(), correctSolutionFeedback.getText());
        modalFeedbacks.add(modalFeedback);
    }
    Identifier incorrectFeedbackIdentifier = null;
    if (incorrectFeedback != null) {
        incorrectFeedbackIdentifier = incorrectFeedback.getIdentifier();
        ModalFeedback modalFeedback = AssessmentItemFactory.createModalFeedback(assessmentItem, incorrectFeedback.getIdentifier(), incorrectFeedback.getTitle(), incorrectFeedback.getText());
        modalFeedbacks.add(modalFeedback);
    }
    ResponseCondition feedbackCondition = AssessmentItemFactory.createCorrectSolutionModalFeedbackBasicRule(assessmentItem.getResponseProcessing(), correctSolutionFeedbackIdentifier, incorrectFeedbackIdentifier, hint != null);
    responseRules.add(feedbackCondition);
}
Also used : Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) ModalFeedback(uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback) ResponseCondition(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)

Example 22 with ModalFeedback

use of uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback in project OpenOLAT by OpenOLAT.

the class AssessmentItemBuilder method buildHint.

/**
 * @param outcomeDeclarations
 * @param responseRules
 */
protected void buildHint(List<OutcomeDeclaration> outcomeDeclarations, List<ResponseRule> responseRules) {
    if (hint == null)
        return;
    // response declaration -> identifier=HINTREQUEST -> for the end attempt interaction
    ResponseDeclaration hintResponseDeclaration = AssessmentItemFactory.createHintRequestResponseDeclaration(assessmentItem);
    assessmentItem.getResponseDeclarations().add(hintResponseDeclaration);
    // outcome declaration -> identifier=HINTFEEDBACKMODAL -> for processing and feedback
    OutcomeDeclaration modalOutcomeDeclaration = AssessmentItemFactory.createOutcomeDeclarationForHint(assessmentItem);
    outcomeDeclarations.add(modalOutcomeDeclaration);
    // the body
    P paragraph = new P(assessmentItem.getItemBody());
    assessmentItem.getItemBody().getBlocks().add(paragraph);
    EndAttemptInteraction endAttemptInteraction = new EndAttemptInteraction(paragraph);
    endAttemptInteraction.setResponseIdentifier(QTI21Constants.HINT_REQUEST_IDENTIFIER);
    endAttemptInteraction.setTitle(hint.getTitle());
    paragraph.getInlines().add(endAttemptInteraction);
    // the feedback
    ModalFeedback emptyModalFeedback = AssessmentItemFactory.createModalFeedback(assessmentItem, QTI21Constants.HINT_FEEDBACKMODAL_IDENTIFIER, QTI21Constants.HINT_IDENTIFIER, hint.getTitle(), hint.getText());
    assessmentItem.getModalFeedbacks().add(emptyModalFeedback);
    // the response processing
    ResponseCondition rule = new ResponseCondition(assessmentItem.getResponseProcessing());
    responseRules.add(0, rule);
    ResponseIf responseIf = new ResponseIf(rule);
    rule.setResponseIf(responseIf);
    /*
		<responseIf>
			<variable identifier="HINTREQUEST"/>
			<setOutcomeValue identifier="FEEDBACK">
				<baseValue baseType="identifier">HINT</baseValue>
			</setOutcomeValue>
  		</responseIf>
		*/
    Variable variable = new Variable(responseIf);
    variable.setIdentifier(QTI21Constants.HINT_REQUEST_CLX_IDENTIFIER);
    responseIf.getExpressions().add(variable);
    SetOutcomeValue hintVar = new SetOutcomeValue(responseIf);
    hintVar.setIdentifier(QTI21Constants.HINT_FEEDBACKMODAL_IDENTIFIER);
    BaseValue hintVal = new BaseValue(hintVar);
    hintVal.setBaseTypeAttrValue(BaseType.IDENTIFIER);
    hintVal.setSingleValue(new IdentifierValue(QTI21Constants.HINT));
    hintVar.setExpression(hintVal);
    responseIf.getResponseRules().add(hintVar);
}
Also used : P(uk.ac.ed.ph.jqtiplus.node.content.xhtml.text.P) Variable(uk.ac.ed.ph.jqtiplus.node.expression.general.Variable) EndAttemptInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.EndAttemptInteraction) SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue) BaseValue(uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue) ModalFeedback(uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback) ResponseIf(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf) IdentifierValue(uk.ac.ed.ph.jqtiplus.value.IdentifierValue) ResponseDeclaration(uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration) OutcomeDeclaration(uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration) ResponseCondition(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)

Example 23 with ModalFeedback

use of uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback in project openolat by klemens.

the class LobAssessmentItemBuilder method appendCorrectSolutionAndIncorrectModalFeedback.

@Override
protected void appendCorrectSolutionAndIncorrectModalFeedback(List<ModalFeedback> modalFeedbacks, List<ResponseRule> responseRules) {
    if (correctSolutionFeedback != null) {
        ModalFeedback modalFeedback = AssessmentItemFactory.createModalFeedback(assessmentItem, QTI21Constants.CORRECT_SOLUTION_IDENTIFIER, correctSolutionFeedback.getIdentifier(), correctSolutionFeedback.getTitle(), correctSolutionFeedback.getText());
        modalFeedbacks.add(modalFeedback);
    }
}
Also used : ModalFeedback(uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback)

Example 24 with ModalFeedback

use of uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback in project openolat by klemens.

the class AssessmentItemBuilder method appendModalFeedback.

protected void appendModalFeedback(ModalFeedbackBuilder feedbackBuilder, String inCorrect, List<ModalFeedback> modalFeedbacks, List<ResponseRule> responseRules) {
    ModalFeedback modalFeedback = AssessmentItemFactory.createModalFeedback(assessmentItem, feedbackBuilder.getIdentifier(), feedbackBuilder.getTitle(), feedbackBuilder.getText());
    modalFeedbacks.add(modalFeedback);
    ResponseCondition feedbackCondition = AssessmentItemFactory.createModalFeedbackBasicRule(assessmentItem.getResponseProcessing(), feedbackBuilder.getIdentifier(), inCorrect, hint != null);
    responseRules.add(feedbackCondition);
}
Also used : ModalFeedback(uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback) ResponseCondition(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)

Example 25 with ModalFeedback

use of uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback in project openolat by klemens.

the class AssessmentItemBuilder method appendCorrectSolutionAndIncorrectModalFeedback.

protected void appendCorrectSolutionAndIncorrectModalFeedback(List<ModalFeedback> modalFeedbacks, List<ResponseRule> responseRules) {
    Identifier correctSolutionFeedbackIdentifier = null;
    if (correctSolutionFeedback != null) {
        correctSolutionFeedbackIdentifier = correctSolutionFeedback.getIdentifier();
        ModalFeedback modalFeedback = AssessmentItemFactory.createModalFeedback(assessmentItem, QTI21Constants.CORRECT_SOLUTION_IDENTIFIER, correctSolutionFeedback.getIdentifier(), correctSolutionFeedback.getTitle(), correctSolutionFeedback.getText());
        modalFeedbacks.add(modalFeedback);
    }
    Identifier incorrectFeedbackIdentifier = null;
    if (incorrectFeedback != null) {
        incorrectFeedbackIdentifier = incorrectFeedback.getIdentifier();
        ModalFeedback modalFeedback = AssessmentItemFactory.createModalFeedback(assessmentItem, incorrectFeedback.getIdentifier(), incorrectFeedback.getTitle(), incorrectFeedback.getText());
        modalFeedbacks.add(modalFeedback);
    }
    ResponseCondition feedbackCondition = AssessmentItemFactory.createCorrectSolutionModalFeedbackBasicRule(assessmentItem.getResponseProcessing(), correctSolutionFeedbackIdentifier, incorrectFeedbackIdentifier, hint != null);
    responseRules.add(feedbackCondition);
}
Also used : Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) ModalFeedback(uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback) ResponseCondition(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)

Aggregations

ModalFeedback (uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback)30 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)10 ResponseCondition (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)8 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)6 OutcomeDeclaration (uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)6 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)6 ResponseDeclaration (uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration)4 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)4 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 ModalFeedbackType (org.olat.ims.qti21.model.xml.ModalFeedbackBuilder.ModalFeedbackType)2 P (uk.ac.ed.ph.jqtiplus.node.content.xhtml.text.P)2 BaseValue (uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue)2 Variable (uk.ac.ed.ph.jqtiplus.node.expression.general.Variable)2 EndAttemptInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.EndAttemptInteraction)2 Interaction (uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction)2 ResponseIf (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf)2 ResponseProcessing (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing)2 ResponseRule (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseRule)2