-
Notifications
You must be signed in to change notification settings - Fork 3
/
dashboard.php
456 lines (410 loc) · 12.5 KB
/
dashboard.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
<?php
session_start();
error_reporting(0);
if(!$_SESSION["login"] or $_SESSION["login"]===false){
header("Location:index");
}
?>
<!DOCTYPE html>
<html>
<head>
<link href="seekbar.css" rel="stylesheet" type="text/css"/>
<script src="seekbar.js" type="text/javascript"></script>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #101;
}
li {
float: right;
}
li a, .dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover, .dropdown:hover .dropbtn {
background-color: red;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.dropdown:hover .dropdown-content {
display: block;
}
@media screen and (max-width: 600px){
ul.topnav li.right,
ul.topnav li {float: none;}
}
#logo{
float:left;
}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 100; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Header */
.modal-header {
padding: 2px 16px;
background-color: #010105;
color: white;
}
/* Modal Body */
.modal-body {padding: 2px 16px;}
/* Modal Footer */
.modal-footer {
padding: 2px 16px;
background-color: #010105;
color: white;
}
/* Modal Content */
.modal-content {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
top:30%;
border: 1px solid #888;
width: 80%;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
-webkit-animation-name: animatetop;
-webkit-animation-duration: 0.4s;
animation-name: animatetop;
animation-duration: 0.4s
}
/* Add Animation */
@-webkit-keyframes animatetop {
from {top: -300px; opacity: 0}
to {top: 30%; opacity: 1}
}
@keyframes animatetop {
from {top: -300px; opacity: 0}
to {top: 30% opacity: 1}
}
/* The Close Button */
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: red;
text-decoration: none;
cursor: pointer;
}
#slider {
margin: 20px;
}
</style>
<title>My Dashboard</title>
</head>
<body onload="checkActive()">
<?php
$con = mysqli_connect("localhost","root","","courserec");
// Check connection
if (mysqli_connect_errno())
{
die("Failed to connect to MySQL: " . mysqli_connect_error());
}
$sql="SELECT * from studentsettings where RollNo='".$_SESSION["RollNo"]."'";
$ret=mysqli_query($con,$sql);
$count=mysqli_num_rows($ret);
if($count==1){
$row=mysqli_fetch_assoc($ret);
$_SESSION["Theory"]=$row["Theory"];
$_SESSION["Programming"]=$row["Programming"];
$_SESSION["Placement"]=$row["Placement"];
$_SESSION["Prerequisite"]=$row["Prerequisite"];
$_SESSION["Problematic"]=$row["Problematic"];
}
?>
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span class="close">×</span>
<center><h2>User Specific Settings</h2><center>
</div>
<div class="modal-body">
<table>
<tr onclick="updateValue()">
<td><b>Theory</b></td>
<td style="width:100%;"><div class="seekbar" data-seekbar-value="<?php echo $_SESSION["Theory"]?>"></div></td>
<td><div class="seekbarvalues"></div></td>
</tr>
<tr onclick="updateValue()">
<td><b>Programming</b></td>
<td><div class="seekbar" data-seekbar-value="<?php echo $_SESSION["Programming"]?>"></div></td>
<td><div class="seekbarvalues"></div></td>
</tr>
<tr onclick="updateValue()">
<td><b>Placement<b></td>
<td><div class="seekbar" data-seekbar-value="<?php echo $_SESSION["Placement"]?>"></div></td>
<td><div class="seekbarvalues"></div></td>
</tr>
<tr onclick="updateValue()">
<td><b> Diversity </b></td>
<td><div class="seekbar" data-seekbar-value="<?php echo $_SESSION["Prerequisite"]?>"></div></td>
<td><div class="seekbarvalues"></div></td>
</tr>
<tr onclick="updateValue()">
<td><b>Analytical</b></td>
<td><div class="seekbar" data-seekbar-value="<?php echo $_SESSION["Problematic"]?>"></div></td>
<td><div class="seekbarvalues"></div></td>
</tr>
</table>
<br/>
<center><input class="button" id="save" type="submit" value="Save Settings" onclick="saveSettings()"></center>
</div>
<div class="modal-footer">
<h3>Set your preferences to get better results.</h3>
</div>
</div>
</div>
<ul>
<li id="logo"><img src="logo.jpg" style="float:left;height:100%;width:100px;" /></li>
<li class="dropdown">
<a href="javascript:void(0)" class="dropbtn"><?php echo $_SESSION["FirstName"]; ?></a>
<div class="dropdown-content">
<a href="#" onclick="showSettings()">Settings</a>
<a href="#">Help</a>
<a href="logout">Logout</a>
</div>
</li>
<li><a href="#news" onclick="location.href='profile';">Profile</a></li>
<li><a href="#home" onclick="location.href='dashboard';">Home</a></li>
</ul>
<center>
<h2>Summary</h2>
<style>
.tg {
color: #333;
font-family: Helvetica, Arial, sans-serif;
width: 640px;
border-collapse:
collapse; border-spacing: 0;
}
.td, .th {
border: 1px solid transparent; /* No more visible border */
height: 30px;
transition: all 0.3s; /* Simple transition for hover effect */
}
.th {
background: #DFDFDF; /* Darken header a bit */
font-weight: bold;
}
.td {
background: #FAFAFA;
text-align: center;
}
/* Cells in even rows (2,4,6...) are one color */
.tr:nth-child(even) .td { background: #F1F1F1; }
/* Cells in odd rows (1,3,5...) are another (excludes header cells) */
.tr:nth-child(odd) .td { background: #FEFEFE; }
.tr .td:hover { background: #666; color: #FFF; }
/* Hover cell effect! */
</style>
<table class="tg" style="undefined;table-layout: fixed; width: 604px">
<tr class="tr"><td class="td" rowspan="4"><img src="images/<?php echo $_SESSION["ImageFile"];?>" width="140" height="140"/></td></tr>
<tr class="tr"><td class="td" colspan="3">Name : <b><?php echo $_SESSION["FirstName"]." ".$_SESSION["LastName"]; ?> </b></td></tr>
<tr class="tr"><td class="td" colspan="3">Program : <b> <?php echo $_SESSION["Program"]; ?> </b></td></tr>
<tr class="tr"><td class="td" colspan="3">Dept : <b> <?php echo $_SESSION["Dept"]; ?></b></td></tr>
<tr class="tr">
<th class="th">Current Sem : <?php echo $_SESSION["CurrentSem"]; ?></th>
<th class="th"></th>
<th class="th" colspan="2">Total CGPA : <?php echo $_SESSION["CGPA"]; ?><br></th>
</tr>
</table>
<br/>
<h3>Sem-wise GPA</h3>
<table class="tg">
<?php
$semno=array();
$gpa=array();
$invBlock=explode(";",$_SESSION["SemMarks"]);
$j=0;
foreach($invBlock as $i){
$tmp=explode(",",$i);
$semno[$j++]=$tmp[0];
$gpa[$j++]=$tmp[1];
}
echo "<tr class=\"tr\">";
foreach($semno as $i){
if(!empty($i))
echo "<th class=\"th\">Sem : $i</th>";
}
echo "</tr><tr class=\"tr\">";
foreach($gpa as $i){
if(!empty($i))
echo "<td class=\"td\">$i</td>";
}
echo "</tr>";
?>
</table>
<style>
.button {
border: 1px solid #0a3c59;
background: #3e779d;
background: -webkit-gradient(linear, left top, left bottom, from(#65a9d7), to(#3e779d));
background: -webkit-linear-gradient(top, #65a9d7, #3e779d);
background: -moz-linear-gradient(top, #65a9d7, #3e779d);
background: -ms-linear-gradient(top, #65a9d7, #3e779d);
background: -o-linear-gradient(top, #65a9d7, #3e779d);
background-image: -ms-linear-gradient(top, #65a9d7 0%, #3e779d 100%);
padding: 10px 20px;
-webkit-border-radius: 11px;
-moz-border-radius: 11px;
border-radius: 11px;
-webkit-box-shadow: rgba(255,255,255,0.4) 0 0px 0, inset rgba(255,255,255,0.4) 0 1px 0;
-moz-box-shadow: rgba(255,255,255,0.4) 0 0px 0, inset rgba(255,255,255,0.4) 0 1px 0;
box-shadow: rgba(255,255,255,0.4) 0 0px 0, inset rgba(255,255,255,0.4) 0 1px 0;
text-shadow: #7ea4bd 0 1px 0;
color: #203e52;
font-size: 17px;
font-family: helvetica, serif;
text-decoration: none;
vertical-align: middle;
}
.button:hover {
border: 1px solid #0a3c59;
text-shadow: #1e4158 0 1px 0;
background: #3e779d;
background: -webkit-gradient(linear, left top, left bottom, from(#65a9d7), to(#3e779d));
background: -webkit-linear-gradient(top, #65a9d7, #3e779d);
background: -moz-linear-gradient(top, #65a9d7, #3e779d);
background: -ms-linear-gradient(top, #65a9d7, #3e779d);
background: -o-linear-gradient(top, #65a9d7, #3e779d);
background-image: -ms-linear-gradient(top, #65a9d7 0%, #3e779d 100%);
color: #fff;
}
.button:active {
text-shadow: #1e4158 0 1px 0;
border: 1px solid #0a3c59;
background: #65a9d7;
background: -webkit-gradient(linear, left top, left bottom, from(#3e779d), to(#3e779d));
background: -webkit-linear-gradient(top, #3e779d, #65a9d7);
background: -moz-linear-gradient(top, #3e779d, #65a9d7);
background: -ms-linear-gradient(top, #3e779d, #65a9d7);
background: -o-linear-gradient(top, #3e779d, #65a9d7);
background-image: -ms-linear-gradient(top, #3e779d 0%, #65a9d7 100%);
color: #fff;
}
</style>
<br/>
<div><input onclick="location.href='electives';"class="button" type="submit" value="Select Electives"><span>. .</span><input class="button" onclick="location.href='feedback';" type="submit" value="Give Feedback"></div>
</center>
</body>
<script>
// Get the modal
var modal = document.getElementById('myModal');
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
span.style.display="none";
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
/*window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}*/
function checkActive(){
<?php
if($_SESSION["Active"]==0){
?>
modal.style.display = "block";
<?php
}
?>
}
function showSettings(){
modal.style.display = "block";
var span = document.getElementsByClassName("close")[0];
span.style.display="inline";
}
function updateValue(){
var sbv=document.getElementsByClassName('seekbarvalues');
var sb=document.getElementsByClassName('seekbar');
document.getElementById("save").value = "Save Settings";
var span = document.getElementsByClassName("close")[0];
span.style.display="none";
for(var i=0;i<sb.length;i++){
sbv[i].innerHTML=sb[i].getAttribute('data-seekbar-value');
}
}
function saveSettings(){
var sbv=document.getElementsByClassName('seekbarvalues');
var v1=sbv[0].innerHTML;
var v2=sbv[1].innerHTML;
var v3=sbv[2].innerHTML;
var v4=sbv[3].innerHTML;
var v5=sbv[4].innerHTML;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("save").value = "Saved";
var span = document.getElementsByClassName("close")[0];
span.style.display="inline";
<?php $_SESSION["Active"]=1; ?>
<?php
$con = mysqli_connect("localhost","root","","courserec");
// Check connection
if (mysqli_connect_errno())
{
die("Failed to connect to MySQL: " . mysqli_connect_error());
}
$sql="SELECT * from studentsettings where RollNo='".$_SESSION["RollNo"]."'";
$ret=mysqli_query($con,$sql);
$count=mysqli_num_rows($ret);
if($count==1){
$row=mysqli_fetch_assoc($ret);
$_SESSION["Theory"]=$row["Theory"];
$_SESSION["Programming"]=$row["Programming"];
$_SESSION["Placement"]=$row["Placement"];
$_SESSION["Prerequisite"]=$row["Prerequisite"];
$_SESSION["Problematic"]=$row["Problematic"];
}
mysqli_close($con);
?>
}
};
var val="<?php echo $_SESSION["RollNo"]; ?>";
xhttp.open("GET", "savesetting?v1="+v1+"&v2="+v2+"&v3="+v3+"&v4="+v4+"&v5="+v5+"&RollNo="+val, true);
xhttp.send(null);
}
</script>
</html>