Search in sources :

Example 41 with LectureBlockRollCall

use of org.olat.modules.lecture.LectureBlockRollCall in project OpenOLAT by OpenOLAT.

the class AbstractLectureBlockAuditLogExport method addContent.

private void addContent(OpenXMLWorksheet exportSheet, OpenXMLWorkbook workbook) {
    for (LectureBlockAuditLog logEntry : auditLog) {
        int pos = 0;
        Row row = exportSheet.newRow();
        Date creationDate = logEntry.getCreationDate();
        row.addCell(pos++, creationDate, workbook.getStyles().getDateTimeStyle());
        row.addCell(pos++, logEntry.getAction());
        // repo entry title
        row.addCell(pos++, getRepositoryEntryDisplayName(logEntry.getEntryKey()), null);
        // lecture block
        row.addCell(pos++, getLectureBlockTitle(logEntry.getLectureBlockKey()), null);
        // date start / end
        // planned / effective
        LectureBlock auditBlock = null;
        LectureBlockRollCall auditRollCall = null;
        LectureParticipantSummary auditSummary = null;
        if (logEntry.getRollCallKey() != null) {
            auditRollCall = getAuditRollCall(logEntry.getAfter());
        }
        if (auditRollCall == null) {
            if (logEntry.getLectureBlockKey() != null) {
                auditBlock = getAuditLectureBlock(logEntry.getAfter());
            } else {
                auditSummary = getAuditLectureParticipantSummary(logEntry.getAfter());
            }
        }
        if (auditBlock != null) {
            if (auditBlock.getStatus() == null) {
                pos++;
            } else {
                row.addCell(pos++, auditBlock.getStatus().name(), null);
            }
            row.addCell(pos++, auditBlock.getPlannedLecturesNumber(), null);
            row.addCell(pos++, auditBlock.getEffectiveLecturesNumber(), null);
            row.addCell(pos++, auditBlock.getEffectiveEndDate(), workbook.getStyles().getDateTimeStyle());
        } else {
            pos += 4;
        }
        if (auditRollCall != null) {
            Long assessedIdentityKey = logEntry.getIdentityKey();
            String fullname = userManager.getUserDisplayName(assessedIdentityKey);
            row.addCell(pos++, fullname);
            row.addCell(pos++, auditRollCall.getLecturesAttendedNumber(), null);
            row.addCell(pos++, auditRollCall.getLecturesAbsentNumber(), null);
            if (authorizedAbsenceEnabled) {
                if (auditRollCall.getAbsenceAuthorized() != null && auditRollCall.getAbsenceAuthorized().booleanValue()) {
                    row.addCell(pos++, "x");
                } else {
                    pos++;
                }
                row.addCell(pos++, auditRollCall.getAbsenceReason(), null);
            }
            row.addCell(pos++, auditRollCall.getComment(), null);
        } else if (auditSummary != null) {
            Long assessedIdentityKey = logEntry.getIdentityKey();
            String fullname = userManager.getUserDisplayName(assessedIdentityKey);
            row.addCell(pos++, fullname);
            pos += 2;
            if (authorizedAbsenceEnabled) {
                pos += 2;
            }
            String summaryComment = getSummaryComment(getAuditLectureParticipantSummary(logEntry.getBefore()), auditSummary);
            row.addCell(pos++, summaryComment, null);
        } else {
            pos += 4;
            if (authorizedAbsenceEnabled) {
                pos += 2;
            }
        }
        Long authorKey = logEntry.getAuthorKey();
        if (authorKey != null) {
            String fullname = userManager.getUserDisplayName(authorKey);
            row.addCell(pos++, fullname);
        }
    }
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) LectureParticipantSummary(org.olat.modules.lecture.LectureParticipantSummary) LectureBlockRollCall(org.olat.modules.lecture.LectureBlockRollCall) LectureBlockAuditLog(org.olat.modules.lecture.LectureBlockAuditLog) Row(org.olat.core.util.openxml.OpenXMLWorksheet.Row) Date(java.util.Date)

Example 42 with LectureBlockRollCall

use of org.olat.modules.lecture.LectureBlockRollCall in project OpenOLAT by OpenOLAT.

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 43 with LectureBlockRollCall

use of org.olat.modules.lecture.LectureBlockRollCall in project OpenOLAT by OpenOLAT.

the class ParticipantLectureBlocksController method doAppealAudit.

private void doAppealAudit(LectureBlockAndRollCall row, String message) {
    logAudit("Appeal send for lecture block: " + row.getLectureBlockTitle() + " (" + row.getLectureBlockRef().getKey() + ")", null);
    LectureBlock lectureBlock = lectureService.getLectureBlock(row.getLectureBlockRef());
    LectureBlockRollCall rollCall = lectureService.getRollCall(row.getRollCallRef());
    lectureService.auditLog(Action.sendAppeal, null, null, message, lectureBlock, rollCall, entry, assessedIdentity, null);
    dbInstance.commit();
    loadModel();
    tableEl.reset(false, false, true);
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) LectureBlockRollCall(org.olat.modules.lecture.LectureBlockRollCall)

Example 44 with LectureBlockRollCall

use of org.olat.modules.lecture.LectureBlockRollCall in project openolat by klemens.

the class TeacherLecturesTableController method doExportAttendanceList.

private void doExportAttendanceList(UserRequest ureq, LectureBlock row) {
    LectureBlock lectureBlock = lectureService.getLectureBlock(row);
    List<Identity> participants = lectureService.getParticipants(lectureBlock);
    List<LectureBlockRollCall> rollCalls = lectureService.getRollCalls(row);
    try {
        LecturesBlockPDFExport export = new LecturesBlockPDFExport(lectureBlock, authorizedAbsenceEnabled, getTranslator());
        export.setTeacher(userManager.getUserDisplayName(getIdentity()));
        export.create(participants, rollCalls);
        ureq.getDispatchResult().setResultingMediaResource(export);
    } catch (IOException | TransformerException e) {
        logError("", e);
    }
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) LectureBlockRollCall(org.olat.modules.lecture.LectureBlockRollCall) LecturesBlockPDFExport(org.olat.modules.lecture.ui.export.LecturesBlockPDFExport) IOException(java.io.IOException) Identity(org.olat.core.id.Identity) TransformerException(javax.xml.transform.TransformerException)

Example 45 with LectureBlockRollCall

use of org.olat.modules.lecture.LectureBlockRollCall in project openolat by klemens.

the class TeacherRollCallController method loadModel.

private void loadModel() {
    List<LectureBlockRollCall> rollCalls = lectureService.getRollCalls(lectureBlock);
    Map<Identity, LectureBlockRollCall> rollCallMap = new HashMap<>();
    for (LectureBlockRollCall rollCall : rollCalls) {
        rollCallMap.put(rollCall.getIdentity(), rollCall);
    }
    List<TeacherRollCallRow> rows = new ArrayList<>(participants.size());
    for (Identity participant : participants) {
        LectureBlockRollCall rollCall = rollCallMap.get(participant);
        rows.add(forgeRow(participant, rollCall));
    }
    tableModel.setObjects(rows);
    tableEl.reset(false, false, true);
}
Also used : HashMap(java.util.HashMap) LectureBlockRollCall(org.olat.modules.lecture.LectureBlockRollCall) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity)

Aggregations

LectureBlockRollCall (org.olat.modules.lecture.LectureBlockRollCall)64 LectureBlock (org.olat.modules.lecture.LectureBlock)40 Identity (org.olat.core.id.Identity)36 Test (org.junit.Test)26 LectureBlockRollCallSearchParameters (org.olat.modules.lecture.LectureBlockRollCallSearchParameters)16 Date (java.util.Date)14 ArrayList (java.util.ArrayList)12 List (java.util.List)10 LectureService (org.olat.modules.lecture.LectureService)10 HashMap (java.util.HashMap)8 IOException (java.io.IOException)6 URI (java.net.URI)6 Collectors (java.util.stream.Collectors)6 HttpResponse (org.apache.http.HttpResponse)6 LectureBlockRollCallVO (org.olat.modules.lecture.restapi.LectureBlockRollCallVO)6 LectureBlockStatus (org.olat.modules.lecture.LectureBlockStatus)5 LectureRollCallStatus (org.olat.modules.lecture.LectureRollCallStatus)5 Map (java.util.Map)4 Roles (org.olat.core.id.Roles)4 LectureBlockAndRollCall (org.olat.modules.lecture.model.LectureBlockAndRollCall)4