use of org.olat.ims.qti.container.qtielements.RenderInstructions in project OpenOLAT by OpenOLAT.
the class IQComponentRenderer method displaySectionInfo.
private void displaySectionInfo(StringOutput sb, SectionContext sc, AssessmentInstance ai, IQComponent comp, URLBuilder ubu, Translator translator) {
// display the sectionInfo
if (sc == null)
return;
if (ai.isDisplayTitles())
sb.append("<h3>" + sc.getTitle() + "</h3>");
Objectives objectives = sc.getObjectives();
if (objectives != null) {
StringBuilder sbTmp = new StringBuilder();
Resolver resolver = ai.getResolver();
RenderInstructions ri = new RenderInstructions();
ri.put(RenderInstructions.KEY_STATICS_PATH, resolver.getStaticsBaseURI() + "/");
objectives.render(sbTmp, ri);
sb.append(sbTmp);
}
// if Menu not visible, or if visible but not selectable, and itemPage sequence (one question per page)
// show button to navigate to the first question of the current section
IQMenuDisplayConf menuDisplayConfig = comp.getMenuDisplayConf();
if (!menuDisplayConfig.isEnabledMenu() && menuDisplayConfig.isItemPageSequence()) {
sb.append("<a class=\"btn btn-default\" onclick=\"return o2cl()\" href=\"");
ubu.buildURI(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "git" });
AssessmentContext ac = ai.getAssessmentContext();
int sectionPos = ac.getCurrentSectionContextPos();
sb.append("?itid=" + 0 + "&seid=" + sectionPos);
String title = translator.translate("next");
sb.append("\" title=\"" + StringEscapeUtils.escapeHtml(title) + "\">");
sb.append("<span>").append(title).append("</span>");
sb.append("</a>");
}
}
use of org.olat.ims.qti.container.qtielements.RenderInstructions in project OpenOLAT by OpenOLAT.
the class IQComponentRenderer method displayFeedback.
private void displayFeedback(StringOutput sb, GenericQTIElement feedback, AssessmentInstance ai, Locale locale) {
StringBuilder sbTmp = new StringBuilder();
Resolver resolver = ai.getResolver();
RenderInstructions ri = new RenderInstructions();
ri.put(RenderInstructions.KEY_STATICS_PATH, resolver.getStaticsBaseURI() + "/");
ri.put(RenderInstructions.KEY_LOCALE, locale);
feedback.render(sbTmp, ri);
sb.append(sbTmp);
}
use of org.olat.ims.qti.container.qtielements.RenderInstructions in project openolat by klemens.
the class IQComponentRenderer method displaySectionInfo.
private void displaySectionInfo(StringOutput sb, SectionContext sc, AssessmentInstance ai, IQComponent comp, URLBuilder ubu, Translator translator) {
// display the sectionInfo
if (sc == null)
return;
if (ai.isDisplayTitles())
sb.append("<h3>" + sc.getTitle() + "</h3>");
Objectives objectives = sc.getObjectives();
if (objectives != null) {
StringBuilder sbTmp = new StringBuilder();
Resolver resolver = ai.getResolver();
RenderInstructions ri = new RenderInstructions();
ri.put(RenderInstructions.KEY_STATICS_PATH, resolver.getStaticsBaseURI() + "/");
objectives.render(sbTmp, ri);
sb.append(sbTmp);
}
// if Menu not visible, or if visible but not selectable, and itemPage sequence (one question per page)
// show button to navigate to the first question of the current section
IQMenuDisplayConf menuDisplayConfig = comp.getMenuDisplayConf();
if (!menuDisplayConfig.isEnabledMenu() && menuDisplayConfig.isItemPageSequence()) {
sb.append("<a class=\"btn btn-default\" onclick=\"return o2cl()\" href=\"");
ubu.buildURI(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "git" });
AssessmentContext ac = ai.getAssessmentContext();
int sectionPos = ac.getCurrentSectionContextPos();
sb.append("?itid=" + 0 + "&seid=" + sectionPos);
String title = translator.translate("next");
sb.append("\" title=\"" + StringEscapeUtils.escapeHtml(title) + "\">");
sb.append("<span>").append(title).append("</span>");
sb.append("</a>");
}
}
use of org.olat.ims.qti.container.qtielements.RenderInstructions in project openolat by klemens.
the class IQComponentRenderer method displayAssessmentInfo.
private void displayAssessmentInfo(StringOutput sb, AssessmentContext ac, AssessmentInstance ai, IQComponent comp, URLBuilder ubu, Translator translator) {
Objectives objectives = ac.getObjectives();
if (objectives != null) {
StringBuilder sbTmp = new StringBuilder();
Resolver resolver = ai.getResolver();
RenderInstructions ri = new RenderInstructions();
ri.put(RenderInstructions.KEY_STATICS_PATH, resolver.getStaticsBaseURI() + "/");
objectives.render(sbTmp, ri);
sb.append(sbTmp);
}
// if Menu not visible, or if visible but not selectable show button to navigate to the first section panel
IQMenuDisplayConf menuDisplayConfig = comp.getMenuDisplayConf();
if (!menuDisplayConfig.isEnabledMenu()) {
sb.append("<a class=\"btn btn-default\" onclick=\"return o2cl()\" href=\"");
ubu.buildURI(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "gse" });
sb.append("?seid=" + 0);
String title = translator.translate("next");
sb.append("\" title=\"" + StringEscapeUtils.escapeHtml(title) + "\">");
sb.append("<span>").append(title).append("</span>");
sb.append("</a>");
}
}
use of org.olat.ims.qti.container.qtielements.RenderInstructions in project openolat by klemens.
the class QTIWordExport method renderItem.
public static void renderItem(Item item, OpenXMLDocument document, boolean withResponses, Translator translator) {
Element el = DocumentFactory.getInstance().createElement("dummy");
item.addToElement(el);
Element itemEl = (Element) el.elements().get(0);
org.olat.ims.qti.container.qtielements.Item foo = new org.olat.ims.qti.container.qtielements.Item(itemEl);
RenderInstructions renderInstructions = new RenderInstructions();
renderInstructions.put(RenderInstructions.KEY_STATICS_PATH, "/");
renderInstructions.put(RenderInstructions.KEY_LOCALE, translator.getLocale());
renderInstructions.put(RenderInstructions.KEY_RENDER_TITLE, Boolean.TRUE);
if (item.getQuestion() != null) {
Map<String, String> iinput = new HashMap<String, String>();
String questionType = null;
String questionScore = null;
Question question = item.getQuestion();
if (question instanceof ChoiceQuestion) {
ChoiceQuestion choice = (ChoiceQuestion) question;
if (question.getType() == Question.TYPE_SC) {
questionType = translator.translate("item.type.sc");
fetchPointsOfMultipleChoices(itemEl, choice, iinput);
} else if (question.getType() == Question.TYPE_MC) {
questionType = translator.translate("item.type.mc");
fetchPointsOfMultipleChoices(itemEl, choice, iinput);
} else if (question.getType() == Question.TYPE_KPRIM) {
questionType = translator.translate("item.type.kprim");
fetchPointsOfKPrim(itemEl, choice, iinput);
}
} else if (question instanceof FIBQuestion) {
questionType = translator.translate("item.type.sc");
for (Response response : question.getResponses()) {
FIBResponse fibResponse = (FIBResponse) response;
if ("BLANK".equals(fibResponse.getType())) {
iinput.put(fibResponse.getIdent(), fibResponse.getCorrectBlank());
}
}
} else if (question instanceof EssayQuestion) {
questionType = translator.translate("item.type.essay");
}
if (question != null && question.getMaxValue() > 0.0f) {
questionScore = AssessmentHelper.getRoundedScore(question.getMaxValue());
questionScore = translator.translate("item.score.long", new String[] { questionScore });
}
renderInstructions.put(RenderInstructions.KEY_RENDER_CORRECT_RESPONSES, new Boolean(withResponses));
renderInstructions.put(RenderInstructions.KEY_CORRECT_RESPONSES_MAP, iinput);
renderInstructions.put(RenderInstructions.KEY_QUESTION_TYPE, questionType);
renderInstructions.put(RenderInstructions.KEY_QUESTION_SCORE, questionScore);
renderInstructions.put(RenderInstructions.KEY_QUESTION_OO_TYPE, new Integer(question.getType()));
}
foo.renderOpenXML(document, renderInstructions);
}
Aggregations