-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdepartment.php
More file actions
339 lines (265 loc) · 8.2 KB
/
department.php
File metadata and controls
339 lines (265 loc) · 8.2 KB
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
<?php
## Include connection.php file and extract list of faculty_names
session_start();
require_once("config.php");
$_SESSION['url'] = $_SERVER['REQUEST_URI'];
$is_correct = False;
if(isset($_GET['q'])){
$dept_name = $_GET['q'];
if(strcmp($dept_name, "CS") == 0){
$dept_name = "Computer Science";
$dept_to_write = "Computer Science Department";
$is_correct = True;
}
else if(strcmp($dept_name, "EE") == 0){
$dept_name = "Electrical";
$dept_to_write = "Electrical Department";
$is_correct = True;
}
else if(strcmp($dept_name, "ME") == 0){
$dept_name = "Mechanical";
$dept_to_write = "Mechanical Department";
$is_correct = True;
}
else
$dept_to_write = Null;
}
if($is_correct == True){
$result = pg_query($pg, "select Faculty.Name, Faculty.username from Faculty, Department where Faculty.dept_id = Department.Id and Department.name='$dept_name'");
$resultHOD = pg_query($pg, "select Faculty.Name, Faculty.username from Faculty, Department, HOD where Faculty.dept_id = Department.Id and Department.Id = HOD.dept_id and Department.name='$dept_name'");
$resultHOD = pg_fetch_all($resultHOD);
$resultArr = pg_fetch_all($result);
#print_r($resultArr);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Faculty Hierarchy of College(Static for now) </title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style type="text/css">
.primary{
background-color: #4da6ff;
height: 400px;
text-align: center;
}
.Logo{
width : 350px;
height:350px;
margin-top:25px;
}
hr{
border: 2px solid black;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
max-width: 200px;
/*margin: auto;*/
text-align: center;
font-family: arial;
}
.faculty-column {
float: left;
width: 33.33%;
padding: 5px;
}
.faculty-row::after {
content: "";
clear: both;
display: table;
}
.containerdash{
margin-left : 175px;
}
li {
float: left;
}
li a {
display: block;
color: #666;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover:not(.active) {
background-color: #ddd;
}
li a.active {
color: white;
background-color: #4da6ff;
}
.has-navigation {
list-style-type: none;
width: 100%;
margin: 0;
padding: 0;
overflow: hidden;
border: 1px solid #e7e7e7;
font-size: 18px;
}
.modal-content{
font: 14px sans-serif;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 800px;
padding: 20px;
}
</style>
</head>
<body>
<div id="Fun">
<header id="page-header">
<div class="primary" >
<div class="container">
<a href="hierarchy.php">
<img src="Images/IITLogo.jpg" alt="Indian Institute of Ropar" class="Logo">
</a>
</div>
</div>
<div class="sub-menu">
<div class="Secondary">
<ul class="has-navigation">
<div class="containerdash">
<li class style="float:right; margin-right: 30px">
<?php if(!isset($_SESSION['loggedin'])) {?>
<a class="trigger" onclick="openForm()" style="color: blue">Login</a>
<?php }else{?>
<a href="logout.php" class="Logout" style="color: blue">Logout</a>
<?php }?>
</li>
<?php if(isset($_SESSION['loggedin'])) {?>
<li class style="float:right; margin-right: 30px">
<a href="template.php?q=<?php echo $_SESSION['username']; ?>"" style="color: blue"> <?php echo $_SESSION['name']; ?></a>
</li>
<?php } ?>
</div>
</ul>
</div>
</div>
</header>
<div class="container">
<div class="Department-Name">
<h1 style="color:#595959;"><?php echo $dept_to_write ?></h1>
<hr>
</div>
<?php if($dept_to_write){?>
<div class="HOD">
<h2 style="color:#595959;"> Head Of Department </h2>
<hr>
<!-- Insert link for HOD's Page here-->
<a href="template.php?q=<?php echo $resultHOD[0]['username']; ?>">
<div class="card">
<img src="Images/Person.png" alt="John" style="width:100%">
<h3><?php echo $resultHOD[0]['name']; ?></h3>
</div>
</a>
</div>
<div class="Faculty">
<h2 style="color:#595959;"> Faculty </h2>
<hr>
<div class="faculty-row">
<!-- Repeat this for number of faculties -->
<?php for($count = 0; $count < count($resultArr); $count++){?>
<?php if(strcmp($resultArr[$count]['username'], $resultHOD[0]['username']) != 0){?>
<div class="faculty-column">
<a href="template.php?q=<?php echo $resultArr[$count]['username']; ?>">
<div class="card">
<img src="Images/Person.png" alt="John" style="width:100%">
<h3><?php echo $resultArr[$count]['name']; ?></h3>
</div>
</a>
</div>
<?php } ?>
<?php } ?>
<!-- Images can change w.r.t to faculty images and name -->
</div>
</div>
<?php }?>
</div>
</div>
<!-- Login Pop Up Implemented -->
<div class="modal" id="myForm">
<div class="modal-content">
<h2>Login</h2>
<p>Please fill in your credentials to login.</p>
<form>
<div class="form-group <?php echo (!empty($username_err)) ? 'has-error' : ''; ?>">
<label>Username</label>
<input type="text" name="username" class="form-control" value="<?php echo $username; ?>">
<span class="help-block"><?php echo $username_err; ?></span>
</div>
<div class="form-group <?php echo (!empty($password_err)) ? 'has-error' : ''; ?>">
<label>Password</label>
<input type="password" name="password" class="form-control">
<span class="help-block"><?php echo $password_err; ?></span>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="Login">
</div>
<div class="form-group">
<button type="button" class="btn cancel" onclick="closeForm()" style="background-color:red;">Close</button>
</div>
<p>Don't have an account? <a href="phpinfo.php">Sign up now</a>.</p>
</form>
</div>
</div>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
function openForm() {
document.getElementById("myForm").style.display = "block";
document.getElementById("Fun").style.opacity = 0.3;
}
function closeForm() {
document.getElementById("myForm").style.display = "none";
document.getElementById("Fun").style.opacity = 1;
}
$(function () {
$(".Logout").click(function(){
$.ajax({
url: "logout.php",
success: function(){
location.reload();
}
});
});
});
$(function () {
$('form').on('submit', function (e) {
e.preventDefault();
$.ajax({
type: 'post',
url: 'login.php',
data: $('form').serialize(),
success: function (result) {
if(result == 1)
location.reload();
//alert(result);
else
$(".help-block").text("Incorrect Username/Passoword");
}
});
});
});
/*
var modal = document.querySelector(".modal");
var trigger = document.querySelector(".trigger");
var closeButton = document.querySelector(".close-button");
function toggleModal() {
modal.classList.toggle("show-modal");
}
function windowOnClick(event) {
if (event.target === modal) {
toggleModal();
}
}
trigger.addEventListener("click", toggleModal);
closeButton.addEventListener("click", toggleModal);
window.addEventListener("click", windowOnClick);
*/
</script>
<!-- ##################################3-->
</body>
</html>