-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.php
234 lines (209 loc) · 7.51 KB
/
tasks.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
<?php
session_start();
require('Connection/connect.php');
require_once('fns.php');
if(!$_SESSION['facer']){
header('Location: ./');
exit;
}
$showRecordPerPage = 12;
if(isset($_GET['page']) && !empty($_GET['page'])){
$currentPage = $_GET['page'];
}else{
$currentPage = 1;
}
$startFrom = ($currentPage * $showRecordPerPage) - $showRecordPerPage;
$totalEmpSQL = "SELECT * FROM tasks where status = 'approved' && end_date >= CURDATE() || status = 'approved' && end_date = '' order by rand()";
$allEmpResult = mysqli_query($connect, $totalEmpSQL);
$totalEmployee = mysqli_num_rows($allEmpResult);
$lastPage = ceil($totalEmployee/$showRecordPerPage);
$firstPage = 1;
$nextPage = $currentPage + 1;
$previousPage = $currentPage - 1;
$empSQL = "SELECT * FROM tasks where status = 'approved' && end_date >= CURDATE() || status = 'approved' && end_date = '' order by rand() LIMIT $startFrom, $showRecordPerPage";
$empResult = mysqli_query($connect, $empSQL);
?>
<!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, shrink-to-fit=no">
<meta name="description" content="Faceflyer - A complete customer reward system, earn faceflyer coin each time you complete a task, shop deals at a store, or get cash back on every purchase from your favorite store">
<title>Faceflyer - Tasks</title>
<!-- Favicon Icon -->
<link rel="icon" type="image/png" href="assets/images/logo.png">
<!-- Custom fonts for this template-->
<link rel="stylesheet" href="assets/fontawesome/css/all.min.css">
<!-- Custom styles for this template-->
<link href="assets/css/theme.css" rel="stylesheet">
<!-- Material Design Icons -->
<link href="assets/css/materialdesignicons.min.css" media="all" rel="stylesheet" type="text/css" />
<!-- Select2 CSS -->
<link href="assets/css/select2-bootstrap.css" />
<link href="assets/css/select2.min.css" rel="stylesheet" />
<!-- icofont -->
<link href="assets/css/icofont.min.css" rel="stylesheet">
<!-- Owl Carousel -->
<link rel="stylesheet" href="assets/css/owl.carousel.css">
<link rel="stylesheet" href="assets/css/owl.theme.css">
<!-- Custom styles for this template-->
<link href="assets/css/style.css" rel="stylesheet">
<!-- Hotjar Tracking Code for www.faceflyer.com -->
<script>
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:1964395,hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<?php include 'header.php'; ?>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<section class="section-padding">
<div class="container">
<div class="row pt-lg-4">
<div class="col-md-2"></div>
<div class="col-md-8">
<div id="slider" class="carousel slide" data-ride="carousel" data-interval="5000">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="img-fluid" src="assets/images/imageTwo11367.jpg" alt="">
</div>
<div class="carousel-item">
<img class="img-fluid" src="assets/images/imageTwo11675.jpg" alt="">
</div>
<div class="carousel-item">
<img class="img-fluid" src="assets/images/imageTwo11688.jpg" alt="">
</div>
</div>
<div class="d-none d-md-block">
<a class="carousel-control-prev" href="#slider" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#slider" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<div class="col-md-2"></div>
</div>
</div>
</div>
</section>
<section class="section-padding homepage-store-block">
<div class="container py-lg-4">
<div class="row">
<div class="col-xl-12">
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h5 mb-0 text-gray-900">Top Tasks</h1>
</div>
</div>
<?php while ($row = mysqli_fetch_assoc($empResult)) { ?>
<div class="col-xl-3 col-sm-6" style="margin-bottom:25px;">
<div class="custom-card shadow-sm h-100 stor-card">
<a href="javascript:;" data-placement="top" data-toggle="tooltip" data-original-title="<?php echo $row['count']; ?> people fulfill" class="lock-badges-icon text-center"><i class="icofont-users"></i></a>
<div class="custom-card-image">
<a href="task-details/<?php echo $row['id']; ?>">
<img class="img-fluid item-img" src="assets/images/<?php echo $row['banner']; ?>">
</a>
<div class="store-star"><span class="badge badge-success"><i class="icofont-cc"></i> <?php echo $row['coin']; ?></span>
</div>
</div>
<div class="p-3">
<div class="custom-card-body">
<h6 class="mb-0"><a class="text-gray-900" href="task-details/<?php echo $row['id']; ?>"><?php echo $row['name']; ?></a></h6>
<p class="text-gray-500 mb-2"><?php echo $row['category']; ?></p>
<?php if($row['end_date']){ ?>
<p class="text-gray mb-0"><span class="text-warning"><i class="icofont-clock-time"></i> Time Left : <?php timeLeft($row['end_date']); ?></span></p>
<?php }else{ ?>
<br>
<?php } ?>
</div>
</div>
<div class="p-3 border-top">
<div class="custom-card-badge">
<a class="text-gray-900" href="task-details/<?php echo $row['id']; ?>">
<span class="badge badge-success"><i class="icofont-sale-discount"></i> OFFER</span> Complete task to earn <?php echo $row['coin']; ?> FC
</a>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<br>
<div class="container">
<?php if($totalEmployee > 0){ ?>
<div style="float:left">
<p>Showing <?php echo $currentPage; ?> of <?php echo $totalEmployee; ?> entries</p>
</div>
<div style="float:right">
<nav aria-label="">
<ul class="pagination">
<?php if($currentPage != $firstPage) { ?>
<li class="page-item">
<a class="page-link" href="?page=<?php echo $firstPage ?>" tabindex="-1" aria-label="Previous">
<span aria-hidden="true">First</span>
</a>
</li>
<?php } ?>
<?php if($currentPage >= 2) { ?>
<li class="page-item"><a class="page-link" href="?page=<?php echo $previousPage ?>"><?php echo $previousPage ?></a></li>
<?php } ?>
<li class="page-item active"><a class="page-link" href="?page=<?php echo $currentPage ?>"><?php echo $currentPage ?></a></li>
<?php if($currentPage != $lastPage) { ?>
<li class="page-item"><a class="page-link" href="?page=<?php echo $nextPage ?>"><?php echo $nextPage ?></a></li>
<li class="page-item">
<a class="page-link" href="?page=<?php echo $lastPage ?>" aria-label="Next">
<span aria-hidden="true">Last</span>
</a>
</li>
<?php } ?>
</ul>
</nav>
</div>
<?php } ?>
</div>
<br><br>
</section>
<?php include 'footer.php'; ?>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
</div>
<!-- End of Content Wrapper -->
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded-circle" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Bootstrap core JavaScript -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="assets/js/jquery.easing.min.js"></script>
<!-- select2 Js -->
<script src="assets/js/select2.min.js"></script>
<!-- Owl Carousel -->
<script src="assets/js/owl.carousel.js"></script>
<!-- Custom -->
<script src="assets/js/custom.js"></script>
</body>
</html>