-
Notifications
You must be signed in to change notification settings - Fork 0
/
loadNavbarMenu.php
75 lines (65 loc) · 2.52 KB
/
loadNavbarMenu.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
<?php
/* THIS WILL BE ARCHIVED */
/* Imports */
require_once __DIR__ . '/config/apiReturn.php';
require_once __DIR__ . '/config/constants.php';
require_once __DIR__ . '/config/authenticate.php';
require_once __DIR__ . '/repository/database.php';
/* Set required header and session start */
requiredHeaderAndSessionStart();
/* Connect to database */
$conn = getConnection();
if (checkSessionInfo() && validateUser($conn)) {
$userType = trim($_SESSION['userType']);
if (isLibrarian()) {
$pageTitle['0'] = 'Check out';
$pageTitle['1'] = 'Returns';
$pageTitle['2'] = 'Holds';
$pageTitle['3'] = 'Fines';
$pageTitle['4'] = 'Request List';
$pageTitle['5'] = 'Reserve books';
$pageLinks['0'] = 'librarian/checkOut';
$pageLinks['1'] = 'librarian/return';
$pageLinks['2'] = 'librarian/holds';
$pageLinks['3'] = 'librarian/fines';
$pageLinks['4'] = 'librarian/request';
$pageLinks['5'] = 'librarian/reserve';
} elseif (isHeadmaster()) {
$pageTitle['0'] = 'Browse collection';
$pageTitle['1'] = 'Manage Librarians';
$pageTitle['2'] = 'Reset Passwords';
$pageTitle['3'] = 'Manage Courses';
$pageTitle['4'] = 'Manage Enrollment';
$pageTitle['5'] = 'Manage Request';
$pageLinks['0'] = 'catalogue/search';
$pageLinks['1'] = 'headmaster/manageLibrarian';
$pageLinks['2'] = 'headmaster/resetPassword';
$pageLinks['3'] = 'headmaster/manageCourses';
$pageLinks['4'] = 'headmaster/manageEnrollment';
$pageLinks['5'] = 'headmaster/manageRequest';
} else {
$pageTitle['0'] = 'Browse collection';
$pageTitle['1'] = 'Checked out';
$pageTitle['2'] = 'Holds';
$pageTitle['3'] = 'Fines';
$pageTitle['4'] = 'Submit Request';
$pageLinks['0'] = 'catalogue/search';
$pageLinks['1'] = 'catalogue/checkedOutMenu';
$pageLinks['2'] = 'catalogue/holdMenu';
$pageLinks['3'] = 'catalogue/fineMenu';
$pageLinks['4'] = 'catalogue/submitRequest';
if (isProfessor()) {
$pageTitle['5'] = 'Reserved book';
$pageLinks['5'] = 'catalogue/professorReservationMenu';
} else {
$pageTitle['5'] = 'Reserved book';
$pageLinks['5'] = 'catalogue/studentReservationMenu';
}
}
//$arr['userType'] = $userType;
$arr['pageTitle'] = $pageTitle;
$arr['pageLinks'] = $pageLinks;
echo json_encode($arr);
} else {
redirectToLogin();
}