-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcancelProjects.php
221 lines (177 loc) · 7.92 KB
/
cancelProjects.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
<?php
error_reporting(0);
session_start();
require __DIR__ . "/includes/AuthVerification.php";
$email = $_SESSION['email'];
$connect = mysqli_connect('localhost', 'root', 'lakshya', 'lakshya');
$results_per_page = 15;
$result = mysqli_query($connect, "SELECT * FROM reason WHERE email='$email'");
$number_of_results = mysqli_num_rows($result);
$number_of_pages = ceil($number_of_results/$results_per_page);
if(!isset($_GET['page']))
$page = 1;
else
$page = $_GET['page'];
$page_next = $page + 1;
$page_previous = $page - 1;
//determine sql starting limit number for results on displaying page.
$this_page_first_result = ($page > 1) ? ($page-1)*$results_per_page : 0;
$result1 = mysqli_query($connect, "SELECT * FROM reason WHERE email='$email' LIMIT " . $this_page_first_result . ',' . $results_per_page);
$query_results = mysqli_num_rows($result1);
if($page > $number_of_pages)
{
header('Location: cancelProjects.php?page=' . $number_of_pages);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="shortcut icon" href="images/favicon.png" type="image/x-icon" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.bundle.min.js">
<link rel="stylesheet" href="css/cancelledProjects.css">
<title>FlexCreo - Users Panel</title>
</head>
<body>
<nav class="navbar navbar-toggleable-md navbar-inverse p-0" style='background-color: #292b2c;'>
<div class="container">
<a href="index.php" class="navbar-brand text-white">Flex<strong style='color: #EB004E;'>Creo</strong></a>
<div class='right-side'>
<a href="settings.php" class="d-inline mr-4" style='text-decoration:none; color: #ddd;'>
<i class="fa fa-gear"></i> Settings
</a>
<a href="logout.php" class="d-inline logout" style='text-decoration:none; color: #ddd;'>
<i class="fa fa-user-times"></i> Logout
</a>
</div>
</div>
</nav>
<!-- Header -->
<header id="main-header" class="py-2 text-white">
<div class="container">
<div class="row">
<div class="col-md-6">
<h1>
<i class="fa fa-remove"></i> Cancelled Projects
</h1>
</div>
</div>
</div>
</header>
<!-- Section -->
<section id="sections" class="py-4 mb-4 bg-faded">
<div class="container">
<div class="row">
<div class="col-md-3 mb-2">
<a href="dashboard.php" class="btn btn-block shadow-none" style='color: #007bff; background-color: #fff; border: 1px solid #007bff;'>
<i class="fa fa-arrow-left"></i> Dashboard
</a>
</div>
<div class="col-md-5 ml-auto mb-2">
<div class="input-group">
<input type="text" name="search" id="search" onkeyup="SearchField();" class="form-control shadow-none" placeholder="Search from Title or Category">
<span class="input-group-btn">
<button class="btn shadow-none" id="search-button">Search</button>
</span>
</div>
</div>
</div>
</div>
</section>
<!-- Project List -->
<section id="projects">
<div class="container">
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<h4>All Projects</h4>
</div>
<table class="table table-hover table-responsive table-bordered text-justify-all">
<?php
if($query_results > 0)
{
echo '<thead class="thead-inverse">
<tr>
<th class="text-center">Id</th>
<th class="text-center">Title</th>
<th class="text-center">Category</th>
<th class="text-center">Reason</th>
<th class="text-center">Review</th>
<th class="text-center">Date Cancelled</th>
</tr>
</thead>';
?> <tbody id="display"> <?php
while($row = mysqli_fetch_assoc($result1))
{
$title = $row['title'];
$category = $row['category'];
echo "<tr class='text-center'>
<td>" . $row['id'] . "</td>
<td>" . $row['title'] . "</td>
<td>" . $row['category'] . "</td>
<td class='dd'>" . $row['reason'] . "</td>
<td>" . $row['review'] . "</td>
<td>" . $row['dateCancelled'] . "</td>
</tr>";
}
}
else
{
echo "<h5 class='text-center mt-3'> No Cancelled Projects yet. </h5>";
}
?>
</tbody>
</table>
<div class="col-md-12">
<hr>
</div>
<nav class="ml-4">
<ul class="pagination">
<?php if($page > 1) { ?>
<li class="page-item"><a href="<?php echo 'cancelProjects.php?page=' . $page_previous ?>" class="page-link">Previous</a></li>
<?php } ?>
<?php
for ($page = 1; $page <= $number_of_pages ; $page++)
{
echo '<li class="page-item"><a href="cancelProjects.php?page=' . $page . '" class="page-link">' . $page . ' ' . '</a></li>';
}
?>
<?php if($page >= 1) { ?>
<li class="page-item "><a href="<?php echo 'cancelProjects.php?page=' . $page_next ?>" class="page-link">Next</a></li>
<?php } ?>
</ul>
</nav>
</div>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer id="main-footer" style="background-color: #292b2c; margin-top: 3rem; color: #fff; text-align: center; padding: 1rem 1rem;">
<div class="container">
<div class="row">
<div class="col">
<p class="lead">Copyright 2018 © FlexCreo</p>
</div>
</div>
</div>
</footer>
<script type="text/javascript">
function SearchField() {
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "select_cancel_projects.php?email=<?php echo $email; ?>&search="+document.getElementById('search').value, false);
xmlhttp.send(null);
document.getElementById('display').innerHTML=xmlhttp.responseText;
}
</script>
<script src="js/jquery.min.js"></script>
<script src="js/tether.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>