-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnavbar.php
145 lines (133 loc) · 5.52 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
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
<?php session_start(); ?>
<?php
$uri = $_SERVER["REQUEST_URI"];
$cur = substr($uri,strpos($uri,"/")+1);
?>
<?php
if($_SESSION['logged']==0){
echo $_SESSION['logged'];
echo "<script> location.href='login.php'; </script>";
}
?>
<nav class="navbar navbar-inverse">
<div class="container-fluid cfirst">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span>
</button>
<div class="logo">
<a href="insidepage.php"><img src="media/logo.png" alt="Logo" height="70px" width="60px"></a>
</div>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<?php
if($cur == 'FinalProjectPSPI/housing.php')
echo '<li><a style = "color: grey;">Housing</a></li>';
else
echo '<li><a href="housing.php">Housing</a></li>';
?>
<?php
if($cur == 'FinalProjectPSPI/transportation.php')
echo '<li><a style = "color: grey;">Transportation</a></li>';
else
echo '<li><a href="transportation.php">Transportation</a></li>';
?>
<?php
if($cur == 'FinalProjectPSPI/accessibility.php')
echo '<li><a style = "color: grey;">Accessibility</a></li>';
else
echo '<li><a href="accessibility.php">Accessibility</a></li>';
?>
<?php
if($cur == 'FinalProjectPSPI/heritage.php')
echo '<li><a style = "color: grey;">Heritage</a></li>';
else
echo '<li><a href="heritage.php">Heritage</a></li>';
?>
<?php
if($cur == 'FinalProjectPSPI/environment.php'){
include('fun.php');
echo '<li class="dropdown"><a style = "color: grey;">Environment</a>
<div class="dropdown-content">
<a href="#air_pollution">Air Pollution</a>
<a href="#water_pollution">Water Pollution</a>
</div>
</li>' ;
}else
echo '<li><a href="environment.php">Environment</a></li>';
?>
<?php
if($cur == 'FinalProjectPSPI/cooperation.php'){
include('fun.php');
echo '<li class="dropdown"><a style = "color: grey;">Cooperation</a>
<div class="dropdown-content">
<a href="#rural_urban">Rural and Urban </a>
<a href="#developed_developing">Developed and Developing countries</a>
</div>
</li>' ;
}else
echo '<li><a href="cooperation.php">Cooperation</a></li>';
?>
<?php
if($cur == 'FinalProjectPSPI/quiz.php' || $cur == 'FinalProjectPSPI/volunteer.php' ){
?><li class="dropdown"><a style = "color: grey;">Extra Activities</a>
<div class="dropdown-content">
<a>Take a quiz<i class="fas fa-caret-down" style="float:right;margin-left:10px;margin-top:5%"></i></a>
<div class="dropdown-forextra">
<ul>
<?php $choice=""; ?>
<li><a href="quiz.php?choice=<?php echo "first";?>">Quiz 1</a></li>
<li><a href="quiz.php?choice=<?php echo "second";?>">Quiz 2</a></li>
<li><a href="quiz.php?choice=<?php echo "third";?>">Quiz 3</a></li>
</ul>
</div>
<a href="volunteer.php">Volunteering</a>
</div>
</li><?php
}else{ ?>
<li class="dropdown"><a>Extra Activities</a>
<div class="dropdown-content">
<a>Take a quiz<i class="fas fa-caret-down" style="float:right;margin-left:10px;margin-top:5%"></i></a>
<div class="dropdown-forextra">
<ul>
<li><a href="quiz.php?choice=<?php echo "first";?>">Quiz 1</a></li>
<li><a href="quiz.php?choice=<?php echo "second";?>">Quiz 2</a></li>
<li><a href="quiz.php?choice=<?php echo "third";?>">Quiz 3</a></li>
</ul>
</div>
<a href="volunteer.php">Volunteering</a>
</div>
</li>
<?php } ?>
</ul>
<div class="dropdown-username">
<button onclick="myFunction()" class="btn-primary"><?php echo $_SESSION['user'] , '<i class="fas fa-caret-down" style="float:right;margin-left:10px;margin-top:5px"></i>' ; ?></button>
<div id="myDropdown" class="dropdown-content">
<a href="profile.php">My Profile</a>
<a id="logout" href="index.php?from=<?php echo "out";?>">Log out</a></li>
</div>
</div>
<script>
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content-username");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
</div>
</div>
</nav>