-
Notifications
You must be signed in to change notification settings - Fork 1
/
notice_slider.php
111 lines (104 loc) · 5.18 KB
/
notice_slider.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
<?php include 'session.php' ?>
<?php
if(isset($_SESSION['login_user'])) {
header("location: show_notice.php");
}
?>
<?php
//Showing all news
$msg = '';
$msgClass = '';
$query = "SELECT * FROM notices ORDER BY id DESC LIMIT 5";
$result = mysqli_query($connection, $query);
if(!$result) {
die("Query Failed .. !" . mysqli_error($connection));
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>All Notices | GICCL</title>
<!-- bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<!-- font awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
#show_news {
margin-top: 150px;
}
.img-show-notice {
width: 600px;
display: block;
margin-left: auto;
margin-right: auto;
}
.carousel-inner img {
margin-top: 20px;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<!-- header -->
<?php include 'header.php' ?><!-- header ends -->
<!-- section create news -->
<section id="show_news" class="pd_top mb-5">
<div class="container">
<div class="">
<h3 class="text-center font-weight-bold mt-3 mb-3">Notice Board</h2>
<div class="row justify-content-center">
<div class="col-md-12 col-sm-12 col-xs-12">
<?php if(mysqli_num_rows($result) == 0) { ?>
<div class="text-center alert alert-warning">No notice available!</div>
<?php } else { ?>
<div id="noticeCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ul class="carousel-indicators">
<li data-target="#noticeCarousel" data-slide-to="0" class="active"></li>
<li data-target="#noticeCarousel" data-slide-to="1"></li>
<li data-target="#noticeCarousel" data-slide-to="2"></li>
<li data-target="#noticeCarousel" data-slide-to="3"></li>
<li data-target="#noticeCarousel" data-slide-to="4"></li>
</ul>
<!-- The slideshow -->
<div class="carousel-inner">
<?php
$count = 0;
while ($row = mysqli_fetch_array($result)) { ?>
<?php if($count == 0){ ?>
<div class="carousel-item active">
<?php } else { ?>
<div class="carousel-item">
<?php } ?>
<a href="images/notice-images/<?php echo $row['filename']; ?>" title="click to download the notice" download><img src="images/notice-images/<?php echo $row['filename']; ?>" class="img-show-notice"></a>
<div class="carousel-caption d-none">
<a href="images/notice-images/<?php echo $row['filename']; ?>" title="click to download the notice" class="btn btn-warning " download>Download</a>
</div>
</div>
<?php $count = $count + 1; ?>
<?php } ?>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#noticeCarousel" data-slide="prev">
<span class="fa fa-chevron-circle-left" style="color: black;"></span>
</a>
<a class="carousel-control-next" href="#noticeCarousel" data-slide="next">
<span class="fa fa-chevron-circle-right" style="color: black;"></span>
</a>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</section><!-- section create news ends -->
<?php include 'footer.php'; ?>
</body>
</html>