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

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

Add CourseTicket? class.

  • work in progress -
  • Property svn:keywords set to Id
File size: 6.3 KB
Line 
1##
2## interfaces.py
3from zope.interface import Interface, Attribute, invariant
4from zope.interface.exceptions import Invalid
5from zope import schema
6from waeup.sirp.interfaces import IWAeUPObject
7from waeup.sirp.university.vocabularies import study_modes
8from waeup.sirp.students.vocabularies import (
9  year_range, lgas_vocab, CertificateSource, GenderSource,
10  academic_sessions_vocab, verdicts, StudyLevelSource,
11  )
12
13class IStudentsContainer(IWAeUPObject):
14    """An students container contains university students.
15
16    """
17
18    def addStudent(student):
19        """Add an IStudent object and subcontainers.
20
21        """
22
23    def archive(id=None):
24        """Create on-dist archive of students.
25
26        If id is `None`, all students are archived.
27
28        If id contains a single id string, only the respective
29        students are archived.
30
31        If id contains a list of id strings all of the respective
32        students types are saved to disk.
33        """
34
35    def clear(id=None, archive=True):
36        """Remove students of type given by 'id'.
37
38        Optionally archive the students.
39
40        If id is `None`, all students are archived.
41
42        If id contains a single id string, only the respective
43        students are archived.
44
45        If id contains a list of id strings all of the respective
46        student types are saved to disk.
47
48        If `archive` is ``False`` none of the archive-handling is done
49        and respective students are simply removed from the
50        database.
51        """
52
53class IStudentNavigation(IWAeUPObject):
54    """Interface needed for student navigation.
55    """
56
57    def getStudent():
58        """Return student object.
59        """
60
61class IStudentPasswordSetting(IWAeUPObject):
62    """Data needed for password setting.
63    """
64    name = schema.TextLine(
65        title = u'Full Name',
66        default = u'Nobody',
67        required = True,
68        readonly = True
69        )
70
71    password = schema.Password(
72        title = u'New password',
73        required = False,
74        )
75
76    password_repeat = schema.Password(
77        title = u'Retype new password',
78        required = False,
79        )
80
81    @invariant
82    def passwords_match(obj):
83        if obj.password == obj.password_repeat:
84            return
85        raise Invalid('passwords do not match')
86
87class IStudentBase(IWAeUPObject):
88    """Representation of student base data.
89    """
90    history = Attribute('Object history, a list of messages.')
91    state = Attribute('Returns the registration state of a student')
92    password = Attribute('Encrypted password of a student')
93
94    def loggerInfo(ob_class, comment):
95        """Adds an INFO message to the log file
96        """
97
98    student_id = schema.TextLine(
99        title = u'Student ID',
100        required = True,
101        )
102
103    name = schema.TextLine(
104        title = u'Full Name',
105        default = u'Nobody',
106        required = True,
107        )
108
109    reg_number = schema.TextLine(
110        title = u'Registration Number',
111        default = u'',
112        required = True,
113        readonly = False,
114        )
115
116    matric_number = schema.TextLine(
117        title = u'Matriculation Number',
118        default = u'',
119        required = False,
120        readonly = False,
121        )
122
123    adm_code = schema.TextLine(
124        title = u'PWD Access Code',
125        default = u'',
126        required = False,
127        readonly = True,
128        )
129
130class IStudentClearance(IWAeUPObject):
131    """Representation of student clearance data.
132    """
133
134    date_of_birth = schema.Date(
135        title = u'Date of Birth',
136        required = True,
137        )
138
139    clearance_locked = schema.Bool(
140        title = u'Clearance form locked',
141        default = False,
142        )
143
144    clr_code = schema.TextLine(
145        title = u'CLR Access Code',
146        default = u'',
147        required = False,
148        readonly = True,
149        )
150
151class IStudentPersonal(IWAeUPObject):
152    """Representation of student personal data.
153    """
154
155    perm_address = schema.Text(
156        title = u'Permanent Address',
157        required = False,
158        )
159
160class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
161    """Representation of a student.
162    """
163
164class IStudentStudyCourse(IWAeUPObject):
165    """A container for student study levels.
166
167    """
168
169    certificate = schema.Choice(
170        title = u'Certificate',
171        source = CertificateSource(),
172        default = None,
173        required = True,
174        )
175
176    current_session = schema.Choice(
177        title = u'Current Session',
178        source = academic_sessions_vocab,
179        default = None,
180        required = True,
181        )
182
183    current_level = schema.Choice(
184        title = u'Current Level',
185        source = StudyLevelSource(),
186        default = None,
187        required = False,
188        )
189
190    current_verdict = schema.Choice(
191        title = u'Current Verdict',
192        source = verdicts,
193        default = None,
194        required = False,
195        )
196
197    previous_verdict = schema.Choice(
198        title = u'Previous Verdict',
199        source = verdicts,
200        default = None,
201        required = False,
202        )
203
204class IStudentStudyLevel(IWAeUPObject):
205    """A container for course tickets.
206
207    """
208    level = Attribute('The level code')
209
210
211class ICourseTicket(IWAeUPObject):
212    """A course ticket.
213
214    """
215    code = Attribute('Course code')
216    title = Attribute('Course title')
217    course_level = Attribute('level of the original course referrer')
218    core_or_elective = Attribute('core_or_elective of the original course referrer')
219
220    credits = schema.Int(
221        title = u'Credits',
222        default = 0,
223        required = False,
224        readonly = False,
225        )
226
227    score = schema.Int(
228        title = u'Score',
229        default = 0,
230        required = False,
231        readonly = False,
232        )
233
234    grade = schema.TextLine(
235        title = u'Grade',
236        default = u'',
237        required = False,
238        readonly = True,
239        )
240
241class IStudentAccommodation(IWAeUPObject):
242    """A container for student accommodation objects.
243
244    """
245
246class IStudentPayments(IWAeUPObject):
247    """A container for student payment objects.
248
249    """
250
251# Interfaces for students only
252
253class IStudentClearanceEdit(IStudentClearance):
254    """Interface needed for restricted editing of student clearance data.
255    """
256
257class IStudentPersonalEdit(IStudentPersonal):
258    """Interface needed for restricted editing of student personal data.
259    """
Note: See TracBrowser for help on using the repository browser.