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);
}
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);
}
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);
}
}
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);
}
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);
}
Aggregations