Changeset 13900


Ignore:
Timestamp:
9 Jun 2016, 12:55:00 (9 years ago)
Author:
Henrik Bettermann
Message:

Customize ExportPDFScoresSlip.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py

    r13880 r13900  
    1818import grok
    1919from zope.i18n import translate
    20 from zope.component import getUtility
     20from zope.component import getUtility, queryUtility
    2121from zope.security import checkPermission
     22from zope.catalog.interfaces import ICatalog
    2223from zope.formlib.textwidgets import BytesDisplayWidget
    2324from waeup.kofa.browser.layout import UtilityView
     
    4041    CourseTicketDisplayFormPage,
    4142    CourseTicketManageFormPage,
    42     EditScoresPage
     43    EditScoresPage,
     44    ExportPDFScoresSlip
    4345    )
    4446from kofacustom.nigeria.students.browser import (
     
    606608                  type="danger")
    607609        return
     610
     611class CustomExportPDFScoresSlip(ExportPDFScoresSlip):
     612    """Deliver a PDF slip of course tickets for a lecturer.
     613    """
     614
     615    def table_data(self, session):
     616        cat = queryUtility(ICatalog, name='coursetickets_catalog')
     617        coursetickets = cat.searchResults(
     618            session=(session, session),
     619            code=(self.context.code, self.context.code)
     620            )
     621        result = [[_('Matric No.'),
     622                   _('Reg. No.'),
     623                   _('Fullname'),
     624                   _('Status'),
     625                   _('Course of Studies'),
     626                   _('Level'),
     627                   _('Score'),
     628                   _('CA') ],]
     629        for ticket in list(coursetickets):
     630            row = [ticket.student.matric_number,
     631                  ticket.student.reg_number,
     632                  ticket.student.display_fullname,
     633                  ticket.student.translated_state,
     634                  ticket.student.certcode,
     635                  ticket.level,
     636                  ticket.score,
     637                  ticket.ca]
     638            result.append(row)
     639        return result
Note: See TracChangeset for help on using the changeset viewer.