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

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

More copyright adjustments.

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