forked from Shubham8287/notice
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
188 lines (150 loc) · 5.99 KB
/
Copy pathindex.php
File metadata and controls
188 lines (150 loc) · 5.99 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
<?php require('php/connect.php');
require('php/deleteTeacher.php');
if(isset($_POST['data']) ){
//Data 1
$sql = "SELECT Count(*) FROM uploads ";
$data['value1'] = mysqli_fetch_array(mysqli_query($connection,$sql) );
$sql = "SELECT Count(*) FROM attendance ";
$data['value2'] = mysqli_fetch_array(mysqli_query($connection,$sql) );
$sql = "SELECT Count(*) FROM notification";
$data['value3'] = mysqli_fetch_array(mysqli_query($connection,$sql) );
$sql = "SELECT Count(*)FROM alert";
$data['value4'] = mysqli_fetch_array(mysqli_query($connection,$sql) );
echo json_encode($data);
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Digital Notice</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="FirstRow">
<div class="photo-galery">
<!-- <marquee behavior="scroll" direction="left"> -->
<?php $cmd="SELECT * FROM uploads
ORDER BY id DESC ";
$result= mysqli_query($connection,$cmd);
while($row=mysqli_fetch_array($result))
{
if(strpos($row['name'], 'mp4') == false){
?>
<img class="mySlides" src="<?php echo($row['name']) ?>" width="90%" hight="90%" alt="">
<div class="qw" ><?php echo($row['time']) ?> </div>
<?php }
else{ ?>
<video class="mySlides" width="90%" hight="90%" autoplay muted loop> <source src="<?php echo($row['name']) ?>" > </video>
<div class="qw" ><?php echo($row['time']) ?> </div>
<?php } } ?>
<!-- </marquee> -->
</div>
<div class="sec teachers-on-leave">
<div class="sec-heading teachers-on-leave-heading">
<h2>Teachers on Leave</h2>
</div>
<marquee behavior="scroll" direction="up">
<div class="teachers-on-leave-names">
<?php $cmd="SELECT * FROM attendance WHERE startDate <= '".$date."' && endDate >= '".$date."'
ORDER BY id DESC ";
$result= mysqli_query($connection,$cmd);
while($row=mysqli_fetch_array($result))
{
?>
<h3 class="teachers-name"><?php echo $row['name'] ?></h3>
<?php } ?>
</div>
</marquee>
</div>
</div>
<div class="SecondRow">
<div class="sec">
<div class="sec-heading imp-notification-heading">
<h2>Announcements</h2>
</div>
<div class="imp-notification">
<?php $cmd="SELECT * FROM alert
ORDER BY id DESC ";
$result= mysqli_query($connection,$cmd);
while($row=mysqli_fetch_array($result))
{
?>
<h4 class="imp-txt"><?php echo $row['description']; ?>.</h4>
<?php } ?>
</div>
</div>
<div class="sec">
<div class="sec-heading notification-heading">
<h2>Notifications</h2>
</div>
<marquee behavior="scroll" direction="up">
<?php $cmd="SELECT * FROM notification
ORDER BY id DESC ";
$result= mysqli_query($connection,$cmd);
while($row=mysqli_fetch_array($result))
{
?>
<div class="notification">
<h4 class="txt"><?php echo $row['description']; ?>.</h4>
</div><?php } ?>
</marquee>
</div>
</div>
<script>
$(document).ready( function(){
var upload_len="-1",teacher_len="-1",notice_len="-1",alert_len="-1",data="-1";
setInterval(function() {
jQuery.ajax({
type: "POST",
// dataType: 'json',
data: {"data":data},
success: function(data){
data = jQuery.parseJSON( data );
upload=data["value1"]["0"]
teacher=data["value2"]["0"]
notice=data["value3"]["0"]
alert=data["value4"]["0"]
if(upload_len=="-1"&&teacher_len=="-1"&¬ice_len=="-1"&&alert_len=="-1")
{console.log(upload,upload_len , teacher,teacher_len , notice,notice_len , alert,alert_len );
upload_len=upload;
teacher_len=teacher;
notice_len=notice;
alert_len=alert}
else
if(upload!=upload_len || teacher!=teacher_len || notice!=notice_len || alert!=alert_len )
{location.reload();
}
},
error: function(jqXHR, exception){
var msg = '';
if (jqXHR.status === 0) {
msg = 'Not connect.\n Verify Network.';
} else if (jqXHR.status == 404) {
msg = 'Requested page not found. [404]';
} else if (jqXHR.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
}
console.log(msg);
}
});
}, 2000);
});
</script>
<script src="jj.js" type="text/javascript" charset="utf-8" async defer></script>
</body>
</html>