use of org.olat.modules.lecture.LectureBlockAuditLog in project OpenOLAT by OpenOLAT.
the class ParticipantLecturesOverviewController method doExportLog.
private void doExportLog(UserRequest ureq) {
List<LectureBlockAuditLog> auditLog = lectureService.getAuditLog(assessedIdentity);
IdentityAuditLogExport export = new IdentityAuditLogExport(assessedIdentity, auditLog, authorizedAbsenceEnabled, getTranslator());
ureq.getDispatchResult().setResultingMediaResource(export);
}
use of org.olat.modules.lecture.LectureBlockAuditLog in project OpenOLAT by OpenOLAT.
the class LectureListRepositoryController method doExportLog.
private void doExportLog(UserRequest ureq, LectureBlockRow row) {
LectureBlock lectureBlock = lectureService.getLectureBlock(row);
List<LectureBlockAuditLog> auditLog = lectureService.getAuditLog(row);
boolean authorizedAbsenceEnabled = lectureModule.isAuthorizedAbsenceEnabled();
LectureBlockAuditLogExport export = new LectureBlockAuditLogExport(entry, lectureBlock, auditLog, authorizedAbsenceEnabled, getTranslator());
ureq.getDispatchResult().setResultingMediaResource(export);
}
use of org.olat.modules.lecture.LectureBlockAuditLog 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);
}
}
}
use of org.olat.modules.lecture.LectureBlockAuditLog in project openolat by klemens.
the class ParticipantLectureBlocksController method loadModel.
private void loadModel() {
Date now = new Date();
Formatter formatter = Formatter.getInstance(getLocale());
String separator = translate("user.fullname.separator");
List<LectureBlockAndRollCall> rollCalls = lectureService.getParticipantLectureBlocks(entry, assessedIdentity, separator);
List<LectureBlockAuditLog> sendAppealLogs = lectureService.getAuditLog(entry, assessedIdentity, LectureBlockAuditLog.Action.sendAppeal);
Map<Long, Date> appealDates = new HashMap<>();
for (LectureBlockAuditLog sendAppealLog : sendAppealLogs) {
if (sendAppealLog.getRollCallKey() != null) {
appealDates.put(sendAppealLog.getRollCallKey(), sendAppealLog.getCreationDate());
}
}
List<LectureBlockAndRollCallRow> rows = new ArrayList<>(rollCalls.size());
for (LectureBlockAndRollCall rollCall : rollCalls) {
LectureBlockAndRollCallRow row = new LectureBlockAndRollCallRow(rollCall);
if (appealEnabled && !LectureBlockStatus.cancelled.equals(row.getRow().getStatus()) && rollCall.isCompulsory()) {
int lectures = row.getRow().getEffectiveLecturesNumber();
if (lectures <= 0) {
lectures = row.getRow().getPlannedLecturesNumber();
}
int attended = row.getRow().getLecturesAttendedNumber();
if (attended < lectures) {
Date date = row.getRow().getDate();
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal = CalendarUtils.getEndOfDay(cal);
cal.add(Calendar.DATE, appealOffset);
Date beginAppeal = CalendarUtils.removeTime(cal.getTime());
cal.add(Calendar.DATE, appealPeriod);
Date endAppeal = CalendarUtils.getEndOfDay(cal).getTime();
Date sendAppealDate = null;
if (row.getRow().getRollCallRef() != null) {
sendAppealDate = appealDates.get(row.getRow().getRollCallRef().getKey());
}
FormLink appealLink = null;
if (sendAppealDate != null) {
String appealFrom = translate("appeal.sent", new String[] { formatter.formatDate(sendAppealDate) });
appealLink = uifactory.addFormLink("appeal_" + count++, "appealsend", appealFrom, null, flc, Link.LINK | Link.NONTRANSLATED);
appealLink.setTitle(translate("appeal.sent.tooltip", new String[] { formatter.formatDate(sendAppealDate), formatter.formatDate(beginAppeal), formatter.formatDate(endAppeal) }));
appealLink.setEnabled(false);
appealLink.setDomReplacementWrapperRequired(false);
} else if (now.compareTo(beginAppeal) >= 0 && now.compareTo(endAppeal) <= 0) {
appealLink = uifactory.addFormLink("appeal_" + count++, "appeal", translate("appeal"), null, flc, Link.LINK | Link.NONTRANSLATED);
appealLink.setTitle(translate("appeal.tooltip", new String[] { formatter.formatDate(beginAppeal), formatter.formatDate(endAppeal) }));
appealLink.setUserObject(row);
// appeal
} else if (now.compareTo(endAppeal) > 0) {
// appeal closed
appealLink = uifactory.addFormLink("appeal_" + count++, "aclosed", "appeal.closed", null, flc, Link.LINK);
appealLink.setEnabled(false);
appealLink.setDomReplacementWrapperRequired(false);
} else if (now.compareTo(date) >= 0) {
// appeal at
String appealFrom = translate("appeal.from", new String[] { formatter.formatDate(beginAppeal) });
appealLink = uifactory.addFormLink("appeal_" + count++, "appealat", appealFrom, null, flc, Link.LINK | Link.NONTRANSLATED);
appealLink.setEnabled(false);
appealLink.setDomReplacementWrapperRequired(false);
}
row.setAppealButton(appealLink);
}
}
rows.add(row);
}
tableModel.setObjects(rows);
tableEl.reset(true, true, true);
}
use of org.olat.modules.lecture.LectureBlockAuditLog in project openolat by klemens.
the class ParticipantLecturesOverviewController method doExportLog.
private void doExportLog(UserRequest ureq) {
List<LectureBlockAuditLog> auditLog = lectureService.getAuditLog(assessedIdentity);
IdentityAuditLogExport export = new IdentityAuditLogExport(assessedIdentity, auditLog, authorizedAbsenceEnabled, getTranslator());
ureq.getDispatchResult().setResultingMediaResource(export);
}
Aggregations