-
Notifications
You must be signed in to change notification settings - Fork 0
/
navbar.php
98 lines (75 loc) · 3.05 KB
/
navbar.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
<nav class="topnav" id="myTopnav">
<a href="#" id="hamburger" class="fas fa-bars"></a>
<a href="main.php" id="companyTitle">LafLef</a>
<div class="links">
<a href="main.php" class="fas fa-home"> Main</a>
<a href="picnics.php" class="fas fa-smile-beam"> Picnics</a>
<div class="dropdown">
<a href="#" class="dropbtn"> Help
<i class="fa fa-caret-down"></i>
</a>
<div class="dropdown-content">
<a href="style.html" target="_blank">Style</a>
</div>
</div>
<?php
if (!isset($_SESSION['userType']) || $_SESSION['userType'] == 1 || $_SESSION['userType'] == 2) {
echo '<a href="aboutUs.php" class="fas fa-address-card"> About Us</a>';
}
if (!isset($_SESSION['userType']) || $_SESSION['userType'] == 1) //GUEST LINKS MUST BE UPDATED LATER
echo '
<a href="register.php?new" class="fas fa-user-plus"> Register</a>
<a href="login.php?new" class="fas fa-sign-in-alt"> Login</a>
';
else if ($_SESSION['userType'] == 2) { //USER LINKS MUST BE UPDATED LATER
?>
<a href="#" class="fas fa-user"> <?= $_SESSION['Customer_Name'] ?></a>
<?php
echo '
<a href="#" class="fas fa-sign-out-alt" id="customer-logout"> Logout</a>
';
} else
echo '
<a href="viewMessages.php" class="fas fa-envelope" > View Messages</a>
<a href="addPicnic.php" class="fas fa-plus"> Add Picnic</a>
<a href="addNews.php" class="fas fa-newspaper"> Spread News</a>
<a href="#" class="fas fa-sign-out-alt" id="admin-logout"> Logout</a>
';
?>
</div>
<a href="#" onclick="navCollapse()" class="icon" onclick="myFunction()">
<i>▼</i>
</a>
</nav>
<script>
document.getElementById("hamburger").addEventListener('click', function (event) {
event.preventDefault();
openSlidMenu();
})
function navCollapse() {
var x = document.getElementById("myTopnav");
if (x.className === "topnav") {
x.className += " responsive";
} else {
x.className = "topnav";
}
}
</script>
<script type="text/javascript">
var role = <?=$_SESSION['userType']?>;
if (role == 2) {
document.getElementById('customer-logout').addEventListener('click', function (event) {
event.preventDefault();
if (window.confirm("Are you sure you want to logout ?")) {
window.location.replace('logout.php');
}
})
} else if (role == 3) {
document.getElementById('admin-logout').addEventListener('click', function (event) {
event.preventDefault();
if (window.confirm("Are you sure you want to logout ?")) {
window.location.replace('logout.php');
}
})
}
</script>