1 | ## $Id: utils.py 11587 2014-04-11 17:05:33Z 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 | 'first_written': 'First Written', |
---|
139 | 'second_written': 'Second Written', |
---|
140 | 'pract_tests': 'Practical Tests', |
---|
141 | } |
---|
142 | |
---|
143 | EXAM_GRADES = ( |
---|
144 | ('A1', 'Excellent (A1)'), |
---|
145 | ('A2', 'Very Good (A2)'), |
---|
146 | ('A3', 'Good (A3)'), |
---|
147 | ('B2', 'Very Good (B2)'), |
---|
148 | ('B3', 'Good (B3)'), |
---|
149 | ('C4', 'Credit (C4)'), |
---|
150 | ('C5', 'Credit (C5)'), |
---|
151 | ('C6', 'Credit (C6)'), |
---|
152 | ('A', 'Pass (A)'), |
---|
153 | ('B', 'Pass (B)'), |
---|
154 | ('C', 'Pass (C)'), |
---|
155 | ('U', 'Pass (U)'), |
---|
156 | ('D7', 'Pass (D7)'), |
---|
157 | ('P7', 'Pass (P7)'), |
---|
158 | ('P8', 'Pass (P8)'), |
---|
159 | ('E8', 'Pass (E8)'), |
---|
160 | ('F9', 'Fail (F9)'), |
---|
161 | ('Aa', 'A (a)'), |
---|
162 | ('Bb', 'B (b)'), |
---|
163 | ('Cc', 'C (c)'), |
---|
164 | ('Dd', 'D (d)'), |
---|
165 | ('Ee', 'E (e)'), |
---|
166 | ('Ff', 'F (f)'), |
---|
167 | ('Gg', 'G (g)'), |
---|
168 | ('credit-1', 'Credit-1'), |
---|
169 | ('credit-2', 'Credit-2'), |
---|
170 | ('dist', 'Distinction'), |
---|
171 | ('pass', 'Pass'), |
---|
172 | ('AR', 'Awaiting Results'), |
---|
173 | ) |
---|
174 | |
---|
175 | INST_TYPES_DICT = { |
---|
176 | 'none': '', |
---|
177 | 'faculty': 'Faculty of', |
---|
178 | 'department': 'Department of', |
---|
179 | 'school': 'School of', |
---|
180 | 'office': 'Office for', |
---|
181 | 'centre': 'Centre for', |
---|
182 | 'institute': 'Institute of', |
---|
183 | 'school_for': 'School for', |
---|
184 | 'college': 'College of', |
---|
185 | 'directorate': 'Directorate of', |
---|
186 | } |
---|
187 | |
---|
188 | STUDY_MODES_DICT = { |
---|
189 | 'ume_ft': 'UME Full Time', |
---|
190 | 'ug_ft': 'Undergraduate Full Time', |
---|
191 | 'ug_pt': 'Undergraduate Part Time', |
---|
192 | 'dp_pt': 'Diploma Part Time', |
---|
193 | 'ct_ft': 'Certificate Full Time', |
---|
194 | 'dp_ft': 'Diploma Full Time', |
---|
195 | 'de_ft': 'Direct Entry Full Time', |
---|
196 | 'de_pt': 'Direct Entry Part Time', |
---|
197 | 'nd_ft': 'National Diploma Full Time', |
---|
198 | 'nd_pt': 'National Diploma Part Time', |
---|
199 | 'hnd_ft': 'Higher National Diploma Full Time', |
---|
200 | 'hnd_pt': 'Higher National Diploma Part Time', |
---|
201 | 'pg_ft': 'Postgraduate Full Time', |
---|
202 | 'pg_pt': 'Postgraduate Part Time', |
---|
203 | 'pgd_ft': 'Postgraduate Diploma Full Time', |
---|
204 | 'pgd_pt': 'Postgraduate Diploma Part Time', |
---|
205 | 'special_pg_pt': 'Special Postgraduate Part Time', |
---|
206 | 'nce_ft': 'NCE Full Time', |
---|
207 | 'nce_pt': 'NCE Part Time', |
---|
208 | 'ug_sw': 'Undergraduate Sandwich', |
---|
209 | 'nce_sw': 'NCE Sandwich', |
---|
210 | 'jm_ft': 'Joint Matriculation Full Time', |
---|
211 | 'ph_ft': 'Post Higher Education Full Time', |
---|
212 | 'transfer_pt': 'Transfer Part Time', |
---|
213 | 'transfer_ft': 'Transfer Full Time', |
---|
214 | 'ct_pt': 'Certificate Part Time', |
---|
215 | 'rmd_ft': 'Remedial with deficiencies', |
---|
216 | 'rm_ft': 'Remedial', |
---|
217 | 'transfer': 'Transfer', |
---|
218 | 'prence': 'Pre-NCE', |
---|
219 | 'prend': 'Pre-ND', |
---|
220 | 'pce': 'PCE', |
---|
221 | 'pd_ft': 'Professional Diploma in Education', |
---|
222 | 'found': 'Foundation', |
---|
223 | 'no': 'no application', |
---|
224 | } |
---|
225 | |
---|
226 | APP_CATS_DICT = { |
---|
227 | 'basic': 'PUTME, PUDE, PCE, PRENCE', |
---|
228 | 'no': 'No Application', |
---|
229 | 'pg_ft': 'Postgraduate Full-Time', |
---|
230 | 'pg_pt': 'Postgraduate Part-Time', |
---|
231 | 'sandwich': 'Sandwich', |
---|
232 | 'cest': 'Part-Time, Diploma, Certificate', |
---|
233 | } |
---|
234 | |
---|
235 | @property |
---|
236 | def tzinfo(self): |
---|
237 | return pytz.timezone('Africa/Lagos') |
---|