Search in sources :

Example 51 with Row

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

Example 52 with Row

use of org.olat.core.util.openxml.OpenXMLWorksheet.Row 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() }));
    }
}
Also used : Formatter(org.olat.core.util.Formatter) Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row) Identity(org.olat.core.id.Identity) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 53 with Row

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

the class LectureBlockExport method addContent.

private void addContent(OpenXMLWorksheet exportSheet) {
    List<Identity> participants = lectureService.getParticipants(lectureBlock);
    List<LectureBlockRollCall> rollCalls = lectureService.getRollCalls(lectureBlock);
    Map<Identity, LectureBlockRollCall> participantToRollCallMap = rollCalls.stream().collect(Collectors.toMap(r -> r.getIdentity(), r -> r));
    for (Identity participant : participants) {
        Row row = exportSheet.newRow();
        int pos = 0;
        if (isAdministrativeUser) {
            row.addCell(pos++, participant.getName());
        }
        for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
            if (userPropertyHandler == null)
                continue;
            String val = userPropertyHandler.getUserProperty(participant.getUser(), translator.getLocale());
            row.addCell(pos++, val);
        }
        LectureBlockRollCall rollCall = participantToRollCallMap.get(participant);
        if (rollCall != null) {
            List<Integer> absentList = rollCall.getLecturesAbsentList();
            for (int i = 0; i < lectureBlock.getPlannedLecturesNumber(); i++) {
                String val = absentList.contains(i) ? "x" : null;
                row.addCell(pos++, val);
            }
            if (authorizedAbsenceEnabled && rollCall.getAbsenceAuthorized() != null && rollCall.getAbsenceAuthorized().booleanValue()) {
                row.addCell(pos++, "x");
                row.addCell(pos++, rollCall.getAbsenceReason());
            }
        }
    }
}
Also used : OutputStream(java.io.OutputStream) Formatter(org.olat.core.util.Formatter) Translator(org.olat.core.gui.translator.Translator) OpenXMLWorkbookResource(org.olat.core.util.openxml.OpenXMLWorkbookResource) LectureBlock(org.olat.modules.lecture.LectureBlock) OpenXMLWorksheet(org.olat.core.util.openxml.OpenXMLWorksheet) Date(java.util.Date) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler) CoreSpringFactory(org.olat.core.CoreSpringFactory) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) OpenXMLWorkbook(org.olat.core.util.openxml.OpenXMLWorkbook) UserManager(org.olat.user.UserManager) LectureService(org.olat.modules.lecture.LectureService) List(java.util.List) ParticipantListRepositoryController(org.olat.modules.lecture.ui.ParticipantListRepositoryController) Identity(org.olat.core.id.Identity) Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row) Map(java.util.Map) StringHelper(org.olat.core.util.StringHelper) LectureBlockRollCall(org.olat.modules.lecture.LectureBlockRollCall) OLog(org.olat.core.logging.OLog) Tracing(org.olat.core.logging.Tracing) LectureBlockRollCall(org.olat.modules.lecture.LectureBlockRollCall) Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row) Identity(org.olat.core.id.Identity) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 54 with Row

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

the class LecturesBlocksEntryExport method addContent.

private void addContent(OpenXMLWorksheet exportSheet) {
    for (LectureBlockWithTeachers block : blocks) {
        Row row = exportSheet.newRow();
        LectureBlock lectureBlock = block.getLectureBlock();
        int pos = 0;
        row.addCell(pos++, lectureBlock.getTitle());
        row.addCell(pos++, lectureBlock.getLocation());
        row.addCell(pos++, formatDate(lectureBlock.getStartDate()));
        row.addCell(pos++, formatTime(lectureBlock.getStartDate()));
        row.addCell(pos++, formatTime(lectureBlock.getEndDate()));
        StringBuilder teachers = new StringBuilder();
        for (Identity teacher : block.getTeachers()) {
            if (teachers.length() > 0)
                teachers.append(", ");
            teachers.append(userManager.getUserDisplayName(teacher));
        }
        row.addCell(pos++, teachers.toString());
        if (lectureBlock.getRollCallStatus() == null) {
            pos++;
        } else {
            String status = LectureBlockStatusCellRenderer.getStatus(lectureBlock, translator);
            if (status != null) {
                row.addCell(pos++, status);
            } else {
                pos++;
            }
        }
        row.addCell(pos++, formatter.formatDate(lectureBlock.getAutoClosedDate()));
        row.addCell(pos++, toInt(lectureBlock.getPlannedLecturesNumber()));
        row.addCell(pos++, toInt(lectureBlock.getEffectiveLecturesNumber()));
        row.addCell(pos++, formatTime(lectureBlock.getEffectiveEndDate()));
        Reason reason = lectureBlock.getReasonEffectiveEnd();
        if (reason == null) {
            pos++;
        } else {
            row.addCell(pos++, reason.getTitle());
        }
        row.addCell(pos++, lectureBlock.getComment());
    }
}
Also used : LectureBlockWithTeachers(org.olat.modules.lecture.model.LectureBlockWithTeachers) LectureBlock(org.olat.modules.lecture.LectureBlock) Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row) Identity(org.olat.core.id.Identity) Reason(org.olat.modules.lecture.Reason)

Example 55 with Row

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

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