Search in sources :

Example 11 with OpenXMLWorksheet

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

the class QuestionItemAuditLogExport method generate.

@Override
protected void generate(OutputStream out) {
    Collections.sort(auditLog, new QuestionItemAuditLogComparator());
    try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1)) {
        OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
        addSheetSettings(exportSheet);
        addHeader(exportSheet);
        addContent(exportSheet, workbook);
    } catch (IOException e) {
        log.error("", e);
    } catch (Exception e) {
        log.error("", e);
    }
}
Also used : OpenXMLWorkbook(org.olat.core.util.openxml.OpenXMLWorkbook) IOException(java.io.IOException) OpenXMLWorksheet(org.olat.core.util.openxml.OpenXMLWorksheet) IOException(java.io.IOException)

Example 12 with OpenXMLWorksheet

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

the class QTI21ArchiveFormat method exportCourseElement.

public MediaResource exportCourseElement() {
    FileResourceManager frm = FileResourceManager.getInstance();
    File unzippedDirRoot = frm.unzipFileResource(searchParams.getTestEntry().getOlatResource());
    resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
    ICourse course = CourseFactory.loadCourse(searchParams.getCourseEntry());
    courseNode = course.getRunStructure().getNode(searchParams.getNodeIdent());
    String label = courseNode.getType() + "_" + StringHelper.transformDisplayNameToFileSystemName(courseNode.getShortName()) + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis())) + ".xlsx";
    if ("iqself".equals(courseNode.getType())) {
        anonymizerCallback = course.getCourseEnvironment().getCoursePropertyManager();
    }
    // content
    final List<AssessmentTestSession> sessions = testSessionDao.getTestSessionsOfResponse(searchParams);
    final List<AssessmentResponse> responses = responseDao.getResponse(searchParams);
    return new OpenXMLWorkbookResource(label) {

        @Override
        protected void generate(OutputStream out) {
            try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1)) {
                // headers
                OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
                exportSheet.setHeaderRows(2);
                writeHeaders_1(exportSheet, workbook);
                writeHeaders_2(exportSheet, workbook);
                writeData(sessions, responses, exportSheet, workbook);
            } catch (Exception e) {
                log.error("", e);
            }
        }
    };
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) OpenXMLWorkbookResource(org.olat.core.util.openxml.OpenXMLWorkbookResource) ShieldOutputStream(org.olat.core.util.io.ShieldOutputStream) ZipOutputStream(java.util.zip.ZipOutputStream) OutputStream(java.io.OutputStream) ICourse(org.olat.course.ICourse) AssessmentResponse(org.olat.ims.qti21.AssessmentResponse) Date(java.util.Date) IOException(java.io.IOException) FileResourceManager(org.olat.fileresource.FileResourceManager) OpenXMLWorkbook(org.olat.core.util.openxml.OpenXMLWorkbook) OpenXMLWorksheet(org.olat.core.util.openxml.OpenXMLWorksheet) File(java.io.File)

Example 13 with OpenXMLWorksheet

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

the class LecturesBlocksEntryExport method generate.

@Override
protected void generate(OutputStream out) {
    blocks = lectureService.getLectureBlocksWithTeachers(entry);
    Collections.sort(blocks, new LectureBlockWithTeachersComparator());
    try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1 + blocks.size())) {
        // overview of all lecture blocks
        OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
        exportSheet.setHeaderRows(1);
        addHeaders(exportSheet);
        addContent(exportSheet);
        for (LectureBlockWithTeachers block : blocks) {
            OpenXMLWorksheet exportBlockSheet = workbook.nextWorksheet();
            LectureBlockExport lectureBlockExport = new LectureBlockExport(block.getLectureBlock(), block.getTeachers(), isAdministrativeUser, authorizedAbsenceEnabled, translator);
            lectureBlockExport.generate(exportBlockSheet);
        }
    } catch (IOException e) {
        log.error("", e);
    }
}
Also used : LectureBlockWithTeachers(org.olat.modules.lecture.model.LectureBlockWithTeachers) OpenXMLWorkbook(org.olat.core.util.openxml.OpenXMLWorkbook) IOException(java.io.IOException) OpenXMLWorksheet(org.olat.core.util.openxml.OpenXMLWorksheet)

Example 14 with OpenXMLWorksheet

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

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);
    }
}
Also used : OpenXMLWorkbook(org.olat.core.util.openxml.OpenXMLWorkbook) IOException(java.io.IOException) OpenXMLWorksheet(org.olat.core.util.openxml.OpenXMLWorksheet) IOException(java.io.IOException)

Example 15 with OpenXMLWorksheet

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

the class LectureBlockExport method generate.

@Override
protected void generate(OutputStream out) {
    try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1)) {
        OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
        generate(exportSheet);
    } catch (IOException e) {
        log.error("", e);
    }
}
Also used : OpenXMLWorkbook(org.olat.core.util.openxml.OpenXMLWorkbook) IOException(java.io.IOException) OpenXMLWorksheet(org.olat.core.util.openxml.OpenXMLWorksheet)

Aggregations

IOException (java.io.IOException)32 OpenXMLWorkbook (org.olat.core.util.openxml.OpenXMLWorkbook)32 OpenXMLWorksheet (org.olat.core.util.openxml.OpenXMLWorksheet)32 OutputStream (java.io.OutputStream)16 Date (java.util.Date)14 OpenXMLWorkbookResource (org.olat.core.util.openxml.OpenXMLWorkbookResource)14 Translator (org.olat.core.gui.translator.Translator)10 Row (org.olat.core.util.openxml.OpenXMLWorksheet.Row)10 Identity (org.olat.core.id.Identity)6 ICourse (org.olat.course.ICourse)6 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)6 File (java.io.File)4 List (java.util.List)4 Map (java.util.Map)4 Collectors (java.util.stream.Collectors)4 ZipOutputStream (java.util.zip.ZipOutputStream)4 CoreSpringFactory (org.olat.core.CoreSpringFactory)4 User (org.olat.core.id.User)4 ContextEntry (org.olat.core.id.context.ContextEntry)4 OLog (org.olat.core.logging.OLog)4