[8326] | 1 | ## $Id: studylevel.py 8619 2012-06-03 17:56:05Z 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 | ## |
---|
| 18 | """ |
---|
| 19 | Container which holds the data of a student study level |
---|
| 20 | and contains the course tickets. |
---|
| 21 | """ |
---|
| 22 | import grok |
---|
| 23 | from zope.component.interfaces import IFactory |
---|
| 24 | from zope.interface import implementedBy |
---|
| 25 | from waeup.kofa.utils.helpers import attrs_to_fields |
---|
| 26 | from waeup.kofa.students.studylevel import ( |
---|
| 27 | StudentStudyLevel, CourseTicket, |
---|
| 28 | CourseTicketFactory, StudentStudyLevelFactory) |
---|
[8619] | 29 | from waeup.futminna.students.interfaces import ( |
---|
[8326] | 30 | ICustomStudentStudyLevel, IStudentNavigation, ICustomCourseTicket) |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | class CustomStudentStudyLevel(StudentStudyLevel): |
---|
| 34 | """This is a container for course tickets. |
---|
| 35 | """ |
---|
| 36 | grok.implements(ICustomStudentStudyLevel, IStudentNavigation) |
---|
| 37 | grok.provides(ICustomStudentStudyLevel) |
---|
| 38 | |
---|
| 39 | CustomStudentStudyLevel = attrs_to_fields(CustomStudentStudyLevel) |
---|
| 40 | |
---|
| 41 | class CustomStudentStudyLevelFactory(StudentStudyLevelFactory): |
---|
| 42 | """A factory for student study levels. |
---|
| 43 | """ |
---|
| 44 | |
---|
| 45 | def __call__(self, *args, **kw): |
---|
| 46 | return CustomStudentStudyLevel() |
---|
| 47 | |
---|
| 48 | def getInterfaces(self): |
---|
| 49 | return implementedBy(CustomStudentStudyLevel) |
---|
| 50 | |
---|
| 51 | class CustomCourseTicket(CourseTicket): |
---|
| 52 | """This is a course ticket which allows the |
---|
| 53 | student to attend the course. Lecturers will enter scores and more at |
---|
| 54 | the end of the term. |
---|
| 55 | |
---|
| 56 | A course ticket contains a copy of the original course and |
---|
| 57 | course referrer data. If the courses and/or their referrers are removed, the |
---|
| 58 | corresponding tickets remain unchanged. So we do not need any event |
---|
| 59 | triggered actions on course tickets. |
---|
| 60 | """ |
---|
| 61 | grok.implements(ICustomCourseTicket, IStudentNavigation) |
---|
| 62 | grok.provides(ICustomCourseTicket) |
---|
| 63 | |
---|
| 64 | CustomCourseTicket = attrs_to_fields(CustomCourseTicket) |
---|
| 65 | |
---|
| 66 | class CustomCourseTicketFactory(CourseTicketFactory): |
---|
| 67 | """A factory for student study levels. |
---|
| 68 | """ |
---|
| 69 | |
---|
| 70 | def __call__(self, *args, **kw): |
---|
| 71 | return CustomCourseTicket() |
---|
| 72 | |
---|
| 73 | def getInterfaces(self): |
---|
| 74 | return implementedBy(CustomCourseTicket) |
---|