use of org.olat.core.util.Formatter in project openolat by klemens.
the class TechnicalMetadataEditController method updateUI.
private void updateUI() {
String editor = item.getEditor() == null ? "" : item.getEditor();
editorEl.setValue(editor);
String editorVersion = item.getEditorVersion() == null ? "" : item.getEditorVersion();
editorVersionEl.setValue(editorVersion);
String format = item.getFormat() == null ? "" : item.getFormat();
formatEl.setValue(format);
Formatter formatter = Formatter.getInstance(getLocale());
String lastModified = formatter.formatDateAndTime(item.getLastModified());
lastModifiedEl.setValue(lastModified);
versionEl.setValue(item.getItemVersion());
String statusLastModified = formatter.formatDateAndTime(item.getQuestionStatusLastModified());
statusLastModified = statusLastModified != null ? statusLastModified : "";
statusLastMdifiedEl.setValue(statusLastModified);
}
use of org.olat.core.util.Formatter in project openolat by klemens.
the class TechnicalMetadataEditController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
uifactory.addStaticTextElement("general.identifier", item.getIdentifier(), formLayout);
uifactory.addStaticTextElement("general.master.identifier", item.getMasterIdentifier(), formLayout);
editorEl = uifactory.addStaticTextElement("technical.editor", "", formLayout);
editorVersionEl = uifactory.addStaticTextElement("technical.editorVersion", "", formLayout);
formatEl = uifactory.addStaticTextElement("technical.format", "", formLayout);
Formatter formatter = Formatter.getInstance(getLocale());
String creationDate = formatter.formatDateAndTime(item.getCreationDate());
uifactory.addStaticTextElement("technical.creation", creationDate, formLayout);
lastModifiedEl = uifactory.addStaticTextElement("technical.lastModified", "", formLayout);
versionEl = uifactory.addTextElement("lifecycle.version", "lifecycle.version", 50, "", formLayout);
statusLastMdifiedEl = uifactory.addStaticTextElement("technical.statusLastModified", "", formLayout);
buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
buttonsCont.setRootForm(mainForm);
formLayout.add(buttonsCont);
uifactory.addFormSubmitButton("ok", "ok", buttonsCont);
uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
}
use of org.olat.core.util.Formatter in project openolat by klemens.
the class LectureBlockAuditLogExport method addHeaders.
@Override
protected void addHeaders(OpenXMLWorksheet exportSheet) {
Row headerRow = exportSheet.newRow();
int pos = 0;
headerRow.addCell(pos++, translator.translate("export.header.entry", new String[] { entry.getDisplayname() }));
Formatter formatter = Formatter.getInstance(translator.getLocale());
String[] args = new String[] { lectureBlock.getTitle(), formatter.formatDate(lectureBlock.getStartDate()), formatter.formatTimeShort(lectureBlock.getStartDate()), formatter.formatTimeShort(lectureBlock.getEndDate()) };
headerRow.addCell(pos++, translator.translate("export.header.lectureblocks", args));
}
use of org.olat.core.util.Formatter in project openolat by klemens.
the class LectureBlockExport method addHeaders_1.
private void addHeaders_1(OpenXMLWorksheet exportSheet) {
Row headerRow = exportSheet.newRow();
int pos = 0;
Formatter formatter = Formatter.getInstance(translator.getLocale());
String[] args = new String[] { lectureBlock.getTitle(), formatter.formatDate(lectureBlock.getStartDate()), formatter.formatTimeShort(lectureBlock.getStartDate()), formatter.formatTimeShort(lectureBlock.getEndDate()) };
headerRow.addCell(pos, translator.translate("export.header.lectureblocks", args));
if (isAdministrativeUser) {
pos++;
}
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null)
continue;
pos++;
}
if (teachers != null && teachers.size() > 0) {
StringBuilder sb = new StringBuilder();
for (Identity teacher : teachers) {
if (sb.length() > 0)
sb.append(", ");
sb.append(userManager.getUserDisplayName(teacher));
}
headerRow.addCell(pos, translator.translate("export.header.teachers", new String[] { sb.toString() }));
}
if (StringHelper.containsNonWhitespace(lectureBlock.getLocation())) {
pos += lectureBlock.getPlannedLecturesNumber();
headerRow.addCell(pos, translator.translate("export.header.location", new String[] { lectureBlock.getLocation() }));
}
}
use of org.olat.core.util.Formatter in project openolat by klemens.
the class LecturesBlockPDFExport method prepare.
@Override
public void prepare(HttpServletResponse hres) {
try {
Formatter formatter = Formatter.getInstance(translator.getLocale());
String filename = lectureBlock.getTitle() + "_" + formatter.formatDate(lectureBlock.getStartDate()) + "_" + formatter.formatTimeShort(lectureBlock.getStartDate()) + "-" + formatter.formatTimeShort(lectureBlock.getEndDate()) + ".pdf";
hres.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + StringHelper.urlEncodeUTF8(filename));
hres.setHeader("Content-Description", StringHelper.urlEncodeUTF8(filename));
document.save(hres.getOutputStream());
} catch (COSVisitorException | IOException e) {
log.error("", e);
}
}
Aggregations