Search in sources :

Example 36 with Row

use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.

the class ChatLogHelper method logMediaResource.

public MediaResource logMediaResource(OLATResourceable ores, Locale locale) {
    Translator translator = Util.createPackageTranslator(ChatController.class, locale);
    String tableExportTitle = translator.translate("logChat.export.title");
    String label = tableExportTitle + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis())) + ".xlsx";
    return new OpenXMLWorkbookResource(label) {

        @Override
        protected void generate(OutputStream out) {
            try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1)) {
                // headers
                OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
                Row headerRow = exportSheet.newRow();
                headerRow.addCell(0, "User", workbook.getStyles().getHeaderStyle());
                headerRow.addCell(1, "Date", workbook.getStyles().getHeaderStyle());
                headerRow.addCell(2, "Content", workbook.getStyles().getHeaderStyle());
                // content
                List<InstantMessage> messages = imDao.getMessages(ores, null, 0, -1);
                for (InstantMessage message : messages) {
                    Row dataRow = exportSheet.newRow();
                    dataRow.addCell(0, message.getFromNickName(), null);
                    dataRow.addCell(1, message.getCreationDate(), workbook.getStyles().getDateStyle());
                    dataRow.addCell(2, message.getBody(), null);
                }
            } catch (IOException e) {
                log.error("", e);
            }
        }
    };
}
Also used : Translator(org.olat.core.gui.translator.Translator) OpenXMLWorkbookResource(org.olat.core.util.openxml.OpenXMLWorkbookResource) ObjectOutputStream(java.io.ObjectOutputStream) OutputStream(java.io.OutputStream) InstantMessage(org.olat.instantMessaging.InstantMessage) OpenXMLWorkbook(org.olat.core.util.openxml.OpenXMLWorkbook) Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row) IOException(java.io.IOException) OpenXMLWorksheet(org.olat.core.util.openxml.OpenXMLWorksheet) Date(java.util.Date)

Example 37 with Row

use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.

the class XlsMembersExport method createData.

private void createData(Map<Identity, StringBuilder> members, List<Identity> rows, List<UserPropertyHandler> userPropertyHandlers, OpenXMLWorksheet sheet) {
    sheet.setHeaderRows(1);
    for (int r = 0; r < rows.size(); r++) {
        Row dataRow = sheet.newRow();
        for (int c = 0; c < userPropertyHandlers.size(); c++) {
            String value = userPropertyHandlers.get(c).getUserProperty(rows.get(r).getUser(), null);
            dataRow.addCell(c, value, null);
        }
        dataRow.addCell(userPropertyHandlers.size(), members.get(rows.get(r)).toString());
    }
}
Also used : Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row)

Example 38 with Row

use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.

the class IdentityAuditLogExport method addHeaders.

@Override
protected void addHeaders(OpenXMLWorksheet exportSheet) {
    Row headerRow = exportSheet.newRow();
    int pos = 0;
    headerRow.addCell(pos++, userManager.getUserDisplayName(identity));
}
Also used : Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row)

Example 39 with Row

use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.

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));
}
Also used : Formatter(org.olat.core.util.Formatter) Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row)

Example 40 with Row

use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.

the class LecturesBlocksEntryExport method addHeaders.

private void addHeaders(OpenXMLWorksheet exportSheet) {
    Row headerRow = exportSheet.newRow();
    int pos = 0;
    headerRow.addCell(pos++, translator.translate("lecture.title", null));
    headerRow.addCell(pos++, translator.translate("lecture.location", null));
    headerRow.addCell(pos++, translator.translate("lecture.date", null));
    headerRow.addCell(pos++, translator.translate("table.header.start.time", null));
    headerRow.addCell(pos++, translator.translate("table.header.end.time", null));
    headerRow.addCell(pos++, translator.translate("table.header.teachers", null));
    headerRow.addCell(pos++, translator.translate("table.header.status", null));
    headerRow.addCell(pos++, translator.translate("table.header.auto.close.date", null));
    headerRow.addCell(pos++, translator.translate("planned.lectures", null));
    headerRow.addCell(pos++, translator.translate("table.header.effective.lectures", null));
    headerRow.addCell(pos++, translator.translate("lecture.block.effective.end", null));
    headerRow.addCell(pos++, translator.translate("lecture.block.effective.reason", null));
    headerRow.addCell(pos++, translator.translate("table.header.comment", null));
}
Also used : Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row)

Aggregations

Row (org.olat.core.util.openxml.OpenXMLWorksheet.Row)66 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)24 Date (java.util.Date)12 Identity (org.olat.core.id.Identity)12 IOException (java.io.IOException)10 Translator (org.olat.core.gui.translator.Translator)10 OpenXMLWorkbook (org.olat.core.util.openxml.OpenXMLWorkbook)10 OpenXMLWorksheet (org.olat.core.util.openxml.OpenXMLWorksheet)10 OutputStream (java.io.OutputStream)8 CellStyle (org.olat.core.util.openxml.workbookstyle.CellStyle)8 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)8 User (org.olat.core.id.User)6 Formatter (org.olat.core.util.Formatter)6 OpenXMLWorkbookResource (org.olat.core.util.openxml.OpenXMLWorkbookResource)6 AssociateInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.AssociateInteraction)6 ChoiceInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction)6 CustomInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.CustomInteraction)6 DrawingInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.DrawingInteraction)6 EndAttemptInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.EndAttemptInteraction)6 ExtendedTextInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction)6