source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/interfaces.py @ 9017

Last change on this file since 9017 was 8968, checked in by Henrik Bettermann, 12 years ago

Add is_foreigner property.

  • Property svn:keywords set to Id
File size: 11.4 KB
Line 
1## $Id: interfaces.py 8968 2012-07-10 09:26:36Z henrik $
2##
3## Copyright (C) 2012 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##
18from zope import schema
19from zope.interface import Attribute
20from waeup.kofa.schema import TextLineChoice
21from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab
22from waeup.kofa.schema import FormattedDate
23from waeup.kofa.schoolgrades import ResultEntryField
24from waeup.kofa.students.vocabularies import nats_vocab
25from waeup.kofa.students.interfaces import (
26    IStudentBase, IUGStudentClearance, IPGStudentClearance,
27    IStudentPersonal, IStudentNavigation, IStudentStudyLevel,
28    IStudentStudyCourse, ICourseTicket
29    )
30from waeup.kofa.students.vocabularies import (
31    nats_vocab, contextual_reg_num_source)
32from kofacustom.nigeria.interfaces import (
33    high_qual, high_grade, exam_types, LGASource)
34from kofacustom.nigeria.interfaces import MessageFactory as _
35from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment
36
37
38class INigeriaStudentBase(IStudentBase):
39    """Representation of student base data.
40
41    """
42
43    reg_number = TextLineChoice(
44        title = _(u'Registration Number'),
45        required = False,
46        readonly = False,
47        source = contextual_reg_num_source,
48        )
49
50    is_staff = schema.Bool(
51        title = _(u'Staff Member'),
52        required = False,
53        readonly = False,
54        default = False,
55        )
56
57INigeriaStudentBase['reg_number'].order = IStudentBase[
58    'reg_number'].order
59
60class INigeriaStudentPersonal(IStudentPersonal):
61    """Student personal data.
62
63    """
64
65    is_foreigner = Attribute('True if student is non-Nigerian')
66
67    marit_stat = schema.Choice(
68        title = u'Maritual Status',
69        default = 'unmarried',
70        required = False,
71        vocabulary = SimpleKofaVocabulary(
72            (_('Unmarried'), 'unmarried'),
73            (_('Married'), 'married'),)
74        )
75
76    religion = schema.Choice(
77        title = u'Religion',
78        default = 'no_say',
79        required = False,
80        vocabulary = SimpleKofaVocabulary(
81            (_('Muslim'), 'muslim'),
82            (_('Christian'), 'christian'),
83            (_('Others'), 'others'),
84            (_('Prefer not to say'), 'no_say'),)
85        )
86
87    next_kin_name = schema.TextLine(
88        title = _(u'Next of Kin Name'),
89        required = False,
90        readonly = False,
91        )
92
93    next_kin_relation = schema.TextLine(
94        title = _(u'Next of Kin Relationship'),
95        required = False,
96        readonly = False,
97        )
98
99    next_kin_address = schema.Text(
100        title = _(u'Next of Kin Address'),
101        required = False,
102        readonly = False,
103        description = _(u'Please provide email address and/or phone number.'),
104        )
105
106    disabled = schema.Bool(
107        title = u'Disabled',
108        default = False,
109        required = False,
110        )
111
112class INigeriaUGStudentClearance(IUGStudentClearance):
113    """Representation of ug student clearance data.
114
115    """
116    date_of_birth = FormattedDate(
117        title = _(u'Date of Birth'),
118        required = False,
119        show_year = True,
120        )
121
122    nationality = schema.Choice(
123        source = nats_vocab,
124        title = _(u'Nationality'),
125        required = False,
126        )
127
128    lga = schema.Choice(
129        source = LGASource(),
130        title = _(u'State/LGA (Nigerians only)'),
131        required = False,
132        )
133
134    def_adm = schema.Bool(
135        title = _(u'Deferent of Admission'),
136        required = False,
137        readonly = False,
138        )
139
140    fst_sit_fname = schema.TextLine(
141        title = _(u'Full Name'),
142        required = False,
143        readonly = False,
144        )
145    fst_sit_no = schema.TextLine(
146        title = _(u'Exam Number'),
147        required = False,
148        readonly = False,
149        )
150
151    fst_sit_date = FormattedDate(
152        title = _(u'Exam Date'),
153        required = False,
154        readonly = False,
155        show_year = True,
156        )
157
158    fst_sit_type = schema.Choice(
159        title = _(u'Exam Type'),
160        required = False,
161        readonly = False,
162        vocabulary = exam_types,
163        )
164
165    fst_sit_results = schema.List(
166        title = _(u'Exam Results'),
167        value_type = ResultEntryField(),
168        required = False,
169        readonly = False,
170        default = [],
171        )
172
173    scd_sit_fname = schema.TextLine(
174        title = _(u'Full Name'),
175        required = False,
176        readonly = False,
177        )
178    scd_sit_no = schema.TextLine(
179        title = _(u'Exam Number'),
180        required = False,
181        readonly = False,
182        )
183
184    scd_sit_date = FormattedDate(
185        title = _(u'Exam Date'),
186        required = False,
187        readonly = False,
188        show_year = True,
189        )
190
191    scd_sit_type = schema.Choice(
192        title = _(u'Exam Type'),
193        required = False,
194        readonly = False,
195        vocabulary = exam_types,
196        )
197
198    scd_sit_results = schema.List(
199        title = _(u'Exam Results'),
200        value_type = ResultEntryField(),
201        required = False,
202        readonly = False,
203        default = [],
204        )
205
206    alr_fname = schema.TextLine(
207        title = _(u'Full Name'),
208        required = False,
209        readonly = False,
210        )
211    alr_no = schema.TextLine(
212        title = _(u'Exam Number'),
213        required = False,
214        readonly = False,
215        )
216
217    alr_date = FormattedDate(
218        title = _(u'Exam Date'),
219        required = False,
220        readonly = False,
221        show_year = True,
222        )
223
224    alr_results = schema.List(
225        title = _(u'Exam Results'),
226        value_type = ResultEntryField(),
227        required = False,
228        readonly = False,
229        default = [],
230        )
231
232    hq_type = schema.Choice(
233        title = _(u'Qualification Obtained'),
234        required = False,
235        readonly = False,
236        vocabulary = high_qual,
237        )
238
239    hq_matric_no = schema.TextLine(
240        title = _(u'Former Matric Number'),
241        required = False,
242        readonly = False,
243        )
244
245    hq_degree = schema.Choice(
246        title = _(u'Class of Degree'),
247        required = False,
248        readonly = False,
249        vocabulary = high_grade,
250        )
251
252    hq_school = schema.TextLine(
253        title = _(u'Institution Attended'),
254        required = False,
255        readonly = False,
256        )
257
258    hq_session = schema.TextLine(
259        title = _(u'Years Attended'),
260        required = False,
261        readonly = False,
262        )
263
264    hq_disc = schema.TextLine(
265        title = _(u'Discipline'),
266        required = False,
267        readonly = False,
268        )
269
270
271class INigeriaPGStudentClearance(INigeriaUGStudentClearance):
272    """Representation of pg student clearance data.
273
274    """
275
276    hq2_type = schema.Choice(
277        title = _(u'Qualification Obtained'),
278        required = False,
279        readonly = False,
280        vocabulary = high_qual,
281        )
282
283    hq2_matric_no = schema.TextLine(
284        title = _(u'Former Matric Number'),
285        required = False,
286        readonly = False,
287        )
288
289    hq2_degree = schema.Choice(
290        title = _(u'Class of Degree'),
291        required = False,
292        readonly = False,
293        vocabulary = high_grade,
294        )
295
296    hq2_school = schema.TextLine(
297        title = _(u'Institution Attended'),
298        required = False,
299        readonly = False,
300        )
301
302    hq2_session = schema.TextLine(
303        title = _(u'Years Attended'),
304        required = False,
305        readonly = False,
306        )
307
308    hq2_disc = schema.TextLine(
309        title = _(u'Discipline'),
310        required = False,
311        readonly = False,
312        )
313
314    nysc_year = schema.Int(
315        title = _(u'Nysc Year'),
316        required = False,
317        readonly = False,
318        )
319
320    nysc_location = schema.TextLine(
321        title = _(u'Nysc Location'),
322        required = False,
323        )
324
325    nysc_lga = schema.Choice(
326        source = LGASource(),
327        title = _(u'Nysc LGA'),
328        required = False,
329        )
330
331    employer = schema.TextLine(
332        title = _(u'Employer'),
333        required = False,
334        readonly = False,
335        )
336
337    emp_position = schema.TextLine(
338        title = _(u'Employer Position'),
339        required = False,
340        readonly = False,
341        )
342
343    emp_start = FormattedDate(
344        title = _(u'Start Date'),
345        required = False,
346        readonly = False,
347        show_year = True,
348        )
349
350    emp_end = FormattedDate(
351        title = _(u'End Date'),
352        required = False,
353        readonly = False,
354        show_year = True,
355        )
356
357    emp_reason = schema.TextLine(
358        title = _(u'Reason for Leaving'),
359        required = False,
360        readonly = False,
361        )
362
363    employer2 = schema.TextLine(
364        title = _(u'2nd Employer'),
365        required = False,
366        readonly = False,
367        )
368
369    emp2_position = schema.TextLine(
370        title = _(u'2nd Employer Position'),
371        required = False,
372        readonly = False,
373        )
374
375    emp2_start = FormattedDate(
376        title = _(u'Start Date'),
377        required = False,
378        readonly = False,
379        show_year = True,
380        )
381    emp2_end = FormattedDate(
382        title = _(u'End Date'),
383        required = False,
384        readonly = False,
385        show_year = True,
386        )
387
388    emp2_reason = schema.TextLine(
389        title = _(u'Reason for Leaving'),
390        required = False,
391        readonly = False,
392        )
393
394    former_matric = schema.TextLine(
395        title = _(u'If yes, matric number'),
396        required = False,
397        readonly = False,
398        )
399
400
401class INigeriaStudent(INigeriaStudentBase,INigeriaUGStudentClearance,
402    INigeriaPGStudentClearance,INigeriaStudentPersonal):
403    """Representation of a student.
404
405    """
406
407class INigeriaStudentStudyCourse(IStudentStudyCourse):
408    """A container for student study levels.
409
410    """
411
412class INigeriaStudentStudyLevel(IStudentStudyLevel):
413    """A container for course tickets.
414
415    """
416
417class INigeriaStudentOnlinePayment(INigeriaOnlinePayment):
418    """A student payment via payment gateways.
419
420    This Interface does not inherit from IStudentOnlinePayment.
421    Thus all fields from IStudentOnlinePayment have to be repeated here.
422    """
423
424    p_level = schema.Int(
425        title = _(u'Payment Level'),
426        required = False,
427        readonly = True,
428        )
429
430INigeriaStudentOnlinePayment['p_level'].order = INigeriaStudentOnlinePayment[
431    'p_session'].order
432
433class INigeriaCourseTicket(ICourseTicket):
434    """A course ticket.
435
436    """
437
438class INigeriaStudentUpdateByRegNo(INigeriaStudent):
439    """Representation of a student. Skip regular reg_number validation.
440
441    """
442    reg_number = schema.TextLine(
443        title = _(u'Registration Number'),
444        required = False,
445        )
446
447class INigeriaStudentUpdateByMatricNo(INigeriaStudent):
448    """Representation of a student. Skip regular matric_number validation.
449
450    """
451    matric_number = schema.TextLine(
452        title = _(u'Matriculation Number'),
453        required = False,
454        )
Note: See TracBrowser for help on using the repository browser.