use of org.olat.core.util.Formatter in project openolat by klemens.
the class HistoryController method updateChangeLog.
protected void updateChangeLog() {
Date date = dateChooser.getDate();
List<SubscriptionListItem> items = notificationsHandler.getAllItems(binder, secCallback, date, getLocale());
Formatter formatter = Formatter.getInstance(getLocale());
List<SubscriptionListItemWrapper> wrappers = new ArrayList<>(items.size());
for (SubscriptionListItem item : items) {
String dateString = formatter.formatDate(item.getDate());
String linkName = "subscrIL_" + (counter++);
String linkLabel = StringHelper.escapeHtml(item.getDescription());
FormLink link = uifactory.addFormLink(linkName, linkLabel, null, flc, Link.NONTRANSLATED);
link.setUserObject(item.getBusinessPath());
SubscriptionListItemWrapper bundle = new SubscriptionListItemWrapper(linkName, dateString, item.getIconCssClass());
wrappers.add(bundle);
}
flc.contextPut("subscriptionItems", wrappers);
}
use of org.olat.core.util.Formatter in project openolat by klemens.
the class PaypalTransactionDetailsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
Formatter format = Formatter.getInstance(getLocale());
String ack = transaction.getAck();
uifactory.addStaticTextElement("ack", "paypal.transaction.ack", ack, formLayout);
String execStatus = transaction.getPaymentExecStatus();
uifactory.addStaticTextElement("exec.status", "paypal.transaction.exec.status", execStatus, formLayout);
Date respDate = transaction.getPayResponseDate();
String respDateStr = format.formatDateAndTime(respDate);
uifactory.addStaticTextElement("resp.date", "paypal.transaction.response.date", respDateStr, formLayout);
Price securePrice = transaction.getSecurePrice();
String securePriceStr = PriceFormat.fullFormat(securePrice);
uifactory.addStaticTextElement("amount", "paypal.transaction.amount", securePriceStr, formLayout);
uifactory.addSpacerElement("ipn-spacer", formLayout, false);
String transactionId = transaction.getTransactionId();
uifactory.addStaticTextElement("trx-id", "paypal.transaction.id", removeNull(transactionId), formLayout);
String trxStatus = transaction.getTransactionStatus();
uifactory.addStaticTextElement("trx-status", "paypal.transaction.status", removeNull(trxStatus), formLayout);
String senderTransactionId = transaction.getSenderTransactionId();
uifactory.addStaticTextElement("trx-sender-id", "paypal.transaction.sender.id", removeNull(senderTransactionId), formLayout);
String senderTrxStatus = transaction.getSenderTransactionStatus();
uifactory.addStaticTextElement("trx-sender-status", "paypal.transaction.sender.status", removeNull(senderTrxStatus), formLayout);
String pendingReason = transaction.getPendingReason();
uifactory.addStaticTextElement("trx-pending-reason", "paypal.transaction.pending.reason", removeNull(pendingReason), formLayout);
String senderEmail = transaction.getSenderEmail();
uifactory.addStaticTextElement("trx-sender", "paypal.transaction.sender", removeNull(senderEmail), formLayout);
}
use of org.olat.core.util.Formatter in project openolat by klemens.
the class MemberInfoController method setMembershipCreation.
public void setMembershipCreation(Date date) {
if (date != null) {
Formatter formatter = Formatter.getInstance(getLocale());
membershipCreationEl.setValue(formatter.formatDate(date));
}
}
use of org.olat.core.util.Formatter in project openolat by klemens.
the class LecturesBlockSignaturePDFExport 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);
}
}
use of org.olat.core.util.Formatter in project openolat by klemens.
the class LecturesBlockSignaturePDFExport method create.
public void create(List<Identity> rows) throws IOException, TransformerException {
addPage();
String lectureBlockTitle = lectureBlock.getTitle();
String resourceTitle = entry.getDisplayname();
addMetadata(lectureBlockTitle, resourceTitle, teacher);
String title = resourceTitle + " - " + lectureBlockTitle;
title = translator.translate("attendance.list.to.sign.title", new String[] { title });
addParagraph(title, 16, true, width);
Formatter formatter = Formatter.getInstance(translator.getLocale());
String dates = translator.translate("pdf.table.dates", new String[] { formatter.formatDate(lectureBlock.getStartDate()), formatter.formatTimeShort(lectureBlock.getStartDate()), formatter.formatTimeShort(lectureBlock.getEndDate()) });
addParagraph(dates, 12, true, width);
float cellMargin = 5.0f;
float fontSize = 10.0f;
String[] content = getRows(rows);
int numOfRows = content.length;
for (int offset = 0; offset < numOfRows; ) {
offset += drawTable(content, offset, fontSize, cellMargin);
closePage();
if (offset < numOfRows) {
addPage();
}
}
addPageNumbers();
}
Aggregations