-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathacm_school.api.php
474 lines (420 loc) · 13 KB
/
acm_school.api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
<?php
/**
* @file
* This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.
*/
/**
* @def_group acm_school_hooks Acadaman school module hooks
* @{
* Hooks that all school types can implement
*/
/**
* A student profile is contained in student application
*/
function hook_acm_schoolprofile() {
}
/**
* This hook renders the view for various student application items.
*
* Example of student application profile items are:
* - sponsor
* - course
* - nextofkin
* -
*
* This hook is powered by views module for displaying the student application.
*/
function hook_acm_student_application() {
global $user;
// Edit a student profile with a query params like this: ?edit=app
switch($_GET['edit']) {
case 'app':
// $student_application object for the current student
$profile = acm_school_profile_load($user->uid);
return drupal_get_form('acm_school_student_profile_form', (array)$profile->profile, NULL);
}
// Display student application sponsor profile, course profile, and nextofkin profile.
switch($_GET['app']) {
case 'sponsor':
drupal_set_title('Sponsor');
$studentApplication = views_get_view('uni_student_application_view');
$studentApplication->display = 'sponsor';
break;
case 'course':
drupal_set_title('Course');
$studentApplication = views_get_view('uni_student_application_view');
$studentApplication->display = 'course';
break;
case 'nextofkin':
drupal_set_title('Next of Kin');
$studentApplication = views_get_view('uni_student_application_view');
$studentApplication->display = 'nextofkin';
break;
default:
$studentApplication = views_get_view('uni_student_application_view');
$studentApplication->display = 'default';
break;
}
return $studentApplication;
}
/**
* This hook represents a label of items that should be configured
* for student application profile view.
*
* @see hook_admission_application_info for
*/
function hook_acm_student_application_items() {
// Example of student application profile items for University school type
$items = array();
$items['sponsor'] = array(
'data' => l('Sponsor Information', 'application/sponsor')
);
$items['course'] = array(
'data' => l('Course Information', 'application/course')
);
return $items;
}
/*
* This hook defines the structure of admission application steps that
* can be implemented per school type. At the end of every application step,
* this hook is looked up to determine what application form step is next
*/
function hook_admission_application_info() {
$application_form = array(
'course' => array(
'title' => 'course',
'form_id' => 'uni_school_admission_course_form'
),
'sponsor' => array(
'title' => 'sponsor',
'form_id' => 'uni_school_admission_sponsors_form'
),
'nextofkin' => array(
'title' => 'nextofkin',
'form_id' => 'uni_school_admission_nextofkin_form'
),
'health' => array(
'title' => 'health',
'form_id' => 'uni_school_admission_health_form'
),
);
return $application_form;
}
/**
* This hook defines the settings for school admission.
*/
function hook_admission_settings($type) {
// For example, to define the settings for admission status.
if($type == 'status') {
$settings['admission']['admission_status_form'] = drupal_get_form('uni_school_admission_settings_form');
}
return $settings;
}
/**
* This hook describes the structure for setting up all the school
* modules or features
*/
function hook_school_settings() {
// Example of school settings
$settings['type'] = 'configure';
$settings['configure']['admission'] = array(
'title' => t('Set admission status'),
'callback url' => t('admin/settings/school/admission/status')
);
$settings['configure']['users'] = array(
'title' => 'Configure users',
'callback url' => 'admin/settings/school/users'
);
$settings['configure']['fees'] = array(
'title' => 'Setup Fees',
'callback url' => 'admin/settings/school/fees'
);
$settings['configure']['dorm'] = array(
'title' => 'Configure dormitory allocation',
'callback url' => 'admin/settings/school/dormitory'
);
$settings['configure']['faculty'] = array(
'title' => 'Add faculty',
'callback url' => 'admin/settings/school/faculty/add'
);
$settings['configure']['department'] = array(
'title' => 'Add department',
'callback url' => 'admin/settings/school/department/add'
);
$settings['configure']['grade'] = array(
'title' => 'Configure grading system',
'callback url' => 'admin/settings/school/grade/gradingsystem'
);
$settings['configure']['school_settings'] = drupal_get_form('uni_school_school_settings_form');
return $settings;
}
/**
* A hook that describes the academic levels of a school
*/
function hook_academic_level() {
// Example academic_level for a university school type.
return drupal_map_assoc(array(100, 200, 300, 400, 500, 600, 700));
}
/**
* This hook handles the landing page of admissions
*
* @todo This hook needs a clear definition and purpose.
*/
function hook_admission() {
}
/**
* A hook to display a view of student admissions made into a
* school. This hook is powered by views module.
*/
function hook_admission_application_list() {
// For example, to display all admissions to a school type of university.
$admission_view = views_get_view('uni_admission_view');
return $admission_view;
}
/**
* This hook displays all faculty in a school.
*
* This hook display is powered by views module.
*/
function hook_faculty() {
}
/**
* This hook displays all departments in a school.
*
* This hook display is powered by views module.
*/
function hook_department() {
}
/**
* This hook displays all grades in a school.
*
* This hook display is powered by views module
*/
function hook_grade() {
// For example, a university school type grade display
$grade_view = views_get_view('uni_grade_view');
return $grade_view;
}
/**
* This hook displays all fees in a school.
*
* This hook display is powered by views module
*/
function hook_fees() {
}
/**
* This hook defines all the faculty settings meant to be
* configured for a school
*/
function hook_faculty_settings($type) {
// Example faculty settings
$settings['type'] = 'faculty';
$settings['faculty']['add'] = array(
'title' => t('Add'),
'callback url' => 'admin/settings/school/faculty/add'
);
$settings['faculty']['add dept'] = array(
'title' => 'Add department',
'callback url' => 'admin/settings/school/department/add'
);
$settings['faculty']['view'] = array(
'title' => 'View faculty',
'callback url' => 'faculty'
);
if($type == 'add') {
$settings['faculty']['add_faculty_form'] = drupal_get_form('uni_school_faculty_form');
}
if($type == 'add_dept') {
$settings['faculty']['add_dept_form'] = drupal_get_form('uni_school_faculty_dept_form');
}
return $settings;
}
/**
* This hook defines all the department settings meant to be
* configured for a school.
*/
function hook_department_settings($type) {
// Example department settings
$settings['type'] = 'department';
$settings['dept']['add'] = array(
'title' => t('Add'),
'callback url' => 'admin/settings/school/department/add'
);
// add course to a department
$settings['dept']['add course'] = array(
'title' => 'Add Course',
'callback url' => 'admin/settings/school/department/addcourse'
);
$settings['dept']['grade point'] = array(
'title' => 'Set grade point',
'callback url' => 'admin/settings/school/grade/dept_gradepoint'
);
if($type == 'add') {
$settings['dept']['add_dept_form'] = drupal_get_form('uni_school_faculty_dept_form'); //uni_school_add_dept_form()
}
if($type == 'addcourse') {
$settings['dept']['addcourse_form'] = drupal_get_form('uni_school_addcourse_form');
}
return $settings;
}
/**
* This hook defines all the programme settings meant to be
* configured for a school.
*/
function hook_programme_settings($type) {
// Example programme settings
$settings['type'] = 'programme';
$settings['prog']['add'] = array(
'title' => t('Add'),
'callback url' => 'admin/settings/school/programme/add'
);
if($type == 'add') {
$settings['prog']['add_prog_form'] = drupal_get_form('uni_school_programme_form');
}
return $settings;
}
/**
* This hook defines all the course settings meant to be
* configured for a school.
*/
function hook_course_settings() {
$form['#attributes'] = array('class' => 'form-horizontal');
$form['number_of_cas'] = array(
'#type' => 'select',
'#title' => t('Number of CAs'),
'#options' => array(1,2,3,4),
'#default_value' => variable_get('number_of_cas', (int)''),
);
$form['ca_approval_method'] = array(
'#type' => 'select',
'#title' => t('CA approval method'),
'#options' => array('Approved along with exams'),
'#default_value' => variable_get('ca_approval_method', ''),
);
$form['ca_maximum_mark'] = array(
'#type' => 'textfield',
'#title' => t('CA maximum mark'),
'#default_value' => variable_get('ca_maximum_mark', (int)''),
);
$form['exam_maximum_mark'] = array(
'#type' => 'textfield',
'#title' => t('Exam maximum mark'),
'#default_value' => variable_get('exam_maximum_mark', (int)'')
);
return system_settings_form($form);
}
/**
* This hook defines all the grade settings meant to be
* configured for a school.
*/
function hook_grade_settings($type) {
$settings['type'] = 'grade';
$settings['grade']['configure'] = array(
'title' => t('Configure grading system'),
'callback url' => 'admin/settings/school/grade/gradingsystem'
);
// set global grading point
$settings['grade']['grade point'] = array(
'title' => 'Set grade point',
'callback url' => 'admin/settings/school/grade/gradepoint'
);
// set grading point for a specific department
// A staff in medicine department should be able to contact the IT
// staff (Acadaman authorized user) to set medicine department
// grade point to 7
$settings['grade']['department grade point'] = array(
'title' => 'Set department grade point',
'callback url' => 'admin/settings/school/grade/dept_gradepoint'
);
$settings['grade']['grade a student'] = array(
'title' => 'Grade a student',
'callback url' => 'admin/settings/school/grade/add'
);
$settings['grade']['score a student'] = array(
'title' => 'Score a student',
'callback url' => 'admin/settings/school/score/add'
);
if($type == 'gradingsystem') {
$settings['grade']['gradingsystem_form'] = drupal_get_form('uni_school_gradingsystem_settings_form');
}
if($type == 'gradepoint') {
$settings['grade']['gradepoint_form'] = drupal_get_form('uni_school_gradepoint_settings_form');
}
if($type == 'dept_gradepoint') {
$settings['grade']['dept_gradepoint_form'] = drupal_get_form('uni_school_dept_gradepoint_settings_form');
}
if($type == 'add') {
$settings['grade']['grade_form'] = drupal_get_form('uni_school_grade_form');
}
return $settings;
}
/**
* This hook defines all the score settings meant to be
* configured for a school.
*/
function hook_score_settings($type) {
$settings['type'] = 'score';
if($type == 'add') {
$settings['score']['score_form'] = drupal_get_form('uni_school_score_form');
}
return $settings;
}
/**
* This hook describes the built-in fees types supported by
* Acadaman.
*/
function hook_fees_type() {
return array('General', 'Program Specific');
}
/**
* A group that a particular fee belong to.
*
* This hook defines the supported fees catalog or structure
* of a school.
*
* For each fee item, it must belong to at least one catalog.
*/
function hook_fee_catalog_info() {
}
/**
* This hook defines roles in Acadaman.
*
* Best place to implement this hook is in a module's install file.
*/
function hook_acm_roles() {
// Example: Available default roles for all school types
return array('Applicant', 'Student', 'Bursar', 'Supervisor', 'Cleaner', 'Student parent', 'Staff');
}
/**
* This hook assigns permissions to roles.
*
* The recommended place to implement this hook is in a module's install file.
*/
function hook_acm_roles_perm() {
// Example shows Staff role being assigned 'administer school settings'
// permission
return array(
'Staff' => 'administer school settings',
);
}
/**
* This hook defines the extra setup tasks to be performed after successful install
* of Acadaman for a new school.
*/
function hook_setup_tasks() {
// Example setup tasks for a University school type.
if($_GET['step'] == 'setup') {
$step = 'add-faculty';
$output = drupal_get_form('uni_school_setup_faculty_form');
variable_set('setup_step', 'faculty');
}
if($_GET['step'] == 'course'){
$step = 'add-course';
$output = drupal_get_form('uni_school_setup_course_form');
variable_set('setup_step', 'course');
}
return $output;
}
/**
* @}
*/