1 | """Vocabularies and sources for the academics section.
|
---|
2 | """
|
---|
3 |
|
---|
4 | from waeup.sirp.interfaces import SimpleWAeUPVocabulary
|
---|
5 | from zc.sourcefactory.basic import BasicSourceFactory
|
---|
6 | try:
|
---|
7 | from zope.catalog.interfaces import ICatalog
|
---|
8 | except ImportError:
|
---|
9 | # BBB
|
---|
10 | from zope.app.catalog.interfaces import ICatalog
|
---|
11 | from zope.component import getUtility
|
---|
12 |
|
---|
13 | course_levels = SimpleWAeUPVocabulary(
|
---|
14 | ('100 (Year 1)',100),
|
---|
15 | ('200 (Year 2)',200),
|
---|
16 | ('300 (Year 3)',300),
|
---|
17 | ('400 (Year 4)',400),
|
---|
18 | ('500 (Year 5)',500),
|
---|
19 | ('600 (Year 6)',600),
|
---|
20 | ('700 (Year 7)',700),
|
---|
21 | ('800 (Year 8)',800),
|
---|
22 | )
|
---|
23 |
|
---|
24 | semester = SimpleWAeUPVocabulary(
|
---|
25 | ('N/A', 0),
|
---|
26 | ('First Semester', 1),
|
---|
27 | ('Second Semester', 2),
|
---|
28 | ('Combined', 3)
|
---|
29 | )
|
---|
30 |
|
---|
31 | application_category = SimpleWAeUPVocabulary(
|
---|
32 | ('--',''),
|
---|
33 | ('PUME, PDE, PCE, PRENCE','basic'),
|
---|
34 | ('Part-Time, Diploma, Certificate','cest'),
|
---|
35 | ('Sandwich','sandwich'),
|
---|
36 | ('Postgraduate','pg'),
|
---|
37 | )
|
---|
38 |
|
---|
39 | study_mode = SimpleWAeUPVocabulary(
|
---|
40 | ('UME Full Time','ume_ft'),
|
---|
41 | ('Direct Entry Full Time','de_ft'),
|
---|
42 | ('Diploma Full Time','dp_ft'),
|
---|
43 | ('Diploma Part Time','dp_pt'),
|
---|
44 | ('Undergraduate Full Time','ug_ft'),
|
---|
45 | ('Undergraduate Part Time','ug_pt'),
|
---|
46 | ('Postgraduate Full Time','pg_ft'),
|
---|
47 | ('Postgraduate Part Time','pg_pt'),
|
---|
48 | )
|
---|
49 |
|
---|
50 |
|
---|
51 | class CourseSource(BasicSourceFactory):
|
---|
52 | """A course source delivers all courses inside the portal by looking
|
---|
53 | up a catalog.
|
---|
54 | """
|
---|
55 | def getValues(self):
|
---|
56 | catalog = getUtility(ICatalog, name='courses_catalog')
|
---|
57 | return sorted(list(catalog.searchResults(code=('', 'z*'))),key=lambda value: value.code)
|
---|
58 |
|
---|
59 | def getToken(self, value):
|
---|
60 | return value.code
|
---|
61 |
|
---|
62 | def getTitle(self, value):
|
---|
63 | return "%s - %s" % (value.code, value.title[:64])
|
---|
64 |
|
---|
65 | |
---|