use of uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method createModalFeedback.
public static ModalFeedback createModalFeedback(AssessmentItem assessmentItem, Identifier outcomeIdentifier, Identifier identifier, String title, String text) {
/*
<modalFeedback identifier="Feedback1041659806" outcomeIdentifier="FEEDBACKMODAL" showHide="show" title="Wrong answer">
<p>Feedback answer</p>
</modalFeedback>
*/
ModalFeedback modalFeedback = new ModalFeedback(assessmentItem);
modalFeedback.setIdentifier(identifier);
modalFeedback.setOutcomeIdentifier(outcomeIdentifier);
modalFeedback.setVisibilityMode(VisibilityMode.parseVisibilityMode("show"));
modalFeedback.getAttributes().getStringAttribute(ModalFeedback.ATTR_TITLE_NAME).setValue(title);
new AssessmentHtmlBuilder().appendHtml(modalFeedback, text);
return modalFeedback;
}
use of uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback in project OpenOLAT by OpenOLAT.
the class QTI21WordExport method renderCorrectSolutionForWord.
private static void renderCorrectSolutionForWord(AssessmentItem item, OpenXMLDocument document, Translator translator, AssessmentHtmlBuilder htmlBuilder) {
List<ModalFeedback> feedbacks = item.getModalFeedbacks();
if (feedbacks != null && feedbacks.size() > 0) {
for (ModalFeedback feedback : feedbacks) {
if (feedback.getOutcomeIdentifier() != null && QTI21Constants.CORRECT_SOLUTION_IDENTIFIER.equals(feedback.getOutcomeIdentifier())) {
Attribute<?> title = feedback.getAttributes().get("title");
String feedbackTitle = null;
if (title != null && title.getValue() != null) {
feedbackTitle = title.getValue().toString();
}
if (!StringHelper.containsNonWhitespace(feedbackTitle)) {
feedbackTitle = translator.translate("correct.solution");
}
document.appendHeading2(feedbackTitle, null);
String html = htmlBuilder.flowStaticString(feedback.getFlowStatics());
document.appendHtmlText(html, true);
}
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback in project OpenOLAT by OpenOLAT.
the class AlienItemAnalyzer method checkFeedbackModalResponseProcessing.
private void checkFeedbackModalResponseProcessing(Report report) {
if (report.getType() != QTI21QuestionType.unkown) {
boolean allOk = true;
List<ModalFeedback> feedbacks = item.getModalFeedbacks();
for (ModalFeedback feedback : feedbacks) {
ModalFeedbackBuilder feedbackBuilder = new ModalFeedbackBuilder(item, feedback);
if (feedbackBuilder.isCorrectRule() || feedbackBuilder.isIncorrectRule()) {
// ok
} else if (feedbackBuilder.isCorrectSolutionRule() || (feedback.getOutcomeIdentifier() != null && QTI21Constants.CORRECT_SOLUTION_IDENTIFIER.equals(feedback.getOutcomeIdentifier()))) {
// ok
} else if (feedbackBuilder.isEmptyRule() || feedbackBuilder.isAnsweredRule() || feedbackBuilder.isHint()) {
// ok
} else {
List<ModalFeedbackCondition> conditions = feedbackBuilder.getFeedbackConditons();
if (conditions == null || conditions.isEmpty()) {
allOk &= false;
}
}
}
if (!allOk) {
report.addWarning(ReportWarningEnum.unsupportedFeedbacks);
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback in project OpenOLAT by OpenOLAT.
the class AlienItemAnalyzer method checkFeedback.
private void checkFeedback(Report report) {
if (item.getModalFeedbacks() != null && item.getModalFeedbacks().size() > 0) {
Set<Identifier> outcomeIdentifiers = new HashSet<>();
List<ModalFeedback> feedbacks = item.getModalFeedbacks();
for (ModalFeedback feedback : feedbacks) {
if (feedback.getOutcomeIdentifier() != null) {
outcomeIdentifiers.add(feedback.getOutcomeIdentifier());
}
}
if (outcomeIdentifiers.size() == 1) {
if (outcomeIdentifiers.iterator().next().equals(QTI21Constants.FEEDBACKMODAL_IDENTIFIER)) {
checkFeedbackModalResponseProcessing(report);
} else {
report.addWarning(ReportWarningEnum.alienFeedbacks);
}
} else {
// Onyx and OpenOLAT only use one outcome identifier for the feedbacks
// Taotesting use several different identifiers. And we don't
// understand feedbacks without outcome identifiers
report.addWarning(ReportWarningEnum.alienFeedbacks);
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback in project OpenOLAT by OpenOLAT.
the class AssessmentItemBuilder method build.
public final void build() {
List<OutcomeDeclaration> outcomeDeclarations = assessmentItem.getOutcomeDeclarations();
outcomeDeclarations.clear();
ResponseProcessing responseProcessing = assessmentItem.getResponseProcessing();
List<ResponseRule> responseRules = responseProcessing.getResponseRules();
responseRules.clear();
List<ResponseDeclaration> responseDeclarations = assessmentItem.getResponseDeclarations();
responseDeclarations.clear();
List<ModalFeedback> modalFeedbacks = assessmentItem.getModalFeedbacks();
modalFeedbacks.clear();
buildItemBody();
buildResponseAndOutcomeDeclarations();
buildModalFeedbacksAndHints(outcomeDeclarations, responseRules);
buildMinMaxScores(outcomeDeclarations, responseRules);
buildMainScoreRule(outcomeDeclarations, responseRules);
buildHint(outcomeDeclarations, responseRules);
}
Aggregations