1 | ## $Id: utils.py 10997 2014-01-29 06:52:03Z 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 | """Customize general helper utilities for Kofa. |
---|
19 | """ |
---|
20 | import os |
---|
21 | import pytz |
---|
22 | from waeup.kofa.utils.utils import KofaUtils, sorted_phone_prefixes |
---|
23 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
24 | |
---|
25 | INT_PHONE_PREFIXES = [ |
---|
26 | (1, _('Nigeria'), '234'), |
---|
27 | (99, _('Germany'), '49'), |
---|
28 | (99, _('United States'), '1'), |
---|
29 | (99, _('Niger'), '227'), |
---|
30 | (99, _('Benin'), '229'), |
---|
31 | (99, _('Cameroon'), '237'), |
---|
32 | (99, _('United Kingdom'), '44'), |
---|
33 | (99, _('France'), '33'), |
---|
34 | ] |
---|
35 | |
---|
36 | class NigeriaKofaUtils(KofaUtils): |
---|
37 | """A collection of methods subject to customization. |
---|
38 | """ |
---|
39 | PORTAL_LANGUAGE = 'en' |
---|
40 | |
---|
41 | PREFERRED_LANGUAGES_DICT = { |
---|
42 | 'en':(1, u'English'), |
---|
43 | 'fr':(2, u'Français'), |
---|
44 | 'de':(3, u'Deutsch'), |
---|
45 | 'ha':(4, u'Hausa'), |
---|
46 | 'yo':(5, u'Yoruba'), |
---|
47 | 'ig':(6, u'Igbo'), |
---|
48 | } |
---|
49 | |
---|
50 | #: A function to return |
---|
51 | @classmethod |
---|
52 | def sorted_phone_prefixes(cls, data=INT_PHONE_PREFIXES, request=None): |
---|
53 | return sorted_phone_prefixes(data, request) |
---|
54 | |
---|
55 | EXAM_SUBJECTS_DICT = { |
---|
56 | 'accounts': 'Accounts', |
---|
57 | 'add_general_science': 'Add General Science', |
---|
58 | 'add_maths': 'Add Maths', |
---|
59 | 'adv_elect_install_maint': 'Adv. Electrical Installation and Maintenance', |
---|
60 | 'agricultural_science': 'Agricultural Science', |
---|
61 | 'applied_electricity': 'Applied Electricity', |
---|
62 | 'arabi': 'Arabic', |
---|
63 | 'arithmetics': 'Arithmetics', |
---|
64 | 'art': 'Art', |
---|
65 | 'auto_mechanics': 'Auto Mechanics', |
---|
66 | 'awaiting_results': 'Awaiting Results', |
---|
67 | 'basic_electricity': 'Basic Electricity', |
---|
68 | 'bible_knowledge': 'Bible Knowledge', |
---|
69 | 'biology': 'Biology', |
---|
70 | 'biology_alt_syl': 'Biology (Alt.Syl)', |
---|
71 | 'book_keeping': 'Book Keeping', |
---|
72 | 'building_construction': 'Building Construction', |
---|
73 | 'business_management': 'Business Management', |
---|
74 | 'business_construction_management': 'Business/Construction Management (Adv)', |
---|
75 | 'chemistry': 'Chemistry', |
---|
76 | 'chemistry_alt_syl': 'Chemistry (Alt.Syl)', |
---|
77 | 'christian_religious_studies': 'Christian Religious Studies', |
---|
78 | 'class_teaching': 'Class Teaching', |
---|
79 | 'clerical_office_duties': 'Clerical Office Duties', |
---|
80 | 'clothing_and_textiles': 'Clothing and Textiles', |
---|
81 | 'commerce': 'Commerce', |
---|
82 | 'economics': 'Economics', |
---|
83 | 'education': 'Education', |
---|
84 | 'efik': 'Efik', |
---|
85 | 'electronics': 'Electronics', |
---|
86 | 'elementary_surveying': 'Elementary Surveying', |
---|
87 | 'english_language': 'English Language', |
---|
88 | 'engineering_science': 'Engineering Science', |
---|
89 | 'financial_accounting': 'Financial Accounting', |
---|
90 | 'food_and_nutrition': 'Food and Nutrition', |
---|
91 | 'french': 'French', |
---|
92 | 'further_mathematics': 'Further Mathematics', |
---|
93 | 'general_science': 'General Science', |
---|
94 | 'geography': 'Geography', |
---|
95 | 'german': 'German', |
---|
96 | 'government': 'Government', |
---|
97 | 'hausa': 'Hausa', |
---|
98 | 'hausa_literature': 'Hausa Literature', |
---|
99 | 'health_science': 'Health Science', |
---|
100 | 'history': 'History', |
---|
101 | 'home_management': 'Home Management', |
---|
102 | 'human_biology': 'Human Biology', |
---|
103 | 'industrial_electrical_installation': 'Industrial Elect Installation (Adv)', |
---|
104 | 'intergrated_science': 'Intergrated Science', |
---|
105 | 'islamic_studies': 'Islamic Studies', |
---|
106 | 'literature_in_english': 'Literature in English', |
---|
107 | 'literature_in_nigerian_languages': 'Literature in Nigerian Languages', |
---|
108 | 'igbo': 'Igbo', |
---|
109 | 'igbo_literature': 'Igbo Literature', |
---|
110 | 'yoruba': 'Yoruba', |
---|
111 | 'yoruba_literature': 'Yoruba Literature', |
---|
112 | 'management_in_living': 'Management in Living', |
---|
113 | 'mathematics': 'Mathematics', |
---|
114 | 'metalwork': 'Metalwork', |
---|
115 | 'music': 'Music', |
---|
116 | 'nigerian_language': 'Nigerian Language', |
---|
117 | 'office_practice': 'Office Practice', |
---|
118 | 'physical_education': 'Physical Education', |
---|
119 | 'physical_health_education': 'Physical and Health Education', |
---|
120 | 'physics': 'Physics', |
---|
121 | 'physics_alt_syl': 'Physics (Alt.Syl)', |
---|
122 | 'principles_and_practice_of_education': 'Principles and Practice of Education', |
---|
123 | 'principles_of_cost_accounting': 'Principles of Cost Accounting', |
---|
124 | 'rural_science': 'Rural Science', |
---|
125 | 'science': 'Science', |
---|
126 | 'secretarial_duties': 'Secretarial Duties', |
---|
127 | 'shorthand': 'Shorthand', |
---|
128 | 'sierra_leone_studies': 'Sierra Leone Studies', |
---|
129 | 'sierra_leone_languages': 'Sierra Leone Languages', |
---|
130 | 'social_studies': 'Social Studies', |
---|
131 | 'statistics': 'Statistics', |
---|
132 | 'teaching_practice': 'Teaching Practice', |
---|
133 | 'technical_drawing': 'Technical Drawing', |
---|
134 | 'typewriting': 'Typewriting', |
---|
135 | 'visual_art': 'Visual Art', |
---|
136 | 'woodwork': 'Woodwork', |
---|
137 | 'winding_elect_machines': 'Winding of Elect Machines and Elect Eng Sc' |
---|
138 | } |
---|
139 | |
---|
140 | EXAM_GRADES = ( |
---|
141 | ('A1', 'Excellent (A1)'), |
---|
142 | ('A2', 'Very Good (A2)'), |
---|
143 | ('A3', 'Good (A3)'), |
---|
144 | ('B2', 'Very Good (B2)'), |
---|
145 | ('B3', 'Good (B3)'), |
---|
146 | ('C4', 'Credit (C4)'), |
---|
147 | ('C5', 'Credit (C5)'), |
---|
148 | ('C6', 'Credit (C6)'), |
---|
149 | ('A', 'Pass (A)'), |
---|
150 | ('B', 'Pass (B)'), |
---|
151 | ('C', 'Pass (C)'), |
---|
152 | ('U', 'Pass (U)'), |
---|
153 | ('D7', 'Pass (D7)'), |
---|
154 | ('P7', 'Pass (P7)'), |
---|
155 | ('P8', 'Pass (P8)'), |
---|
156 | ('E8', 'Pass (E8)'), |
---|
157 | ('F9', 'Fail (F9)'), |
---|
158 | ('Aa', 'A (a)'), |
---|
159 | ('Bb', 'B (b)'), |
---|
160 | ('Cc', 'C (c)'), |
---|
161 | ('Dd', 'D (d)'), |
---|
162 | ('Ee', 'E (e)'), |
---|
163 | ('Ff', 'F (f)'), |
---|
164 | ('Gg', 'G (g)'), |
---|
165 | ('AR', 'Awaiting Results'), |
---|
166 | ) |
---|
167 | |
---|
168 | INST_TYPES_DICT = { |
---|
169 | 'none': '', |
---|
170 | 'faculty': 'Faculty of', |
---|
171 | 'department': 'Department of', |
---|
172 | 'school': 'School of', |
---|
173 | 'office': 'Office for', |
---|
174 | 'centre': 'Centre for', |
---|
175 | 'institute': 'Institute of', |
---|
176 | 'school_for': 'School for', |
---|
177 | 'college': 'College of', |
---|
178 | 'directorate': 'Directorate of', |
---|
179 | } |
---|
180 | |
---|
181 | STUDY_MODES_DICT = { |
---|
182 | 'ume_ft': 'UME Full Time', |
---|
183 | 'ug_ft': 'Undergraduate Full Time', |
---|
184 | 'ug_pt': 'Undergraduate Part Time', |
---|
185 | 'dp_pt': 'Diploma Part Time', |
---|
186 | 'ct_ft': 'Certificate Full Time', |
---|
187 | 'dp_ft': 'Diploma Full Time', |
---|
188 | 'de_ft': 'Direct Entry Full Time', |
---|
189 | 'de_pt': 'Direct Entry Part Time', |
---|
190 | 'nd_ft': 'National Diploma Full Time', |
---|
191 | 'nd_pt': 'National Diploma Part Time', |
---|
192 | 'hnd_ft': 'Higher National Diploma Full Time', |
---|
193 | 'hnd_pt': 'Higher National Diploma Part Time', |
---|
194 | 'pg_ft': 'Postgraduate Full Time', |
---|
195 | 'pg_pt': 'Postgraduate Part Time', |
---|
196 | 'pgd_ft': 'Postgraduate Diploma Full Time', |
---|
197 | 'pgd_pt': 'Postgraduate Diploma Part Time', |
---|
198 | 'special_pg_pt': 'Special Postgraduate Part Time', |
---|
199 | 'nce_ft': 'NCE Full Time', |
---|
200 | 'nce_pt': 'NCE Part Time', |
---|
201 | 'ug_sw': 'Undergraduate Sandwich', |
---|
202 | 'nce_sw': 'NCE Sandwich', |
---|
203 | 'jm_ft': 'Joint Matriculation Full Time', |
---|
204 | 'ph_ft': 'Post Higher Education Full Time', |
---|
205 | 'transfer_pt': 'Transfer Part Time', |
---|
206 | 'transfer_ft': 'Transfer Full Time', |
---|
207 | 'ct_pt': 'Certificate Part Time', |
---|
208 | 'rmd_ft': 'Remedial with deficiencies', |
---|
209 | 'rm_ft': 'Remedial', |
---|
210 | 'transfer': 'Transfer', |
---|
211 | 'prence': 'Pre-NCE', |
---|
212 | 'prend': 'Pre-ND', |
---|
213 | 'pce': 'PCE', |
---|
214 | 'pd_ft': 'Professional Diploma in Education', |
---|
215 | 'found': 'Foundation', |
---|
216 | 'no': 'no application', |
---|
217 | } |
---|
218 | |
---|
219 | APP_CATS_DICT = { |
---|
220 | 'basic': 'PUTME, PUDE, PCE, PRENCE', |
---|
221 | 'no': 'No Application', |
---|
222 | 'pg_ft': 'Postgraduate Full-Time', |
---|
223 | 'pg_pt': 'Postgraduate Part-Time', |
---|
224 | 'sandwich': 'Sandwich', |
---|
225 | 'cest': 'Part-Time, Diploma, Certificate', |
---|
226 | } |
---|
227 | |
---|
228 | @property |
---|
229 | def tzinfo(self): |
---|
230 | return pytz.timezone('Africa/Lagos') |
---|