source: main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py @ 15606

Last change on this file since 15606 was 15606, checked in by Henrik Bettermann, 5 years ago

Parents access implementation (part 1)

  • Property svn:keywords set to Id
File size: 27.9 KB
RevLine 
[7191]1## $Id: interfaces.py 15606 2019-09-24 17:21:28Z henrik $
[6621]2##
[7191]3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
[8409]18#from datetime import datetime
[7620]19from zope.component import getUtility
[15203]20from zope.interface import Attribute, Interface, invariant, Invalid
[6621]21from zope import schema
[7620]22from zc.sourcefactory.contextual import BasicContextualSourceFactory
[9217]23from waeup.kofa.browser.interfaces import IStudentNavigationBase
[7811]24from waeup.kofa.interfaces import (
[11450]25    IKofaObject, academic_sessions_vocab, validate_email, ICSVExporter,
[13125]26    ContextualDictSourceFactoryBase, IKofaUtils)
[7811]27from waeup.kofa.interfaces import MessageFactory as _
[8176]28from waeup.kofa.schema import TextLineChoice, FormattedDate, PhoneNumber
[7811]29from waeup.kofa.students.vocabularies import (
[7915]30    StudyLevelSource, contextual_reg_num_source, contextual_mat_num_source,
[9420]31    GenderSource, nats_vocab
[7915]32    )
[8160]33from waeup.kofa.payments.interfaces import (
[8174]34    IPaymentsContainer, IOnlinePayment)
[7915]35from waeup.kofa.university.vocabularies import (
[14642]36    CourseSource, StudyModeSource, CertificateSource,
37    SemesterSource, CourseCategorySource
[11450]38    )
[6621]39
[9864]40class PreviousPaymentCategorySource(ContextualDictSourceFactoryBase):
41    """A source that delivers all selectable categories of previous session
42    payments.
43    """
44    #: name of dict to deliver from kofa utils.
45    DICT_NAME = 'PREVIOUS_PAYMENT_CATEGORIES'
46
[9868]47class BalancePaymentCategorySource(ContextualDictSourceFactoryBase):
[9864]48    """A source that delivers all selectable items of balance payments.
49    """
50    #: name of dict to deliver from kofa utils.
[9868]51    DICT_NAME = 'BALANCE_PAYMENT_CATEGORIES'
[9864]52
[7620]53# VerdictSource can't be placed into the vocabularies module because it
54# requires importing IStudentsUtils which then leads to circular imports.
55class VerdictSource(BasicContextualSourceFactory):
56    """A verdicts source delivers all verdicts provided
57    in the portal.
58    """
59    def getValues(self, context):
[13125]60        verdicts_dict = getUtility(IKofaUtils).VERDICTS_DICT
[8820]61        return sorted(verdicts_dict.keys())
[7620]62
63    def getToken(self, context, value):
64        return value
65
66    def getTitle(self, context, value):
[13125]67        verdicts_dict = getUtility(IKofaUtils).VERDICTS_DICT
[8820]68        if value != '0':
69            return verdicts_dict[value] + ' (%s)' % value
[7688]70        return verdicts_dict[value]
[7620]71
[7681]72
[7150]73class IStudentsUtils(Interface):
74    """A collection of methods which are subject to customization.
75    """
[7841]76    def setReturningData(student):
77        """ This method defines what happens after school fee payment
78        depending on the student's senate verdict.
79
80        In the base configuration current level is always increased
81        by 100 no matter which verdict has been assigned.
82        """
83
[9148]84    def setPaymentDetails(category, student, previous_session=None,
85            previous_level=None,):
[8595]86        """Create Payment object and set the payment data of a student for
87        the payment category specified.
[12902]88        """
[7150]89
[12902]90    def increaseMatricInteger(student):
91        """Increase counter for matric numbers.
92
93        This counter can be a centrally stored attribute or an attribute of
94        faculties, departments or certificates. In the base package the counter
95        is as an attribute of the site configuration object.
[7150]96        """
97
[12902]98    def constructMatricNumber(student):
99        """Fetch the matric number counter which fits the student and
100        construct the new matric number of the student.
101
102        In the base package the counter is returned which is as an attribute
103        of the site configuration object.
104        """
105
[11589]106    def setMatricNumber(student):
107        """Set matriculation number of student.
108
109        If the student's matric number is unset a new matric number is
[12902]110        constructed according to the matriculation number construction rules
111        defined in the constructMatricNumber method. The new matric number is
112        set, the students catalog updated. The corresponding matric number
113        counter is increased by one.
[11589]114
115        This method is tested but not used in the base package. It can
116        be used in custom packages by adding respective views
[12902]117        and by customizing increaseMatricInteger and constructMatricNumber
118        according to the university's matriculation number construction rules.
[11589]119
[12902]120        The method can be disabled by setting the counter to zero.
[11589]121        """
122
[7186]123    def getAccommodation_details(student):
[7150]124        """Determine the accommodation dates of a student.
125        """
126
[7186]127    def selectBed(available_beds):
[7150]128        """Select a bed from a list of available beds.
129        In the standard configuration we select the first bed found,
130        but can also randomize the selection if we like.
131        """
132
[14655]133    def getDegreeClassNumber(level_obj):
134        """Get degree class number (used for SessionResultsPresentation
135        reports).
136        """
137
[9949]138    def getPDFCreator(context):
139        """Get some IPDFCreator instance suitable for use with `context`.
140        """
141
[7186]142    def renderPDF(view, subject='', filename='slip.pdf',):
[7150]143        """Render pdf slips for various pages.
144        """
145
[14655]146    def renderPDFAdmissionLetter(view, student=None, omit_fields=(),
147                                 pre_text=None, post_text=None,):
148        """Render pdf admission letter.
[14157]149        """
150
[14583]151    def renderPDFTranscript(view, filename, student,
152                  studentview, note, signatures, sigs_in_footer,
153                  show_scans, topMargin, omit_fields,
154                  tableheader, no_passport):
155        """Render pdf slip of a transcripts.
156        """
157
[14702]158    def renderPDFCourseticketsOverview(
[15423]159                  view, name, session, data, lecturers, orientation,
[15246]160                  title_length, note):
[14583]161        """Render pdf slip of course tickets for a lecturer.
162        """
163
[14584]164    def warnCreditsOOR(studylevel, course=None):
165        """Return message if credits are out of range. In the base
166        package only maximum credits is set.
[14583]167        """
168
169    def getBedCoordinates(bedticket):
170        """Return descriptive bed coordinates.
171        This method can be used to customize the `display_coordinates`
172        property method in order to  display a
173        customary description of the bed space.
174        """
175
176    def clearance_disabled_message(student):
177        """Render message if clearance is disabled.
178        """
179
[7819]180class IStudentsContainer(IKofaObject):
[7096]181    """A students container contains university students.
[6692]182    """
183    def addStudent(student):
184        """Add an IStudent object and subcontainers.
185        """
186
[13736]187    unique_student_id = Attribute('A unique student id')
[8408]188
[9217]189class IStudentNavigation(IStudentNavigationBase):
[13003]190    """Interface needed for navigation and logging. This interface is
[13076]191    implemented by all content classes in the students section.
[6642]192    """
[13003]193    student = Attribute('Student object of context')
[7150]194
[8735]195    def writeLogMessage(view, message):
[13167]196        """Add an INFO message to students.log.
[8735]197        """
198
[7819]199class IStudentBase(IKofaObject):
[6631]200    """Representation of student base data.
[6621]201    """
[12997]202    history = Attribute('Object history, a list of messages')
203    state = Attribute('Registration state')
[13080]204    translated_state = Attribute('Real name of the registration state')
[12997]205    certcode = Attribute('Certificate code of any chosen study course')
206    depcode = Attribute('Department code of any chosen study course')
207    faccode = Attribute('Faculty code of any chosen study course')
208    entry_session = Attribute('Entry session')
209    current_session = Attribute('Current session')
210    current_level = Attribute('Current level')
211    current_mode = Attribute('Current mode')
212    current_verdict = Attribute('Current verdict')
[7364]213    fullname = Attribute('All name parts separated by hyphens')
[12997]214    display_fullname = Attribute('Fullname as displayed on pages')
[8969]215    is_postgrad = Attribute('True if postgraduate student')
[12997]216    is_special_postgrad = Attribute('True if special postgraduate student')
217    is_fresh = Attribute('True if fresh student')
218    before_payment = Attribute('True if no previous payment has to be made')
219    personal_data_expired = Attribute('True if personal data expired')
220    transcript_enabled = Attribute('True if transcript processing is enabled')
[13103]221    clearance_locked = Attribute('True if clearance form is locked')
[15163]222    studycourse_locked = Attribute(
223        'True if nobody is allowed to change studycourse, studylecel or '
224        'course ticket data, neither through the UI nor via import')
[6637]225
[13003]226    password = Attribute('Encrypted password')
227    temp_password = Attribute('Dictionary with user name, timestamp and encrypted password')
[15606]228    parents_password = Attribute('Dictionary with student_id, timestamp and encrypted password')
[13003]229
[8983]230    suspended = schema.Bool(
231        title = _(u'Account suspended'),
232        default = False,
[9035]233        required = False,
[8983]234        )
235
[9702]236    suspended_comment = schema.Text(
237        title = _(u"Reasons for Deactivation"),
238        required = False,
239        description = _(
240            u'This message will be shown if and only if deactivated '
241            'students try to login.'),
242        )
243
[13711]244    flash_notice = schema.TextLine(
245        title = _(u'Flash Notice'),
246        required = False,
247        readonly = False,
248        description = _(
249            u'This single-line message will be shown in a flash box.'),
250        )
251
[6665]252    student_id = schema.TextLine(
[7723]253        title = _(u'Student Id'),
[6849]254        required = False,
[6665]255        )
256
[7357]257    firstname = schema.TextLine(
[7723]258        title = _(u'First Name'),
[6621]259        required = True,
260        )
261
[7357]262    middlename = schema.TextLine(
[7723]263        title = _(u'Middle Name'),
[7357]264        required = False,
265        )
266
267    lastname = schema.TextLine(
[7723]268        title = _(u'Last Name (Surname)'),
[7357]269        required = True,
270        )
271
[6996]272    sex = schema.Choice(
[7723]273        title = _(u'Sex'),
[6996]274        source = GenderSource(),
275        required = True,
276        )
277
[6788]278    reg_number = TextLineChoice(
[7723]279        title = _(u'Registration Number'),
[6696]280        required = True,
281        readonly = False,
[6788]282        source = contextual_reg_num_source,
[6696]283        )
284
[6788]285    matric_number = TextLineChoice(
[7723]286        title = _(u'Matriculation Number'),
[6750]287        required = False,
288        readonly = False,
[6788]289        source = contextual_mat_num_source,
[6750]290        )
291
[6769]292    adm_code = schema.TextLine(
[7723]293        title = _(u'PWD Activation Code'),
[6769]294        required = False,
[8977]295        readonly = False,
[6769]296        )
297
[7133]298    email = schema.ASCIILine(
[7723]299        title = _(u'Email'),
[13345]300        required = False,
[7133]301        constraint=validate_email,
302        )
[8176]303    phone = PhoneNumber(
[7723]304        title = _(u'Phone'),
[7133]305        required = False,
306        )
307
[9334]308    def setTempPassword(user, password):
309        """Set a temporary password (LDAP-compatible) SSHA encoded for
310        officers.
311        """
312
313    def getTempPassword():
314        """Check if a temporary password has been set and if it
[12997]315        is not expired. Return the temporary password if valid,
[9334]316        None otherwise. Unset the temporary password if expired.
317        """
318
[15606]319    def setParentsPassword(password):
320        """Set a parents password (LDAP-compatible) SSHA encoded for
321        parents.
322        """
323
324    def getParentsPassword():
325        """Check if a parents password has been set and if it
326        is not expired.
327
328        Return the parents password if valid,
329        None otherwise. Unset the parents password if expired.
330        """
331
[9131]332    def transfer(certificate, current_session,
333        current_level, current_verdict):
334        """ Creates a new studycourse and backups the old one.
[12997]335        """
[9131]336
[12997]337    def revert_transfer():
338        """ Revert previous transfer.
[9131]339        """
340
[7993]341class IUGStudentClearance(IKofaObject):
342    """Representation of undergraduate student clearance data.
[6631]343    """
[9543]344    officer_comment = schema.Text(
345        title = _(u"Officer's Comment"),
346        required = False,
[6631]347        )
348
[6769]349    clr_code = schema.TextLine(
[7723]350        title = _(u'CLR Activation Code'),
[6769]351        required = False,
[8977]352        readonly = False,
[6769]353        )
354
[9543]355    date_of_birth = FormattedDate(
356        title = _(u'Date of Birth'),
357        required = True,
358        show_year = True,
359        )
360
[7523]361    nationality = schema.Choice(
[8069]362        vocabulary = nats_vocab,
[7723]363        title = _(u'Nationality'),
[7983]364        required = False,
[7523]365        )
366
[7993]367class IPGStudentClearance(IUGStudentClearance):
368    """Representation of postgraduate student clearance data.
369    """
370    employer = schema.TextLine(
371        title = _(u'Employer'),
372        required = False,
373        readonly = False,
374        )
375
[7819]376class IStudentPersonal(IKofaObject):
[6631]377    """Representation of student personal data.
378    """
[9543]379    personal_updated = schema.Datetime(
380        title = _(u'Updated'),
381        required = False,
382        readonly = False,
383        )
384
[6651]385    perm_address = schema.Text(
[7723]386        title = _(u'Permanent Address'),
[6631]387        required = False,
388        )
389
[8008]390class IStudent(IStudentBase,IUGStudentClearance,IPGStudentClearance,
[15163]391    IStudentPersonal):
[6631]392    """Representation of a student.
393    """
394
[9563]395class IStudentPersonalEdit(IStudentPersonal):
396    """Interface for editing personal data by students.
397    Here we can repeat the fields from IStudentPersonal and set the
398    `required` if necessary.
399    """
400
401    perm_address = schema.Text(
402        title = _(u'Permanent Address'),
403        required = True,
404        )
405
[6849]406class IStudentUpdateByRegNo(IStudent):
407    """Representation of a student. Skip regular reg_number validation.
408    """
409    reg_number = schema.TextLine(
[7723]410        title = _(u'Registration Number'),
[6849]411        required = False,
412        )
413
414class IStudentUpdateByMatricNo(IStudent):
415    """Representation of a student. Skip regular matric_number validation.
416    """
417    matric_number = schema.TextLine(
[7723]418        title = _(u'Matriculation Number'),
[6849]419        required = False,
420        )
421
[8779]422class IStudentRequestPW(IStudent):
[12999]423    """Representation of a student for first-time password request.
[8779]424    This interface is used when students use the requestpw page to
425    login for the the first time.
426    """
[8854]427    number = schema.TextLine(
428        title = _(u'Registr. or Matric. Number'),
[8779]429        required = True,
430        )
431
432    firstname = schema.TextLine(
433        title = _(u'First Name'),
434        required = True,
435        )
436
437    email = schema.ASCIILine(
438        title = _(u'Email Address'),
439        required = True,
440        constraint=validate_email,
441        )
442
[7819]443class IStudentStudyCourse(IKofaObject):
[12999]444    """Representation of student study course data.
[6633]445    """
[13002]446    next_session_allowed = Attribute('True if the student can proceed to next session')
447    is_postgrad = Attribute('True if student is postgraduate student')
448    is_current = Attribute('True if the study course is the current course of studies')
449    is_previous = Attribute('True if the study course is the previous course of studies')
450
[6648]451    certificate = schema.Choice(
[7723]452        title = _(u'Certificate'),
[6648]453        source = CertificateSource(),
[7209]454        required = False,
[6633]455        )
[6635]456
[6996]457    entry_mode = schema.Choice(
[7723]458        title = _(u'Entry Mode'),
[7681]459        source = StudyModeSource(),
[6996]460        required = True,
461        readonly = False,
462        )
463
464    entry_session = schema.Choice(
[7723]465        title = _(u'Entry Session'),
[6996]466        source = academic_sessions_vocab,
[7425]467        #default = datetime.now().year,
[6996]468        required = True,
469        readonly = False,
470        )
471
[6724]472    current_session = schema.Choice(
[7723]473        title = _(u'Current Session'),
[6744]474        source = academic_sessions_vocab,
[6724]475        required = True,
[6996]476        readonly = False,
[6724]477        )
478
479    current_level = schema.Choice(
[7723]480        title = _(u'Current Level'),
[6725]481        source = StudyLevelSource(),
482        required = False,
[6996]483        readonly = False,
[6724]484        )
485
486    current_verdict = schema.Choice(
[7723]487        title = _(u'Current Verdict'),
[7619]488        source = VerdictSource(),
[8820]489        default = '0',
[6725]490        required = False,
[6724]491        )
492
493    previous_verdict = schema.Choice(
[7723]494        title = _(u'Previous Verdict'),
[7619]495        source = VerdictSource(),
[8820]496        default = '0',
[6725]497        required = False,
[6724]498        )
499
[13002]500    def addStudentStudyLevel(cert, studylevel):
501        """Add a study level object.
502        """
503
504    def getTranscriptData():
505        """Get a sorted list of dicts with level and course ticket data.
506        This method is used for transcripts.
507        """
508
[9138]509class IStudentStudyCourseTransfer(IStudentStudyCourse):
[12999]510    """An interface used for student transfers.
[9138]511    """
512    certificate = schema.Choice(
513        title = _(u'Certificate'),
514        source = CertificateSource(),
515        required = True,
516        )
517
518    current_level = schema.Choice(
519        title = _(u'Current Level'),
520        source = StudyLevelSource(),
521        required = True,
522        readonly = False,
523        )
524
[9960]525    entry_session = schema.Choice(
526        title = _(u'Entry Session'),
527        source = academic_sessions_vocab,
528        #default = datetime.now().year,
529        required = False,
530        readonly = False,
531        )
532
533
[9138]534IStudentStudyCourseTransfer['certificate'].order = IStudentStudyCourse[
535    'certificate'].order
536IStudentStudyCourseTransfer['current_level'].order = IStudentStudyCourse[
537    'current_level'].order
538
[7951]539class IStudentVerdictUpdate(IKofaObject):
540    """A interface for verdict imports.
541    """
542    current_verdict = schema.Choice(
543        title = _(u'Current Verdict'),
544        source = VerdictSource(),
545        required = True,
546        )
547
548    current_session = schema.Choice(
549        title = _(u'Current Session'),
550        source = academic_sessions_vocab,
551        required = True,
552        )
553
554    current_level = schema.Choice(
555        title = _(u'Current Level'),
556        source = StudyLevelSource(),
557        required = True,
558        )
559
[9296]560    bypass_validation = schema.Bool(
561        title = _(u'Bypass validation'),
562        required = False,
563        )
564
565    validated_by = schema.TextLine(
566        title = _(u'Validated by'),
567        required = False,
568        )
569
[7819]570class IStudentStudyLevel(IKofaObject):
[12999]571    """A representation of student study level data.
[6774]572    """
[13002]573    certcode = Attribute('The certificate code of the study course')
574    is_current_level = Attribute('True if level is current level of the student')
575    level_title = Attribute('Level title from source')
576    getSessionString = Attribute('Session title from source')
[9235]577    number_of_tickets = Attribute('Number of tickets contained in this level')
[10553]578    passed_params = Attribute('Information about passed and failed courses')
[13002]579    gpa_params_rectified = Attribute('Corrected sessional GPA parameters')
580    gpa_params = Attribute('GPA parameters for this level.')
[14247]581    cumulative_params = Attribute(
582        'Cumulative GPA and other cumulative parameters for this level')
583    course_registration_forbidden = Attribute(
584        'Return error message if course registration is forbidden')
[6774]585
[12873]586    level = schema.Choice(
587        title = _(u'Level'),
588        source = StudyLevelSource(),
589        required = True,
590        readonly = False,
591        )
592
[6793]593    level_session = schema.Choice(
[7723]594        title = _(u'Session'),
[6793]595        source = academic_sessions_vocab,
[9437]596        required = True,
[6793]597        )
[6781]598
[6793]599    level_verdict = schema.Choice(
[7723]600        title = _(u'Verdict'),
[7619]601        source = VerdictSource(),
[8820]602        default = '0',
[6793]603        required = False,
604        )
605
[9161]606    validated_by = schema.TextLine(
607        title = _(u'Validated by'),
608        default = None,
609        required = False,
610        )
611
612    validation_date = schema.Datetime(
613        title = _(u'Validation Date'),
614        required = False,
615        readonly = False,
616        )
617
[9690]618    total_credits = schema.Int(
619        title = _(u'Total Credits'),
620        required = False,
621        readonly = True,
622        )
623
[14574]624    gpa = schema.TextLine(
[10479]625        title = _(u'Unrectified GPA'),
626        required = False,
627        readonly = True,
628        )
[9690]629
[15333]630    transcript_remark = schema.TextLine(
631        title = _(u'Transcript Remark'),
632        required = False,
633        readonly = False,
634        )
635
[8920]636    def addCourseTicket(ticket, course):
[8182]637        """Add a course ticket object.
638        """
639
[9501]640    def addCertCourseTickets(cert):
641        """Collect all certificate courses and create course
642        tickets automatically.
643        """
644
[14684]645    def updateCourseTicket(ticket, course):
646        """Updates a course ticket object and return code
647        if ticket has been invalidated.
648        """
649
[7819]650class ICourseTicket(IKofaObject):
[12999]651    """A representation of course ticket data.
[6781]652    """
[13003]653    certcode = Attribute('Certificate code of the study course')
654    level_session = Attribute('Session of the study level the ticket has been added to')
655    level = Attribute('Level value of the study level the ticket has been added to')
[14133]656    total_score = Attribute('Score')
657    grade = Attribute('Grade calculated from total score')
658    weight = Attribute('Weight calculated from total score')
[13003]659    removable_by_student = Attribute('True if student is allowed to remove the ticket')
660    editable_by_lecturer = Attribute('True if lecturer is allowed to edit the ticket')
[6781]661
[13003]662    code = Attribute('Code of the original course')
663
[9420]664    title = schema.TextLine(
665        title = _(u'Title'),
666        required = False,
667        )
668
669    fcode = schema.TextLine(
670        title = _(u'Faculty Code'),
671        required = False,
672        )
673
674    dcode = schema.TextLine(
675        title = _(u'Department Code'),
676        required = False,
677        )
678
679    semester = schema.Choice(
680        title = _(u'Semester/Term'),
681        source = SemesterSource(),
682        required = False,
683        )
684
[15203]685    ticket_session = schema.Choice(
686        title = _(u'Imported Session'),
687        source = academic_sessions_vocab,
688        required = False,
689        )
690
[9420]691    passmark = schema.Int(
692        title = _(u'Passmark'),
693        required = False,
694        )
695
696    credits = schema.Int(
697        title = _(u'Credits'),
698        required = False,
699        )
700
[7665]701    mandatory = schema.Bool(
[9320]702        title = _(u'Required'),
[6795]703        default = False,
704        required = False,
705        )
706
[14574]707    outstanding = schema.Bool(
708        title = _(u'Outstanding Course'),
709        default = False,
710        required = False,
711        )
712
[14642]713    course_category = schema.Choice(
714        title = _(u'Course Category'),
715        source = CourseCategorySource(),
716        required = False,
717        )
718
[6781]719    score = schema.Int(
[7723]720        title = _(u'Score'),
[9684]721        default = None,
[6781]722        required = False,
[10637]723        missing_value = None,
[6781]724        )
725
[7661]726    carry_over = schema.Bool(
[7723]727        title = _(u'Carry-over Course'),
[7661]728        default = False,
729        required = False,
730        )
731
[9420]732    automatic = schema.Bool(
733        title = _(u'Automatical Creation'),
734        default = False,
[9316]735        required = False,
736        )
737
[9420]738class ICourseTicketAdd(IKofaObject):
[7150]739    """An interface for adding course tickets.
[6795]740    """
741    course = schema.Choice(
[7723]742        title = _(u'Course'),
[6795]743        source = CourseSource(),
744        readonly = False,
745        )
746
[9420]747class ICourseTicketImport(ICourseTicket):
748    """An interface for importing course results and nothing more.
749    """
750    score = schema.Int(
751        title = _(u'Score'),
752        required = False,
753        readonly = False,
754        )
755
756    level_session = schema.Choice(
757        title = _(u'Level Session'),
758        source = academic_sessions_vocab,
759        required = False,
760        readonly = False,
761        )
762
[7819]763class IStudentAccommodation(IKofaObject):
[6635]764    """A container for student accommodation objects.
765    """
766
[13457]767    desired_hostel = schema.TextLine(
768        title = _(u'Desired Hostel'),
769        required = False,
770        )
771
[9423]772    def addBedTicket(bedticket):
773        """Add a bed ticket object.
774        """
775
776
[7819]777class IBedTicket(IKofaObject):
[12999]778    """A representation of accommodation booking data.
[6989]779    """
[13314]780    bed = Attribute('The bed object')
781    maint_payment_made = Attribute('True if maintenance payment is made')
[6996]782
[13012]783    display_coordinates = schema.TextLine(
784        title = _(u'Allocated Bed'),
785        required = False,
786        readonly = True,
787        )
788
[6996]789    bed_coordinates = schema.TextLine(
[9984]790        title = u'',
[9423]791        required = True,
[7014]792        readonly = False,
[6992]793        )
794
[6996]795    bed_type = schema.TextLine(
[9424]796        title = _(u'Requested Bed Type'),
[9423]797        required = True,
[7014]798        readonly = False,
[6996]799        )
800
[6992]801    booking_session = schema.Choice(
[7723]802        title = _(u'Session'),
[6992]803        source = academic_sessions_vocab,
804        required = True,
[13316]805        readonly = False
[6992]806        )
807
[8170]808    booking_date = schema.Datetime(
[7723]809        title = _(u'Booking Date'),
[6992]810        required = False,
[13316]811        readonly = False,
[6992]812        )
813
814    booking_code = schema.TextLine(
[7723]815        title = _(u'Booking Activation Code'),
[6992]816        required = False,
[13316]817        readonly = False,
[6992]818        )
819
[6994]820    def getSessionString():
[13012]821        """Returns the title of academic_sessions_vocab term of the session
822        when the bed was booked.
[6994]823        """
[6992]824
[6860]825class IStudentPaymentsContainer(IPaymentsContainer):
[6635]826    """A container for student payment objects.
827    """
828
[13736]829    certificate = Attribute('Certificate to determine the correct p_level value')
830
[6877]831class IStudentOnlinePayment(IOnlinePayment):
832    """A student payment via payment gateways.
833    """
834
[13736]835    certificate = Attribute('Certificate to determine the correct p_level value')
[13871]836    student = Attribute('Student')
[13736]837
[9148]838    p_current = schema.Bool(
839        title = _(u'Current Session Payment'),
840        default = True,
841        required = False,
842        )
843
[13733]844    p_level = schema.Choice(
[8268]845        title = _(u'Payment Level'),
[13733]846        source = StudyLevelSource(),
[8268]847        required = False,
848        )
[6877]849
[13871]850    def redeemTicket():
851        """Either create an appropriate access code or trigger an action
852        directly.
853        """
854
[8422]855    def doAfterStudentPayment():
856        """Process student after payment was made.
857        """
858
[8453]859    def doAfterStudentPaymentApproval():
860        """Process student after payment was approved.
861        """
862
[8420]863    def approveStudentPayment():
[8422]864        """Approve payment and process student.
[8420]865        """
866
[8268]867IStudentOnlinePayment['p_level'].order = IStudentOnlinePayment[
868    'p_session'].order
[8408]869
[9864]870class IStudentPreviousPayment(IKofaObject):
[9148]871    """An interface for adding previous session payments.
872    """
873
[9864]874    p_category = schema.Choice(
875        title = _(u'Payment Category'),
876        default = u'schoolfee',
877        source = PreviousPaymentCategorySource(),
878        required = True,
879        )
880
[9148]881    p_session = schema.Choice(
882        title = _(u'Payment Session'),
883        source = academic_sessions_vocab,
884        required = True,
885        )
886
887    p_level = schema.Choice(
888        title = _(u'Payment Level'),
889        source = StudyLevelSource(),
890        required = True,
891        )
892
[9864]893class IStudentBalancePayment(IKofaObject):
894    """An interface for adding balances.
895    """
896
[9868]897    p_category = schema.Choice(
[9864]898        title = _(u'Payment Category'),
899        default = u'schoolfee',
900        required = True,
[9868]901        source = BalancePaymentCategorySource(),
[9864]902        )
903
904    balance_session = schema.Choice(
905        title = _(u'Payment Session'),
906        source = academic_sessions_vocab,
907        required = True,
908        )
909
910    balance_level = schema.Choice(
911        title = _(u'Payment Level'),
912        source = StudyLevelSource(),
913        required = True,
914        )
915
916    balance_amount = schema.Float(
917        title = _(u'Balance Amount'),
[9874]918        default = None,
[9864]919        required = True,
920        readonly = False,
921        description = _(
922            u'Balance in Naira '),
923        )
924
[8408]925class ICSVStudentExporter(ICSVExporter):
926    """A regular ICSVExporter that additionally supports exporting
927      data from a given student object.
928    """
[9801]929    def get_filtered(site, **kw):
[9797]930        """Get a filtered set of students.
931        """
[8408]932
[12518]933    def get_selected(site, selected):
934        """Get set of selected students.
935        """
936
[8408]937    def export_student(student, filepath=None):
938        """Export data for a given student.
939        """
[9734]940
[9797]941    def export_filtered(site, filepath=None, **kw):
[12518]942        """Export data for filtered set of students.
[9734]943        """
[12518]944
945    def export_selected(site, filepath=None, **kw):
946        """Export data for selected set of students.
947        """
Note: See TracBrowser for help on using the repository browser.