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

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

pyflakes

  • Property svn:keywords set to Id
File size: 11.4 KB
RevLine 
[7191]1## $Id: interfaces.py 7256 2011-12-03 05:46:52Z 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')
[6781]330
[6795]331    core_or_elective = schema.Bool(
332        title = u'Mandatory',
333        default = False,
334        required = False,
335        readonly = False,
336        )
337
[6781]338    score = schema.Int(
339        title = u'Score',
340        default = 0,
341        required = False,
342        readonly = False,
343        )
344
[6806]345    automatic = schema.Bool(
346        title = u'Automatical Creation',
347        default = False,
348        required = False,
349        readonly = True,
350        )
351
[6795]352class ICourseTicketAdd(ICourseTicket):
[7150]353    """An interface for adding course tickets.
[6795]354
355    """
356    course = schema.Choice(
357        title = u'Course',
358        source = CourseSource(),
359        readonly = False,
360        )
361
[6635]362class IStudentAccommodation(IWAeUPObject):
363    """A container for student accommodation objects.
364
365    """
366
[6989]367class IBedTicket(IWAeUPObject):
368    """A ticket for accommodation booking.
369
370    """
[6996]371    bed = Attribute('The bed object.')
372
373    bed_coordinates = schema.TextLine(
374        title = u'Bed Coordinates',
[6992]375        default = None,
376        required = False,
[7014]377        readonly = False,
[6992]378        )
379
[6996]380    bed_type = schema.TextLine(
381        title = u'Bed Type',
382        default = None,
383        required = False,
[7014]384        readonly = False,
[6996]385        )
386
[6992]387    booking_session = schema.Choice(
388        title = u'Session',
389        source = academic_sessions_vocab,
390        default = None,
391        required = True,
[7014]392        readonly = True,
[6992]393        )
394
395    booking_date = schema.Datetime(
396        title = u'Booking Date',
397        required = False,
[7014]398        readonly = True,
[6992]399        )
400
401    booking_code = schema.TextLine(
402        title = u'Booking Activation Code',
403        default = u'',
404        required = False,
[7014]405        readonly = True,
[6992]406        )
407
[6994]408    def getSessionString():
[7150]409        """Returns the the title of academic_sessions_vocab term.
410
[6994]411        """
[6992]412
[6860]413class IStudentPaymentsContainer(IPaymentsContainer):
[6635]414    """A container for student payment objects.
415
416    """
417
[6877]418class IStudentOnlinePayment(IOnlinePayment):
419    """A student payment via payment gateways.
420
421    """
422    p_session = schema.Choice(
423        title = u'Payment Session',
424        source = academic_sessions_vocab,
425        required = False,
426        )
427
428IStudentOnlinePayment['p_session'].order = IStudentOnlinePayment[
429    'p_item'].order
430
[6694]431# Interfaces for students only
432
433class IStudentClearanceEdit(IStudentClearance):
434    """Interface needed for restricted editing of student clearance data.
[7150]435
[6694]436    """
437
438class IStudentPersonalEdit(IStudentPersonal):
439    """Interface needed for restricted editing of student personal data.
[7150]440
[6694]441    """
Note: See TracBrowser for help on using the repository browser.