use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class CheckListExcelExport method writeDataRow.
private void writeDataRow(AssessmentData data, AssessmentEntry entry, int num, OpenXMLWorksheet exportSheet) {
int col = 0;
Identity assessedIdentity = data.getIdentity();
User assessedUser = assessedIdentity.getUser();
Row dataRow = exportSheet.newRow();
// sequence number
dataRow.addCell(col++, num, null);
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler != null) {
String property = userPropertyHandler.getUserProperty(assessedUser, translator.getLocale());
dataRow.addCell(col++, property, null);
}
}
// homepage
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(assessedIdentity);
String homepage = BusinessControlFactory.getInstance().getAsURIString(Collections.singletonList(ce), false);
dataRow.addCell(col++, homepage, null);
// course node points and passed
if (courseNode.hasScoreConfigured()) {
if (entry != null && entry.getScore() != null) {
dataRow.addCell(col++, entry.getScore(), null);
} else {
col++;
}
}
if (courseNode.hasPassedConfigured()) {
if (entry != null && entry.getPassed() != null) {
dataRow.addCell(col++, entry.getPassed().toString(), null);
} else {
col++;
}
}
ModuleConfiguration config = courseNode.getModuleConfiguration();
CheckboxList list = (CheckboxList) config.get(CheckListCourseNode.CONFIG_KEY_CHECKBOX);
if (list != null && list.getList() != null && data.getChecks() != null) {
Map<String, DBCheck> checkMap = data.getChecks().stream().collect(Collectors.toMap(c -> c.getCheckbox().getCheckboxId(), c -> c));
List<Checkbox> checkboxList = list.getList();
for (Checkbox checkbox : checkboxList) {
String boxId = checkbox.getCheckboxId();
DBCheck check = checkMap.get(boxId);
if (check != null && check.getChecked() != null && check.getChecked().booleanValue()) {
dataRow.addCell(col++, "x", null);
} else {
col++;
}
if (courseNode.hasScoreConfigured() && checkbox.getPoints() != null) {
if (check != null && check.getScore() != null) {
dataRow.addCell(col++, check.getScore(), null);
} else {
col++;
}
}
}
}
}
use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class CheckListExcelExport method writeHeaders.
private void writeHeaders(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);
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.hasScoreConfigured()) {
header2Row.addCell(col++, translator.translate("column.header.node.points"), headerStyle);
}
if (courseNode.hasPassedConfigured()) {
header2Row.addCell(col++, translator.translate("column.header.node.passed"), headerStyle);
}
ModuleConfiguration config = courseNode.getModuleConfiguration();
CheckboxList list = (CheckboxList) config.get(CheckListCourseNode.CONFIG_KEY_CHECKBOX);
if (list != null && list.getList() != null) {
List<Checkbox> checkboxList = list.getList();
for (Checkbox checkbox : checkboxList) {
String boxTitle = checkbox.getTitle();
header2Row.addCell(col++, boxTitle, headerStyle);
if (courseNode.hasScoreConfigured() && checkbox.getPoints() != null) {
header2Row.addCell(col++, translator.translate("column.header.points"), headerStyle);
}
}
}
}
use of org.olat.core.util.openxml.OpenXMLWorksheet.Row 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.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class AbstractLectureBlockAuditLogExport method addHeader.
private void addHeader(OpenXMLWorksheet exportSheet) {
exportSheet.setHeaderRows(2);
Row headerRow = exportSheet.newRow();
int pos = 0;
// creationDate
headerRow.addCell(pos++, translator.translate("table.header.date"));
// action
headerRow.addCell(pos++, translator.translate("table.header.log.action"));
// repository entry title
headerRow.addCell(pos++, translator.translate("table.header.entry"));
// lecture block title
headerRow.addCell(pos++, translator.translate("table.header.lecture.block"));
// audit block
// lecture block status
headerRow.addCell(pos++, translator.translate("table.header.status"));
// lecture block planned lectures
headerRow.addCell(pos++, translator.translate("table.header.log.planned.lectures"));
// lecture block effective lectures
headerRow.addCell(pos++, translator.translate("table.header.log.effective.lectures"));
// lecture block effective end date
headerRow.addCell(pos++, translator.translate("table.header.log.effective.end.date"));
// audit roll call
// roll call user
headerRow.addCell(pos++, translator.translate("table.header.log.user"));
// roll call attended
headerRow.addCell(pos++, translator.translate("table.header.attended.lectures"));
// roll call absent
headerRow.addCell(pos++, translator.translate("table.header.absent.lectures"));
if (authorizedAbsenceEnabled) {
// roll call authorized
headerRow.addCell(pos++, translator.translate("table.header.authorized.absence"));
// roll call reason
headerRow.addCell(pos++, translator.translate("authorized.absence.reason"));
}
// roll call comment
headerRow.addCell(pos++, translator.translate("rollcall.comment"));
// author
// author
headerRow.addCell(pos++, translator.translate("table.header.log.author"));
}
use of org.olat.core.util.openxml.OpenXMLWorksheet.Row 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());
}
}
}
}
Aggregations