use of org.olat.core.gui.render.StringOutput in project openolat by klemens.
the class AssessmentSessionAuditOLog method logCandidateOutcomes.
@Override
public void logCandidateOutcomes(AssessmentTestSession candidateSession, Map<Identifier, String> outcomes) {
try {
StringOutput sb = new StringOutput(255);
AuditLogFormatter.logOutcomes(outcomes, sb);
log.audit("", sb.toString());
} catch (IOException e) {
log.error("", e);
}
}
use of org.olat.core.gui.render.StringOutput in project openolat by klemens.
the class AssessmentSessionAuditOLog method logCandidateEvent.
@Override
public void logCandidateEvent(CandidateEvent candidateEvent, Map<Identifier, AssessmentResponse> candidateResponseMap) {
try {
StringOutput sb = new StringOutput(255);
AuditLogFormatter.log(candidateEvent, candidateResponseMap, sb);
log.audit("", sb.toString());
} catch (IOException e) {
log.error("", e);
}
}
use of org.olat.core.gui.render.StringOutput in project openolat by klemens.
the class AssessmentSessionAuditOLog method logCorrection.
@Override
public void logCorrection(AssessmentTestSession candidateSession, AssessmentItemSession itemSession, Identity coach) {
try {
StringOutput sb = new StringOutput(255);
sb.append("Test session ").append(candidateSession.getKey()).append(" (assessed identity=");
if (candidateSession.getIdentity() != null) {
sb.append(candidateSession.getIdentity().getKey()).append("/").append(candidateSession.getIdentity().getName());
} else {
sb.append(candidateSession.getAnonymousIdentifier());
}
sb.append(" ");
AuditLogFormatter.logCorrection(itemSession, coach, sb);
log.audit("", sb.toString());
} catch (IOException e) {
log.error("", e);
}
}
use of org.olat.core.gui.render.StringOutput in project openolat by klemens.
the class IQComponentRenderer method addItemLink.
private StringOutput addItemLink(Renderer r, URLBuilder ubu, Formatter formatter, AssessmentInstance ai, ItemContext itc, int sectionPos, int itemPos, boolean clickable, boolean active, boolean info) {
StringOutput sb = new StringOutput();
sb.append("<td>");
String titleNotEscaped = itc.getEl_item().attributeValue("title", "no title");
String titleShort = StringHelper.escapeHtml(Formatter.truncate(titleNotEscaped, 27));
long maxdur = itc.getDurationLimit();
long start = itc.getTimeOfStart();
long due = start + maxdur;
boolean started = (start != -1);
boolean timelimit = (maxdur != -1);
String fdue = (started && timelimit ? formatter.formatTimeShort(new Date(due)) : null);
if (active) {
sb.append("<div class=\"o_qti_menu_item_active\">");
} else {
if (itc.isOpen() && clickable) {
sb.append("<div class=\"o_qti_menu_item\">");
} else {
sb.append("<div class=\"o_qti_menu_item_inactive\">");
}
}
if (clickable) {
sb.append("<a onclick=\"return o2cl();\" href=\"");
ubu.buildURI(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "git" });
sb.append("?itid=" + itemPos + "&seid=" + sectionPos);
sb.append("\" class=\"o_sel_qti_menu_item\" title=\"" + StringEscapeUtils.escapeHtml(titleNotEscaped) + "\">");
}
sb.append("<b>" + (sectionPos + 1) + "." + (itemPos + 1) + ".</b> ");
sb.append(titleShort);
if (clickable) {
sb.append("</a>");
}
sb.append("</div>");
sb.append("</td>");
if (!itc.isOpen()) {
// no time limit symbol
sb.append("<td></td>");
// add lock image
sb.append("<td>");
sb.append("<div class='o_qti_closed_icon' title=\"");
sb.append(StringEscapeUtils.escapeHtml(r.getTranslator().translate("itemclosed")));
sb.append("\"><i class='o_icon o_icon_locked'> </i></div>");
sb.append("</td>");
} else if (info) {
// max duration info
sb.append("<td>");
if (maxdur != -1) {
sb.append("<div class='o_qti_timelimit_icon' title=\"");
if (!itc.isStarted()) {
sb.append(StringEscapeUtils.escapeHtml(r.getTranslator().translate("timelimit.initial", new String[] { getFormattedLimit(maxdur) })));
} else {
sb.append(StringEscapeUtils.escapeHtml(r.getTranslator().translate("timelimit.running", new String[] { fdue })));
}
sb.append("\" ><i class='o_icon o_icon_timelimit'> </i></div>");
}
sb.append("</td>");
sb.append("<td>");
// attempts info
int maxa = itc.getMaxAttempts();
int attempts = itc.getTimesAnswered();
if (maxa != -1) {
// only limited times of answers
sb.append("<div class='o_qti_attemptslimit_icon' title=\"");
sb.append(StringEscapeUtils.escapeHtml(r.getTranslator().translate("attemptsleft", new String[] { "" + (maxa - attempts) })));
sb.append("\" ><i class='o_icon o_icon_attempt_limit'> </i></div>");
}
sb.append("</td>");
}
sb.append("<td>");
sb.append("<div id=\"" + itc.getIdent() + "\" class=\"o_qti_menu_item_attempts");
String t = Integer.toString(itc.getTimesAnswered());
String n = r.getTranslator().translate("qti.marker.title", new String[] { t });
String m = r.getTranslator().translate("qti.marker.title.marked", new String[] { t });
if (ai.isMarked(itc.getIdent())) {
sb.append("_marked");
}
sb.append("\" onclick=\"mark(this, '").append(n).append("','").append(m).append("')\" ");
sb.append("title=\"");
sb.append(ai.isMarked(itc.getIdent()) ? m : n);
sb.append("\">");
sb.append(t);
sb.append(" </div></td>");
return sb;
}
use of org.olat.core.gui.render.StringOutput in project openolat by klemens.
the class IQComponentRenderer method addSectionLink.
// menu stuff
private StringOutput addSectionLink(Renderer r, URLBuilder ubu, Formatter formatter, SectionContext sc, int sectionPos, boolean clickable, boolean active, boolean pagewise) {
StringOutput sb = new StringOutput();
// section link
sb.append("<td>");
String title = StringHelper.escapeHtml(Formatter.truncate(sc.getTitle(), 30));
long maxdur = sc.getDurationLimit();
long start = sc.getTimeOfStart();
long due = start + maxdur;
boolean started = (start != -1);
boolean timelimit = (maxdur != -1);
String fdue = (started && timelimit ? formatter.formatTimeShort(new Date(due)) : null);
if (!sc.isOpen())
clickable = false;
if (active) {
if (pagewise) {
sb.append("<div class=\"o_qti_menu_section_active\">");
} else {
sb.append("<div class=\"o_qti_menu_section\">");
}
} else {
if (pagewise) {
sb.append("<div class=\"o_qti_menu_section_clickable\">");
} else {
sb.append("<div class=\"o_qti_menu_section\">");
}
}
if (clickable) {
sb.append("<a onclick=\"return o2cl()\" href=\"");
ubu.buildURI(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "gse" });
sb.append("?seid=" + sectionPos);
sb.append("\" title=\"" + StringEscapeUtils.escapeHtml(sc.getTitle()) + "\">");
}
sb.append("<b>" + (sectionPos + 1) + ".</b> ");
sb.append(title);
if (clickable) {
sb.append("</a>");
}
sb.append("</div>");
sb.append("</td>");
sb.append("<td>");
if (!sc.isOpen()) {
sb.append("<div class='o_qti_closed_icon' title=\"");
sb.append(StringEscapeUtils.escapeHtml(r.getTranslator().translate("itemclosed")));
sb.append("\"><i class='o_icon o_icon_locked'> </i></div>");
} else {
// max duration info
if (maxdur != -1) {
sb.append("<div class='o_qti_timelimit_icon' title=\"");
if (!sc.isStarted()) {
sb.append(StringEscapeUtils.escapeHtml(r.getTranslator().translate("timelimit.initial", new String[] { getFormattedLimit(maxdur) })));
} else {
sb.append(StringEscapeUtils.escapeHtml(r.getTranslator().translate("timelimit.running", new String[] { fdue })));
}
sb.append("\" ><i class='o_icon o_icon_timelimit'> </i></div>");
}
}
sb.append("</td>");
sb.append("<td colspan=\"2\"></td>");
return sb;
}
Aggregations