source: main/waeup.sirp/trunk/src/waeup/sirp/university/vocabularies.py @ 6648

Last change on this file since 6648 was 6557, checked in by uli, 13 years ago

Remove BBB import.

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1"""Vocabularies and sources for the academics section.
2"""
3from zc.sourcefactory.basic import BasicSourceFactory
4from zope.catalog.interfaces import ICatalog
5from zope.component import getUtility
6from waeup.sirp.interfaces import SimpleWAeUPVocabulary
7
8inst_types = SimpleWAeUPVocabulary(
9    ('Faculty of','faculty'),
10    ('Department of','department'),
11    ('School of','school'),
12    ('School for','school_for'),
13    ('Institute of','institute'),
14    ('Office for','office'),
15    ('Centre for','centre'),
16    ('College','college'),
17    )
18
19course_levels = SimpleWAeUPVocabulary(
20    ('Pre-Studies',0),
21    ('100 (Year 1)',100),
22    ('200 (Year 2)',200),
23    ('300 (Year 3)',300),
24    ('400 (Year 4)',400),
25    ('500 (Year 5)',500),
26    ('600 (Year 6)',600),
27    ('700 (Year 7)',700),
28    ('800 (Year 8)',800),
29    )
30
31semester = SimpleWAeUPVocabulary(
32    ('N/A', 0),
33    ('First Semester', 1),
34    ('Second Semester', 2),
35    ('Combined', 3)
36    )
37
38application_categories = SimpleWAeUPVocabulary(
39    ('--',''),
40    ('PUME, PDE, PCE, PRENCE','basic'),
41    ('Part-Time, Diploma, Certificate','cest'),
42    ('Sandwich','sandwich'),
43    ('Postgraduate','pg'),
44    )
45
46study_mode = SimpleWAeUPVocabulary(
47    ('UME Full Time','ume_ft'),
48    ('Direct Entry Full Time','de_ft'),
49    ('Diploma Full Time','dp_ft'),
50    ('Diploma Part Time','dp_pt'),
51    ('Undergraduate Full Time','ug_ft'),
52    ('Undergraduate Part Time','ug_pt'),
53    ('Postgraduate Full Time','pg_ft'),
54    ('Postgraduate Part Time','pg_pt'),
55    )
56
57
58class CourseSource(BasicSourceFactory):
59    """A course source delivers all courses inside the portal by looking
60       up a catalog.
61    """
62    def getValues(self):
63        catalog = getUtility(ICatalog, name='courses_catalog')
64        return sorted(list(
65                catalog.searchResults(
66                    code=('', 'z*'))),key=lambda value: value.code)
67
68    def getToken(self, value):
69        return value.code
70
71    def getTitle(self, value):
72        return "%s - %s" % (value.code, value.title[:64])
Note: See TracBrowser for help on using the repository browser.