Ignore:
Timestamp:
9 Jun 2016, 12:36:41 (8 years ago)
Author:
Henrik Bettermann
Message:

Add ExportPDFScoresSlip.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r13797 r13898  
    5555    ('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
    5656    ('BOX', (0,0), (-1,-1), 1, colors.black),
    57 
    5857    ]
    5958
     
    936935        return pdf_stream
    937936
     937    def renderPDFCourseticketsOverview(
     938            self, view, session, table_data, lecturers):
     939        filename = 'coursetickets_%s_%s_%s.pdf' % (
     940            view.context.code, session, view.request.principal.id)
     941        session = academic_sessions_vocab.getTerm(session).title
     942        creator = getUtility(IPDFCreator)
     943        style = getSampleStyleSheet()
     944        pdf_data = [Table(table_data, style=CONTENT_STYLE)]
     945        doc_title = translate(
     946            _('${a} - Session ${b}\n'
     947              'Lecturer(s): ${c}',
     948            mapping = {'a':view.context.code, 'b':session, 'c':lecturers}))
     949        author = '%s (%s)' % (view.request.principal.title,
     950                              view.request.principal.id)
     951        view.response.setHeader(
     952            'Content-Type', 'application/pdf')
     953        view.response.setHeader(
     954            'Content-Disposition:', 'attachment; filename="%s' % filename)
     955        pdf_stream = creator.create_pdf(
     956            pdf_data, None, doc_title, author, doc_title + ' -'
     957            )
     958        return pdf_stream
     959
    938960    def maxCredits(self, studylevel):
    939961        """Return maximum credits.
Note: See TracChangeset for help on using the changeset viewer.