-
Notifications
You must be signed in to change notification settings - Fork 0
/
notification.php
425 lines (385 loc) · 20.1 KB
/
notification.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
<?php
/**
* Created by PhpStorm.
* User: alihamza
* Date: 5/25/18
* Time: 11:28 PM
*/
include_once('connection.php');
include_once('userData.php');
session_start();
$rollNo=$_SESSION['rollNo'];
$userData= getUserData($rollNo,$conn);
$userName = $userData['firstName']." ".$userData['lastName'];
$userPic = $userData;
$q = "UPDATE notifications set seen=1 where rollNo = '".$rollNo."'";
mysqli_query($conn,$q);
?>
<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title><?php echo $userName ?></title>
<!-- Font Awesome Icons -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/adminlte.min.css">
<!-- Custom style -->
<link rel="stylesheet" href="dist/css/custom.css">
<!-- Google Font: Source Sans Pro -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
<style>
.chat:hover
{
background-color: #e6e9f2;
}
</style>
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
<!-- Navbar -->
<!-- /.navbar -->
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Main content -->
<nav class="main-header navbar navbar-expand navbar-light border-bottom fixed-top" style="background-color:#293042;height: 43px;">
<div class="container" ">
<!-- Left navbar links -->
<!-- SEARCH FORM -->
<form class="form-inline ml-5" method="get" action="search.php">
<div class="input-group input-group-sm">
<select name="advancedSearch" class="form-control " style="
width: 100px;height: 30px;margin-top: -0.07em;background-color: #E4DFDD;">
<option value="people">People</option>
<option value="questions">Questions</option>
</select>
<input class="form-control form-control-navbar" style="width: 400px;background-color: white;" type="search" name="search" placeholder="Search" aria-label="Search">
<div class="input-group-append" style="background-color: #f2f4f6">
<button class="btn btn-navbar" type="submit" name="query" style="background-color: #f2f4f6">
<i class="fa fa-search"></i>
</button>
</div>
</div>
</form>
<ul class="navbar-nav" >
<li class="nav-item d-none d-sm-inline-block">
<a href="newsFeed.php" class="nav-link " style="color: white;">Home</a>
</li>
</ul>
<!-- Right navbar links -->
<ul class="navbar-nav ml-auto" >
<!-- Messages Dropdown Menu -->
<!-- Notifications Dropdown Menu -->
<li class="nav-item dropdown">
<a class="nav-link" href="notification.php">
<i class="fa fa-bell-o" style="font-size: 20px;color: white;";></i>
<span class="badge badge-warning navbar-badge" id="notifications"></span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="dropdown" style="">
<div class="widget-user-image" style="margin-top: -5px;">
<img class="img-circle elevation-2" style="height: 35px;width: 40px;" src="<?php echo $userData['userPic']?>" alt="User Avatar" style="width: 40px;height: 40px;">
</div>
</a>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right" style="margin-right: 140px;">
<a href="login.php" class="dropdown-item dropdown-footer">Log Out</a>
</div>
</li>
</ul>
<a href="query.php"><button class="btn btn-primary btn-sm" ><i class="fa fa-plus"></i> <b>Ask Query</b></button></a>
</div>
</nav>
<div class="content">
<div class="container-fluid">
<div class="row news-feed">
<div class="container">
<div class="row">
<!-- /.col -->
<div class="col-md-9">
<div class="card">
<div class="card-body">
<!-- /.tab-pane -->
<div class="tab-pane" id="timeline">
<?php $result = getNotificationData($rollNo,$conn);
echo "<ul class='timeline timeline-inverse'>
";
while ($row=mysqli_fetch_assoc($result))
{
if($row['notificationType']==1)
{
commentNotification($row['notificationFrom'],$row['notificationLink'],$row['dateTimeOfNotification'],$row['notificationHeading'],$conn);
}
else if($row['notificationType']==2)
{
followedNotification($row['notificationFrom'],$row['dateTimeOfNotification'],$conn);
}
else if($row['notificationType']==3)
{
queryNotification($row['notificationFrom'],$row['notificationLink'],$row['dateTimeOfNotification'],$row['notificationHeading'],$conn);
}
}
?>
<!-- END timeline item -->
<!-- timeline time label -->
<!-- /.timeline-label -->
<!-- timeline item -->
<!-- END timeline item -->
</ul>
</div>
<!-- /.tab-pane -->
<!-- /.tab-pane -->
<!-- /.tab-content -->
</div><!-- /.card-body -->
</div>
<!-- /.nav-tabs-custom -->
</div>
<div class="col-md-1" style="margin-top:-21px;position:fixed;right:0;border:1px solid #f4f5f9;border-left-color: #ccc;margin-right: 100px;" >
<p><b>CONTACTS</b></p>
<?php
$res = getFollowing($_SESSION['rollNo'],$conn);
while ($row = mysqli_fetch_assoc($res))
{
singlePersonMessage($row['rollNo'],$conn);
}
?>
</div>
<!-- /.col -->
</div>
</div>
</div>
<!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
</div>
<!-- ./wrapper -->
<div id="chat-box" style="display: none">
<div class='chatbox' >
<div class='card card-primary direct-chat direct-chat-primary' style='border-radius: 0px;margin-bottom: 0px !important;'>
<div class='card-header' style='border-radius: 0px;padding: .4rem 1.25rem;'>
<h3 class='card-title'>Direct Chat</h3>
<div class='card-tools'>
<span data-toggle='tooltip' title='3 New Messages' class='badge bg-primary'>3</span>
<button type='button' class='btn btn-tool' data-widget='collapse'><i class='fa fa-minus'></i>
</button>
<button type='button' class='btn btn-tool' data-toggle='tooltip' title='Contacts' data-widget='chat-pane-toggle'>
<i class='fa fa-comments'></i></button>
<button type='button' class='btn btn-tool' onclick="closeBox()"><i class='fa fa-times'></i>
</button>
</div>
</div>
<!-- /.card-header -->
<div class='card-body'>
<!-- Conversations are loaded here -->
<div class='direct-chat-messages' id='directMessage'>
<!-- Message. Default to the left -->
</div>
<!-- Contacts are loaded here -->
<div class='direct-chat-contacts'>
<!-- /.contatcts-list -->
</div>
<!-- /.direct-chat-pane -->
</div>
<!-- /.card-body -->
<div class='card-footer' style="height: 80px;">
<div class='input-group'>
<input type='text' id='message' placeholder='Type a message ...' class='form-control'>
<input type='hidden' value='' id='messageTo'>
<span class='input-group-append'>
<button id='submit1' class='btn btn-primary'>Send</button>
</span>
</div>
<div class="dropup">
<span data-toggle="dropdown" style="font-size: 25px;cursor: pointer"><p>☺</p></span>
<ul class="dropdown-menu" style="height: 320px;>
<li class="divider"><span class="emoji" id="😃" onclick="f(this.id)">😃</span>
<span class="emoji" id="😁" onclick="f(this.id)">😁</span>
<span class="emoji" id="🤗" onclick="f(this.id)">🤗</span>
<span class="emoji" id="🤩" onclick="f(this.id)">🤩</span>
<span class="emoji" id="🤔" onclick="f(this.id)">🤔</span>
<span class="emoji" id="🤨" onclick="f(this.id)">🤨</span>
<span class="emoji" id="😀" onclick="f(this.id)">😀</span>
<span class="emoji" id="🎖" onclick="f(this.id)">🎖</span>
</li>
<li class="divider">
<span class="emoji" id="😂" onclick="f(this.id)">😂</span>
<span class="emoji" id="😄" onclick="f(this.id)">😄</span>
<span class="emoji" id="😅" onclick="f(this.id)">😅</span>
<span class="emoji" id="😆" onclick="f(this.id)">😆</span>
<span class="emoji" id="😉" onclick="f(this.id)">😉</span>
<span class="emoji" id="😊" onclick="f(this.id)">😊</span>
<span class="emoji" id="😋" onclick="f(this.id)">😋</span>
<span class="emoji" id="🎁" onclick="f(this.id)">🎁</span>
</li>
<li class="divider">
<span class="emoji" id="😎" onclick="f(this.id)">😎</span>
<span class="emoji" id="😘" onclick="f(this.id)">😘</span>
<span class="emoji" id="😐" onclick="f(this.id)">😐</span>
<span class="emoji" id="😗" onclick="f(this.id)">😗</span>
<span class="emoji" id="😙" onclick="f(this.id)">😙</span>
<span class="emoji" id="☺" onclick="f(this.id)">☺</span>
<span class="emoji" id="🙂" onclick="f(this.id)">🙂</span>
<span class="emoji" id="🎄" onclick="f(this.id)">🎄</span>
</li>
<li class="divider">
<span class="emoji" id="😑" onclick="f(this.id)">😑</span>
<span class="emoji" id="🙄" onclick="f(this.id)">🙄</span>
<span class="emoji" id="😶" onclick="f(this.id)">😶</span>
<span class="emoji" id="😣" onclick="f(this.id)">😣</span>
<span class="emoji" id="😥" onclick="f(this.id)">😥</span>
<span class="emoji" id="🤐" onclick="f(this.id)">🤐</span>
<span class="emoji" id="😪" onclick="f(this.id)">😪</span>
<span class="emoji" id="🎈" onclick="f(this.id)">🎈</span>
</li>
<li class="divider">
<span class="emoji" id="😫" onclick="f(this.id)">😫</span>
<span class="emoji" id="😛" onclick="f(this.id)">😛</span>
<span class="emoji" id="😜" onclick="f(this.id)">😜</span>
<span class="emoji" id="😝" onclick="f(this.id)">😝</span>
<span class="emoji" id="🤤" onclick="f(this.id)">🤤</span>
<span class="emoji" id="😓" onclick="f(this.id)">😓</span>
<span class="emoji" id="😤" onclick="f(this.id)">😤</span>
<span class="emoji" id="🏆" onclick="f(this.id)">🏆</span>
</li>
<li class="divider">
<span class="emoji" id="😭" onclick="f(this.id)">😭</span>
<span class="emoji" id="😨" onclick="f(this.id)">😨</span>
<span class="emoji" id="😯" onclick="f(this.id)">😯</span>
<span class="emoji" id="😱" onclick="f(this.id)">😱</span>
<span class="emoji" id="🤪" onclick="f(this.id)">🤪</span>
<span class="emoji" id="😡" onclick="f(this.id)">😡</span>
<span class="emoji" id="🤒" onclick="f(this.id)">🤒</span>
<span class="emoji" id="😰" onclick="f(this.id)">😰</span>
</li>
<li class="divider">
<span class="emoji" id="😇" onclick="f(this.id)">😇</span>
<span class="emoji" id="🤠" onclick="f(this.id)">🤠</span>
<span class="emoji" id="🤭" onclick="f(this.id)">🤭</span>
<span class="emoji" id="🧐" onclick="f(this.id)">🧐</span>
<span class="emoji" id="🤕" onclick="f(this.id)">🤕</span>
<span class="emoji" id="🤯" onclick="f(this.id)">🤯</span>
<span class="emoji" id="😰" onclick="f(this.id)">😰</span>
<span class="emoji" id="👹" onclick="f(this.id)">👹</span>
</li>
<li class="divider">
<span class="emoji" id="🤯" onclick="f(this.id)">🤯</span>
<span class="emoji" id="🤕" onclick="f(this.id)">🤕</span>
<span class="emoji" id="🤢" onclick="f(this.id)">🤢</span>
<span class="emoji" id="🤮" onclick="f(this.id)">🤮</span>
<span class="emoji" id="🤭" onclick="f(this.id)">🤭</span>
<span class="emoji" id="🤓" onclick="f(this.id)">🤓</span>
<span class="emoji" id="🤡" onclick="f(this.id)">🤡</span>
<span class="emoji" id="🤧" onclick="f(this.id)">🤧</span>
</li>
<li class="divider">
<span class="emoji" id="👈" onclick="f(this.id)">👈</span>
<span class="emoji" id="👉" onclick="f(this.id)">👉</span>
<span class="emoji" id="👆" onclick="f(this.id)">👆</span>
<span class="emoji" id="👌" onclick="f(this.id)">👌</span>
<span class="emoji" id="👍" onclick="f(this.id)">👍</span>
<span class="emoji" id="👎" onclick="f(this.id)">👎</span>
<span class="emoji" id="👊" onclick="f(this.id)">👊</span>
<span class="emoji" id="👋" onclick="f(this.id)">👋</span>
</li>
</ul>
</div>
</div>
</div>
<!-- /.card-footer-->
</div>
</div>
<!-- REQUIRED SCRIPTS -->
<!-- jQuery -->
<script src="plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
<script>
var flagOpen = 0;
function showMessageBox(id)
{
flagOpen = 1;
$('#directMessage').text('');
document.getElementById('chat-box').style.display='block';
$.post('ajax/messageGet.php',
{
messageTo:id
},
function (data,status)
{
$('#directMessage').append(data)
});
document.getElementById('messageTo').value=id;
document.getElementById("directMessage").scrollTop = document.getElementById("directMessage").scrollHeight;
}
function closeBox()
{
flagOpen=0;
document.getElementById('chat-box').style.display='none';
}
$(document).ready(function ()
{
$("#submit1").click(function ()
{
var mTo = document.getElementById('messageTo').value;
$.post('ajax/messageSend.php',
{
messageTo:mTo,
message:$('#message').val()
},function (data)
{
$('#directMessage').append(data);
});
document.getElementById('message').value='';
document.getElementById("directMessage").scrollTop = document.getElementById("directMessage").scrollHeight+100;
});
});
var timer, delay = 2000;
timer = setInterval(function()
{
if(flagOpen==1)
{
var mTo = document.getElementById('messageTo').value;
$.post("ajax/singleMessageGet.php",{messageTo:mTo},function (data)
{
$('#directMessage').append(data);
});
}
}, delay);
function f(id)
{
$('#message').val($('#message').val() + id);
}
</script>
<script>
$(document).ready(function () {
$.post('ajax/messageGet.php',{messageTo:"BSEF17A020"
},function (data,status) {
$('#directMessage').append(data)
});
});
</script>
<script>
var timer, delay = 2000;
timer = setInterval(function(){
$.ajax({
type: 'POST',
url: "ajax/notificationGet.php",
success: function(html){
$('#notifications').text(html);
}
});
}, delay);
</script>
</body>
</html>