-
Notifications
You must be signed in to change notification settings - Fork 5
/
alumnisearch.php
339 lines (283 loc) · 15.5 KB
/
alumnisearch.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
<!DOCTYPE html>
<html lang="en">
<head>
<?php include_once("php/head.php");
if (isset($_SESSION["admin"])) {
header("location: admindash.php");
}
?>
<?PHP
if (!isset($_SESSION["userid"])) {
header("location: index.php");
}
?>
<script src="https://kit.fontawesome.com/d4305da033.js" crossorigin="anonymous"></script>
<title>Alumni Search | FSKTM Alumni</title>
</head>
<body>
<div class="container-fluid p-0 m-0">
<?php include_once("php/heading.php") ?>
<main>
<div id="home-container" class="container-fluid">
<div class="row justify-content-center">
<h1 class="display-5" id="alumni-search-heading">SEARCH ALUMNI PROFILES</h1>
</div>
<div class="row justify-content-center">
<div class="col-12 col-md-10 col-lg-8">
<form class="card card-sm alumni-search-form" method="GET">
<div class="card-body row no-gutters align-items-center">
<div class="col">
<input id="alumni-search-bar" class="form-control form-control-lg form-control-borderless" name="search" type="search" placeholder="Search alumni profiles (Name / Department / Level of Study)">
</div>
<!--end of col-->
<div class="col-md-1">
<button type="submit" name="submit" class="jumbotron-button"><i><img src="img/search_black_24dp.svg" alt=""></i></button>
</div>
</div>
</form>
</div>
<!--end of col-->
</div>
<div class="row">
<ul id="alumniList" class="the-alumni-cards ">
<?php
include_once("php/db_connect.php");
$sql = "SELECT ALUMNI_ID, FULL_NAME, DEPT, ENROL_YEAR, GRAD_YEAR, LEVEL, ALUMNI_IMG, GITHUB_ID, LINKEDIN_ID, BIO FROM alumni WHERE REG_STATUS = 'Active' ORDER BY FULL_NAME";
$resultset = mysqli_query($conn, $sql) or die("database error: " . mysqli_error($conn));
$number_of_results = mysqli_num_rows($resultset);
$result_per_page = 4;
$number_of_pages = ceil($number_of_results / $result_per_page);
if (!isset($_GET['page'])) {
$page = 1;
} else {
$page = $_GET['page'];
}
$starting_limit_number = ($page - 1) * $result_per_page;
if (isset($_GET["submit"])) {
$str = $_GET["search"];
$sql = "SELECT ALUMNI_ID, FULL_NAME, DEPT, ENROL_YEAR, GRAD_YEAR, LEVEL, ALUMNI_IMG, GITHUB_ID, LINKEDIN_ID, BIO FROM alumni WHERE FULL_NAME LIKE '%$str%' OR DEPT LIKE '%$str%' OR LEVEL LIKE '%$str%'";
$resultset = mysqli_query($conn, $sql) or die("database error: " . mysqli_error($conn));
showCard($resultset);
} else {
$sql = "SELECT ALUMNI_ID, FULL_NAME, DEPT, ENROL_YEAR, GRAD_YEAR, LEVEL, ALUMNI_IMG, GITHUB_ID, LINKEDIN_ID, BIO FROM alumni WHERE REG_STATUS = 'Active' ORDER BY FULL_NAME LIMIT " . $starting_limit_number . "," . $result_per_page;
$resultset = mysqli_query($conn, $sql) or die("database error: " . mysqli_error($conn));
showCard($resultset);
}
function showCard($resultset)
{
while ($record = mysqli_fetch_assoc($resultset)) {
?>
<li>
<div class="contact-box center-version shadow-lg">
<div class="body-alumni-card">
<?php echo '<img src="data:image/jpeg;base64,' . base64_encode($record['ALUMNI_IMG']) . '" class="img-circle"/>'; ?>
<h2 class="m-b-xs profile-card-name"><?php echo $record['FULL_NAME'] ?></h2>
<h4 class="card-department-alumni pb-1"><?php echo $record['DEPT'] ?></h4>
<hr>
<div class="row">
<div class="col col-card-alumni-val">
<p class="lead"><?php echo 'Batch of ' . $record['ENROL_YEAR'] ?></p>
</div>
</div>
<div class="row">
<div class="col col-card-alumni-val">
<p class="lead"><?php echo $record['LEVEL'] ?></p>
</div>
</div>
<div class="alumni-card-footer mt-1 mx-2 mb-3">
<button type="button" class="btn shadow alumni-card-view-profile-button" data-bs-toggle="modal" data-bs-target="#alumni-modal-<?php echo $record['ALUMNI_ID']; ?>">View Alumni Profile</button>
</div>
</div>
</div>
</li>
<!-- Modal Starts -->
<div class="modal fade alumni-modal" id="alumni-modal-<?php echo $record['ALUMNI_ID']; ?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
<div id="modal-content-alumni" class="modal-content shadow">
<?php $_SESSION['LAST_ACTIVITY'] = time(); ?>
<!-- Modal Header -->
<div class="modal-header mb-3">
<h4 class="modal-title" id="modal-title">Alumni Profile</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<!-- -->
<div class="container modal-container-alumni">
<div class="row d-flex justify-content-center">
<!-- Profile Card -->
<div class="contact-box center-version shadow">
<div class="row d-flex align-items-center ">
<div class="col-lg-4 d-flex justify-content-center">
<div class="body-alumni-card-modal">
<img alt="image" id="modal-profile-img" <?php echo 'src=data:image/jpeg;base64,' . base64_encode($record['ALUMNI_IMG']); ?>>
<h2 id="modal-profile-name" class="m-b-xs profile-card-name mt-3" style="text-align: center;">
<?php echo $record['FULL_NAME'] ?>
</h1>
<h4 id="modal-profile-dept" class="card-department-alumni pb-1">
<?php echo $record['DEPT'] ?>
</h4>
<div class="row">
<div class="col col-card-alumni-val">
<p id="modal-profile-level" class="lead">
<?php echo $record['LEVEL'] ?>
</p>
</div>
</div>
<div class="row">
<div class="col col-card-alumni-val">
<p id="modal-profile-level">
<?php echo $record['BIO'] ?>
</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 d-flex justify-content-center">
<div class="body-alumni-card-modal">
<div class="row d-grid justify-content-center align-items-center" id="bot-row-modal-alumni-header" style="border: 1px dashed;">
<h2 class="text-center">Academic Background</h1>
</div>
<hr>
<div class="row">
<div class="col">
<p class="h4 text-end">Course</p>
</div>
:
<div class="col">
<p class="h4" id="modal-profile-course">Computer Science</p>
</div>
</div>
<div class="row">
<div class="col">
<p class="h4 text-end">Major</p>
</div>
:
<div class="col">
<p class="h4" id="modal-profile-major">
<?php echo $record['DEPT'] ?>
</p>
</div>
</div>
<hr>
<div class="row">
<div class="col text-center">
<p class="h4" id="modal-profile-batch">
<?php echo 'Batch of ' . $record['ENROL_YEAR'] ?>
</p>
</div>
<div class="col text-center">
<p class="h4" id="modal-profile-gradYear">
<?php echo 'Graduation Year: ' . $record['GRAD_YEAR'] ?>
</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 d-flex justify-content-center">
<div class="body-alumni-card-modal">
<div class="row d-grid justify-content-center align-items-center" id="bot-row-modal-alumni-header" style="border: 1px dashed;">
<h2 class="text-center">Contact Details</h1>
</div>
<?php
if ($record['LINKEDIN_ID'] != '') {
?>
<hr>
<div class="row">
<div class="col">
<p class="h6"><a id="linkedin1" href="<?php echo $record['LINKEDIN_ID']; ?>" target="_blank" style="color: inherit;"><img src="img/linkedin_color.png" alt="LinkedIn" id="bio-icons-prof"><?php echo $record['LINKEDIN_ID']; ?></a></p>
</div>
</div>
<?php } ?>
<?php
if ($record['GITHUB_ID'] != '') {
?>
<div class="row">
<div class="col">
<p class="h6"><a id="github1" href="<?php echo $record['GITHUB_ID']; ?>" target="_blank" style="color: inherit;"><img src="img/github_black.png" alt="Github" id="bio-icons-prof"><?php echo $record['GITHUB_ID']; ?></a></p>
</div>
</div>
<?php } ?>
<?php
if ($record['GITHUB_ID'] == '' && $record['LINKEDIN_ID'] == '') {
?>
<hr>
<div class="row">
<div class="col">
<p class="h5"><?php echo $record['FULL_NAME'] ?> has not provided any public contact information!</p>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- Profile Card -->
<div class="container mt-4 shadow-lg" id="bottom-box">
<h3 id="exp-alumni-modal">Experience and Recent Project</h3>
<div style="overflow-x:auto">
<table class="content-table" id="modal-table-alumni">
<colgroup>
<col span="1" style="width: 20%;">
<col span="1" style="width: 20%;">
<col span="1" style="width: 21%;">
<col span="1" style="width: 31%;">
<col span="1" style="width: 8%;">
</colgroup>
<thead>
<tr>
<th>Company / Instituition</th>
<th>Work / Activity</th>
<th>Position</th>
<th>Description</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
include("php/db_connect.php");
$experiencequery = "SELECT * FROM experience WHERE ALUMNI_ID = " . $record['ALUMNI_ID'];
$experienceset = mysqli_query($conn, $experiencequery) or die("database error: " . mysqli_error($conn));
while ($experience = mysqli_fetch_assoc($experienceset)) {
?>
<tr>
<td><?php echo $experience['COMPANY'] ?></td>
<td><?php echo $experience['WORK_TITLE'] ?></td>
<td><?php echo $experience['POSITION'] ?></td>
<td><?php echo $experience['DESCRIPTION'] ?></td>
<td></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal Ends -->
<?php } ?>
</ul>
</div>
<?php } ?>
<!-- Pagination -->
<?php
if (!isset($_GET["submit"])) { ?>
<div class="text-center mt-3">
<div class="row justify-content-md-center mx auto btn-group">
<?php
for ($page = 1; $page <= $number_of_pages; $page++) {
echo '<a href="alumnisearch.php?page=' . $page . '"class="col page-nav-alumni page-nav-text">' . $page . '</a>';
}
?>
</div>
</div>
<?php } ?>
<!-- Pagination -->
</div>
</main>
<?php include_once("php/footer.php") ?>
</div>
<?php include_once("php/scripts.php") ?>
</body>
</html>