source: main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py @ 7310

Last change on this file since 7310 was 7304, checked in by Henrik Bettermann, 13 years ago

Insert container content table on pdf slips. Use this automatic insertion for course ticket lists on ExportPDFCourseRegistrationSlipPages.

ToDo?: The table does not show up if there are too many lines and it thus doesn't fit on the page.

  • Property svn:keywords set to Id
File size: 11.5 KB
RevLine 
[7191]1## $Id: interfaces.py 7304 2011-12-07 08:53:50Z 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##
[6996]18from datetime import datetime
[7256]19from zope.interface import Attribute, Interface
[6621]20from zope import schema
[7221]21from waeup.sirp.interfaces import (
22    IWAeUPObject, academic_sessions_vocab, validate_email)
[6788]23from waeup.sirp.schema import TextLineChoice
[6874]24from waeup.sirp.university.vocabularies import CourseSource, study_modes
[6648]25from waeup.sirp.students.vocabularies import (
[7214]26  CertificateSource, verdicts, StudyLevelSource,
[6996]27  contextual_reg_num_source, contextual_mat_num_source, GenderSource,
[6648]28  )
[6877]29from waeup.sirp.payments.interfaces import IPaymentsContainer, IOnlinePayment
[6621]30
[7150]31class IStudentsUtils(Interface):
32    """A collection of methods which are subject to customization.
33
34    """
[7186]35    def getPaymentDetails(category, student):
[7150]36        """Get the payment dates of a student for the payment category
37        specified.
38
39        """
40
[7186]41    def getAccommodation_details(student):
[7150]42        """Determine the accommodation dates of a student.
43
44        """
45
[7186]46    def selectBed(available_beds):
[7150]47        """Select a bed from a list of available beds.
48
49        In the standard configuration we select the first bed found,
50        but can also randomize the selection if we like.
51        """
52
[7186]53    def renderPDF(view, subject='', filename='slip.pdf',):
[7150]54        """Render pdf slips for various pages.
55
56        """
57
[6692]58class IStudentsContainer(IWAeUPObject):
[7096]59    """A students container contains university students.
[6692]60
61    """
62    def addStudent(student):
63        """Add an IStudent object and subcontainers.
64
65        """
66
67    def archive(id=None):
68        """Create on-dist archive of students.
69
70        If id is `None`, all students are archived.
71
72        If id contains a single id string, only the respective
73        students are archived.
74
75        If id contains a list of id strings all of the respective
76        students types are saved to disk.
77        """
78
79    def clear(id=None, archive=True):
80        """Remove students of type given by 'id'.
81
82        Optionally archive the students.
83
84        If id is `None`, all students are archived.
85
86        If id contains a single id string, only the respective
87        students are archived.
88
89        If id contains a list of id strings all of the respective
90        student types are saved to disk.
91
92        If `archive` is ``False`` none of the archive-handling is done
93        and respective students are simply removed from the
94        database.
95        """
96
[6642]97class IStudentNavigation(IWAeUPObject):
98    """Interface needed for student navigation.
[7150]99
[6642]100    """
101    def getStudent():
102        """Return student object.
[7150]103
[6642]104        """
105
[6631]106class IStudentBase(IWAeUPObject):
107    """Representation of student base data.
[7150]108
[6621]109    """
[7062]110    history = Attribute('Object history, a list of messages')
[6637]111    state = Attribute('Returns the registration state of a student')
[6699]112    password = Attribute('Encrypted password of a student')
[7203]113    certcode = Attribute('The certificate code of any chosen study course')
114    depcode = Attribute('The department code of any chosen study course')
115    faccode = Attribute('The faculty code of any chosen study course')
[7062]116    current_session = Attribute('The current session of the student')
[6637]117
118    def loggerInfo(ob_class, comment):
[7150]119        """Adds an INFO message to the log file.
120
[6637]121        """
122
[6665]123    student_id = schema.TextLine(
[7240]124        title = u'Student Id',
[6849]125        required = False,
[6665]126        )
127
[6818]128    fullname = schema.TextLine(
[6631]129        title = u'Full Name',
[6818]130        default = None,
[6621]131        required = True,
132        )
133
[6996]134    sex = schema.Choice(
135        title = u'Sex',
136        source = GenderSource(),
137        default = u'm',
138        required = True,
139        )
140
[6788]141    reg_number = TextLineChoice(
[6696]142        title = u'Registration Number',
[6818]143        default = None,
[6696]144        required = True,
145        readonly = False,
[6788]146        source = contextual_reg_num_source,
[6696]147        )
148
[6788]149    matric_number = TextLineChoice(
[6750]150        title = u'Matriculation Number',
[6788]151        #default = u'',
[6750]152        required = False,
153        readonly = False,
[6788]154        source = contextual_mat_num_source,
[6750]155        )
156
[6769]157    adm_code = schema.TextLine(
[6935]158        title = u'PWD Activation Code',
[6769]159        default = u'',
160        required = False,
161        readonly = True,
162        )
163
[7133]164    email = schema.ASCIILine(
165        title = u'Email',
166        required = False,
167        constraint=validate_email,
168        )
169    phone = schema.Int(
170        title = u'Phone',
171        description = u'Enter phone number with country code and without spaces.',
172        required = False,
173        )
174
[6631]175class IStudentClearance(IWAeUPObject):
176    """Representation of student clearance data.
[7150]177
[6631]178    """
179    date_of_birth = schema.Date(
180        title = u'Date of Birth',
181        required = True,
182        )
183
[6695]184    clearance_locked = schema.Bool(
185        title = u'Clearance form locked',
186        default = False,
187        )
188
[6769]189    clr_code = schema.TextLine(
[6935]190        title = u'CLR Activation Code',
[6769]191        default = u'',
192        required = False,
193        readonly = True,
194        )
195
[6631]196class IStudentPersonal(IWAeUPObject):
197    """Representation of student personal data.
[7150]198
[6631]199    """
[6651]200    perm_address = schema.Text(
[6631]201        title = u'Permanent Address',
202        required = False,
203        )
204
205class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
206    """Representation of a student.
[7150]207
[6631]208    """
209
[6849]210class IStudentUpdateByRegNo(IStudent):
211    """Representation of a student. Skip regular reg_number validation.
[7150]212
[6849]213    """
214    reg_number = schema.TextLine(
215        title = u'Registration Number',
216        default = None,
217        required = False,
218        )
219
220class IStudentUpdateByMatricNo(IStudent):
221    """Representation of a student. Skip regular matric_number validation.
[7150]222
[6849]223    """
224    matric_number = schema.TextLine(
225        title = u'Matriculation Number',
226        default = None,
227        required = False,
228        )
229
[6633]230class IStudentStudyCourse(IWAeUPObject):
231    """A container for student study levels.
232
233    """
[6648]234    certificate = schema.Choice(
235        title = u'Certificate',
236        source = CertificateSource(),
237        default = None,
[7209]238        required = False,
[6633]239        )
[6635]240
[6996]241
242    entry_mode = schema.Choice(
243        title = u'Entry Mode',
244        vocabulary = study_modes,
245        default = u'ug_ft',
246        required = True,
247        readonly = False,
248        )
249
250    entry_session = schema.Choice(
251        title = u'Entry Session',
252        source = academic_sessions_vocab,
253        default = datetime.now().year,
254        required = True,
255        readonly = False,
256        )
257
[6724]258    current_session = schema.Choice(
259        title = u'Current Session',
[6744]260        source = academic_sessions_vocab,
[6724]261        default = None,
262        required = True,
[6996]263        readonly = False,
[6724]264        )
265
266    current_level = schema.Choice(
267        title = u'Current Level',
[6725]268        source = StudyLevelSource(),
[6724]269        default = None,
[6725]270        required = False,
[6996]271        readonly = False,
[6724]272        )
273
274    current_verdict = schema.Choice(
275        title = u'Current Verdict',
276        source = verdicts,
[6804]277        default = '0',
[6725]278        required = False,
[6724]279        )
280
281    previous_verdict = schema.Choice(
282        title = u'Previous Verdict',
283        source = verdicts,
[6805]284        default = '0',
[6725]285        required = False,
[6724]286        )
287
[6825]288class IStudentStudyCourseImport(IStudentStudyCourse):
289    """A container for student study levels.
290
291    """
292    current_level = schema.Int(
293        title = u'Current Level',
294        default = None,
295        )
296
[6774]297class IStudentStudyLevel(IWAeUPObject):
298    """A container for course tickets.
299
300    """
301    level = Attribute('The level code')
[6793]302    validation_date = Attribute('The date of validation')
303    validated_by = Attribute('User Id of course adviser')
[6774]304
[6793]305    level_session = schema.Choice(
306        title = u'Session',
307        source = academic_sessions_vocab,
308        default = None,
309        required = True,
310        )
[6781]311
[6793]312    level_verdict = schema.Choice(
313        title = u'Verdict',
314        source = verdicts,
[6805]315        default = '0',
[6793]316        required = False,
317        )
318
[6781]319class ICourseTicket(IWAeUPObject):
320    """A course ticket.
321
322    """
[6783]323    code = Attribute('code of the original course')
324    title = Attribute('title of the original course')
325    credits = Attribute('credits of the original course')
326    passmark = Attribute('passmark of the original course')
327    semester = Attribute('semester of the original course')
328    faculty = Attribute('faculty of the original course')
329    department = Attribute('department of the original course')
[7304]330    fcode = Attribute('faculty code of the original course')
331    dcode = Attribute('department code of the original course')
[6781]332
[6795]333    core_or_elective = schema.Bool(
334        title = u'Mandatory',
335        default = False,
336        required = False,
337        readonly = False,
338        )
339
[6781]340    score = schema.Int(
341        title = u'Score',
342        default = 0,
343        required = False,
344        readonly = False,
345        )
346
[6806]347    automatic = schema.Bool(
348        title = u'Automatical Creation',
349        default = False,
350        required = False,
351        readonly = True,
352        )
353
[6795]354class ICourseTicketAdd(ICourseTicket):
[7150]355    """An interface for adding course tickets.
[6795]356
357    """
358    course = schema.Choice(
359        title = u'Course',
360        source = CourseSource(),
361        readonly = False,
362        )
363
[6635]364class IStudentAccommodation(IWAeUPObject):
365    """A container for student accommodation objects.
366
367    """
368
[6989]369class IBedTicket(IWAeUPObject):
370    """A ticket for accommodation booking.
371
372    """
[6996]373    bed = Attribute('The bed object.')
374
375    bed_coordinates = schema.TextLine(
376        title = u'Bed Coordinates',
[6992]377        default = None,
378        required = False,
[7014]379        readonly = False,
[6992]380        )
381
[6996]382    bed_type = schema.TextLine(
383        title = u'Bed Type',
384        default = None,
385        required = False,
[7014]386        readonly = False,
[6996]387        )
388
[6992]389    booking_session = schema.Choice(
390        title = u'Session',
391        source = academic_sessions_vocab,
392        default = None,
393        required = True,
[7014]394        readonly = True,
[6992]395        )
396
397    booking_date = schema.Datetime(
398        title = u'Booking Date',
399        required = False,
[7014]400        readonly = True,
[6992]401        )
402
403    booking_code = schema.TextLine(
404        title = u'Booking Activation Code',
405        default = u'',
406        required = False,
[7014]407        readonly = True,
[6992]408        )
409
[6994]410    def getSessionString():
[7150]411        """Returns the the title of academic_sessions_vocab term.
412
[6994]413        """
[6992]414
[6860]415class IStudentPaymentsContainer(IPaymentsContainer):
[6635]416    """A container for student payment objects.
417
418    """
419
[6877]420class IStudentOnlinePayment(IOnlinePayment):
421    """A student payment via payment gateways.
422
423    """
424    p_session = schema.Choice(
425        title = u'Payment Session',
426        source = academic_sessions_vocab,
427        required = False,
428        )
429
430IStudentOnlinePayment['p_session'].order = IStudentOnlinePayment[
431    'p_item'].order
432
[6694]433# Interfaces for students only
434
435class IStudentClearanceEdit(IStudentClearance):
436    """Interface needed for restricted editing of student clearance data.
[7150]437
[6694]438    """
439
440class IStudentPersonalEdit(IStudentPersonal):
441    """Interface needed for restricted editing of student personal data.
[7150]442
[6694]443    """
Note: See TracBrowser for help on using the repository browser.