use of org.olat.core.util.openxml.OpenXMLWorksheet 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 in project OpenOLAT by OpenOLAT.
the class AbstractLectureBlockAuditLogExport method generate.
@Override
protected void generate(OutputStream out) {
Collections.sort(auditLog, new LectureBlockAuditLogComparator());
try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1)) {
OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
addSheetSettings(exportSheet);
addHeaders(exportSheet);
addHeader(exportSheet);
addContent(exportSheet, workbook);
} catch (IOException e) {
log.error("", e);
} catch (Exception e) {
log.error("", e);
}
}
use of org.olat.core.util.openxml.OpenXMLWorksheet 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());
}
}
}
}
use of org.olat.core.util.openxml.OpenXMLWorksheet in project OpenOLAT by OpenOLAT.
the class LecturesStatisticsExport method generate.
@Override
protected void generate(OutputStream out) {
try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 2)) {
OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
exportSheet.setHeaderRows(1);
addHeadersAggregated(exportSheet);
addContentAggregated(exportSheet, workbook);
exportSheet = workbook.nextWorksheet();
exportSheet.setHeaderRows(1);
addHeadersDetailled(exportSheet);
addContentDetailled(exportSheet, workbook);
} catch (IOException e) {
log.error("", e);
}
}
use of org.olat.core.util.openxml.OpenXMLWorksheet 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());
}
}
}
}
Aggregations