Search in sources :

Example 1 with Row

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

the class QTI21ArchiveFormat method writeHeaders_2.

private void writeHeaders_2(OpenXMLWorksheet exportSheet, OpenXMLWorkbook workbook) {
    CellStyle headerStyle = workbook.getStyles().getHeaderStyle();
    // second header
    // reset column counter
    int col = 0;
    Row header2Row = exportSheet.newRow();
    String sequentialNumber = translator.translate("column.header.seqnum");
    header2Row.addCell(col++, sequentialNumber, headerStyle);
    if (anonymizerCallback != null) {
        col++;
    } else {
        for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
            if (userPropertyHandler == null) {
                continue;
            }
            String header = translator.translate(userPropertyHandler.i18nFormElementLabelKey());
            header2Row.addCell(col++, header, headerStyle);
        }
        // add other user and session information
        header2Row.addCell(col++, translator.translate("column.header.homepage"), headerStyle);
    }
    // course node points and passed
    if (courseNode instanceof AssessableCourseNode) {
        AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
        if (assessableCourseNode.hasScoreConfigured()) {
            header2Row.addCell(col++, translator.translate("archive.table.header.node.points"), headerStyle);
        }
        if (assessableCourseNode.hasPassedConfigured()) {
            header2Row.addCell(col++, translator.translate("archive.table.header.node.passed"), headerStyle);
        }
    }
    header2Row.addCell(col++, translator.translate("archive.table.header.points"), headerStyle);
    header2Row.addCell(col++, translator.translate("archive.table.header.manual.points"), headerStyle);
    header2Row.addCell(col++, translator.translate("archive.table.header.final.points"), headerStyle);
    header2Row.addCell(col++, translator.translate("column.header.passed"), headerStyle);
    if (anonymizerCallback == null) {
        header2Row.addCell(col++, translator.translate("column.header.date"), headerStyle);
    }
    header2Row.addCell(col++, translator.translate("column.header.duration"), headerStyle);
    List<AbstractInfos> infos = getItemInfos();
    for (int i = 0; i < infos.size(); i++) {
        AbstractInfos info = infos.get(i);
        if (info instanceof ItemInfos) {
            ItemInfos item = (ItemInfos) info;
            if (exportConfig.isResponseCols()) {
                List<Interaction> interactions = item.getInteractions();
                for (int j = 0; j < interactions.size(); j++) {
                    Interaction interaction = interactions.get(j);
                    col = interactionArchiveMap.get(interaction.getQtiClassName()).writeHeader2(item.getAssessmentItem(), interaction, i, j, header2Row, col, workbook);
                }
            }
            if (exportConfig.isPointCol()) {
                header2Row.addCell(col++, translator.translate("item.score"), headerStyle);
            }
            if (exportConfig.isCommentCol()) {
                header2Row.addCell(col++, translator.translate("item.comment"), headerStyle);
            }
            if (exportConfig.isTimeCols()) {
                if (anonymizerCallback == null) {
                    header2Row.addCell(col++, translator.translate("item.start"), headerStyle);
                }
                header2Row.addCell(col++, translator.translate("item.duration"), headerStyle);
            }
        } else if (numOfSections > 1 && info instanceof SectionInfos) {
            SectionInfos section = (SectionInfos) info;
            if (!section.getItemInfos().isEmpty()) {
                header2Row.addCell(col++, translator.translate("archive.table.header.points"), headerStyle);
            }
        }
    }
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) DrawingInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.DrawingInteraction) EndAttemptInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.EndAttemptInteraction) GraphicOrderInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.GraphicOrderInteraction) TextEntryInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.TextEntryInteraction) ExtendedTextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction) OrderInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.OrderInteraction) Interaction(uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction) HottextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.HottextInteraction) GraphicAssociateInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.GraphicAssociateInteraction) CustomInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.CustomInteraction) InlineChoiceInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.InlineChoiceInteraction) HotspotInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.HotspotInteraction) UploadInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.UploadInteraction) AssociateInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.AssociateInteraction) ChoiceInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction) MatchInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.MatchInteraction) SelectPointInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.SelectPointInteraction) SliderInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.SliderInteraction) PositionObjectInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.PositionObjectInteraction) GraphicGapMatchInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.GraphicGapMatchInteraction) MediaInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.MediaInteraction) GapMatchInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.GapMatchInteraction) CellStyle(org.olat.core.util.openxml.workbookstyle.CellStyle) Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 2 with Row

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

the class OpenXmlWorkbookTest method creationOfWorkbook.

/**
 * Sadly, I can only test if our system produce a non empty file.
 * @throws IOException
 */
@Test
public void creationOfWorkbook() throws IOException {
    File file = File.createTempFile("workbook", "_min.xlsx");
    FileOutputStream fileOut = new FileOutputStream(file);
    OpenXMLWorkbook workbook = new OpenXMLWorkbook(fileOut, 1);
    OpenXMLWorksheet sheet = workbook.nextWorksheet();
    sheet.setHeaderRows(1);
    // 0 empty
    sheet.newRow();
    Row row1 = sheet.newRow();
    row1.addCell(1, "Title", null);
    row1.addCell(2, "Titre", null);
    row1.addCell(1, 1.0d, null);
    Row row2 = sheet.newRow();
    row2.addCell(2, "Hello", null);
    row2.addCell(2, "Border", workbook.getStyles().getBorderRightStyle());
    sheet.newRow();
    Row row4 = sheet.newRow();
    row4.addCell(5, new Date(), workbook.getStyles().getDateStyle());
    workbook.close();
    fileOut.flush();
    IOUtils.closeQuietly(fileOut);
    Assert.assertTrue(file.exists());
    Assert.assertTrue(file.length() > 4096);
    file.delete();
}
Also used : FileOutputStream(java.io.FileOutputStream) Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row) File(java.io.File) Date(java.util.Date) Test(org.junit.Test)

Example 3 with Row

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

the class LecturesStatisticsExport method addContentAggregated.

private void addContentAggregated(OpenXMLWorksheet exportSheet, OpenXMLWorkbook workbook) {
    List<LectureBlockIdentityStatistics> aggregatedStatistics = lectureService.groupByIdentity(statistics);
    for (LectureBlockIdentityStatistics statistic : aggregatedStatistics) {
        Row row = exportSheet.newRow();
        int pos = 0;
        pos = addContentUser(statistic, row, pos);
        addContentStatistics(statistic, row, pos, workbook);
    }
}
Also used : LectureBlockIdentityStatistics(org.olat.modules.lecture.model.LectureBlockIdentityStatistics) Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row)

Example 4 with Row

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

the class LecturesStatisticsExport method addHeadersDetailled.

private void addHeadersDetailled(OpenXMLWorksheet exportSheet) {
    Row headerRow = exportSheet.newRow();
    int pos = 0;
    pos = addHeadersUser(headerRow, pos);
    headerRow.addCell(pos++, translator.translate("table.header.external.ref"));
    headerRow.addCell(pos++, translator.translate("table.header.entry"));
    addHeadersStatistics(headerRow, pos);
}
Also used : Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row)

Example 5 with Row

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

the class LecturesStatisticsExport method addContentDetailled.

private void addContentDetailled(OpenXMLWorksheet exportSheet, OpenXMLWorkbook workbook) {
    for (LectureBlockIdentityStatistics statistic : statistics) {
        Row row = exportSheet.newRow();
        int pos = 0;
        pos = addContentUser(statistic, row, pos);
        row.addCell(pos++, statistic.getExternalRef());
        row.addCell(pos++, statistic.getDisplayName());
        addContentStatistics(statistic, row, pos, workbook);
    }
}
Also used : LectureBlockIdentityStatistics(org.olat.modules.lecture.model.LectureBlockIdentityStatistics) 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