use of org.olat.ims.qti21.model.xml.AssessmentHtmlBuilder in project openolat by klemens.
the class QTI21WordExport method renderAssessmentItem.
public static void renderAssessmentItem(AssessmentItem item, File itemFile, File mediaDir, OpenXMLDocument document, boolean withResponses, Translator translator, AssessmentHtmlBuilder htmlBuilder) {
StringBuilder addText = new StringBuilder();
QTI21QuestionType type = QTI21QuestionType.getType(item);
String typeDescription = "";
switch(type) {
case sc:
typeDescription = translator.translate("form.choice");
break;
case mc:
typeDescription = translator.translate("form.choice");
break;
case fib:
typeDescription = translator.translate("form.fib");
break;
case numerical:
typeDescription = translator.translate("form.fib");
break;
case kprim:
typeDescription = translator.translate("form.kprim");
break;
case hotspot:
typeDescription = translator.translate("form.hotspot");
break;
case essay:
typeDescription = translator.translate("form.essay");
break;
case upload:
typeDescription = translator.translate("form.upload");
break;
case drawing:
typeDescription = translator.translate("form.drawing");
break;
case match:
typeDescription = translator.translate("form.match");
break;
default:
typeDescription = null;
break;
}
Double maxScore = QtiNodesExtractor.extractMaxScore(item);
if (StringHelper.containsNonWhitespace(typeDescription) || maxScore != null) {
if (StringHelper.containsNonWhitespace(typeDescription)) {
addText.append("(").append(typeDescription).append(")");
}
if (maxScore != null) {
addText.append(" - ").append(AssessmentHelper.getRoundedScore(maxScore));
}
}
String title = item.getTitle();
document.appendHeading1(title, addText.toString());
List<Block> itemBodyBlocks = item.getItemBody().getBlocks();
String html = htmlBuilder.blocksString(itemBodyBlocks);
document.appendHtmlText(html, true, new QTI21AndHTMLToOpenXMLHandler(document, item, itemFile, mediaDir, withResponses, htmlBuilder, translator));
if (withResponses && (type == QTI21QuestionType.essay || type == QTI21QuestionType.upload || type == QTI21QuestionType.drawing)) {
renderCorrectSolutionForWord(item, document, translator, htmlBuilder);
}
}
Aggregations