-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathjobs-activity.php
192 lines (180 loc) · 9.49 KB
/
jobs-activity.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
<?php
include_once("php/db_connect.php");
?>
<!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>
<link rel="stylesheet" href="css/job.css">
<title>Job Activity | FSKTM Alumni</title>
</head>
<body>
<div class="container-fluid p-0 m-0">
<?php
include_once("php/heading.php");
$alumni_id = $_SESSION["userid"];
?>
<main>
<div class="container mt-3">
<ul class="nav nav-tabs">
<li id="inactive" class="nav-item">
<a id="profileNav-inactive" class="nav-link" href="profile.php">Profile</a>
</li>
<li id="inactive" class="nav-item">
<a id="profileNav-inactive" class="nav-link" href="profile-settings.php">Settings & Privacy</a>
</li>
<li id="profileNav" class="nav-item">
<a id="profileNav-inactive" class="nav-link active" aria-current="page" href="jobs-activity.php">Job Activity</a>
</li>
<li id="profileNav" class="nav-item">
<a id="profileNav-inactive" class="nav-link" href="jobs-bookmark.php">Bookmarks</a>
</li>
</ul>
</div>
<?php
$result2 = mysqli_query($conn, "SELECT * FROM job WHERE ALUMNI_ID = $alumni_id");
$post_count = mysqli_num_rows($result2);
$result = mysqli_query($conn, "SELECT * FROM alumni WHERE ALUMNI_ID = $alumni_id");
while ($res = mysqli_fetch_array($result)) {
$username = $res['USERNAME'];
$alumni_img = $res['ALUMNI_IMG'];
}
?>
<div class="container" style="margin-top: 20px;">
<div class="main-body">
<div id="act-header" class="shadow-lg">
<div class="row">
<div class="col-md-auto">
<a href="profile.php">
<?php
echo '<img src="data:image/jpeg;base64,' . base64_encode($alumni_img) . '" alt="Admin" id="act-profileImg" class="shadow"></a>';
?>
</div>
<div class="col-md-8">
<h2 class="profile-name" style="margin-bottom: 0px; padding-top: 20px;" id="userName1"><?php echo $username ?></h2>
<p id="bio1" style="margin-top: 0px;">Software Engineering</p>
</div>
<div class="col-md">
<h2 id="act-count"><?php echo $post_count ?></h2>
<p id="act-uploads">Job Uploads</p>
</div>
</div>
</div>
<div id="act-main" class="card mb-3">
<div class="card-body">
<div class="row" id="act-addbox"><a href="jobs-add.php" style="text-decoration: none;">
<img src="img/add.png" id="act-addimg">
<h6 id="act-txtadd">
Add a new job vacancy
</h6>
</a>
</div>
<hr>
<div class="row">
<h2 id="act-txtheading">JOB ACTIVITY</h2>
</div>
<?php
$result = mysqli_query($conn, "SELECT * FROM job WHERE ALUMNI_ID = $alumni_id ORDER BY EDIT_DATE DESC");
while ($res = mysqli_fetch_array($result)) {
$job_id = $res['JOB_ID'];
$job_title = $res['JOB_TITLE'];
$cmp_logo = $res['CMP_LOGO'];
$cmp_name = $res['CMP_NAME'];
$job_salary_min = $res['JOB_SALARY_MIN'];
$job_salary_max = $res['JOB_SALARY_MAX'];
$post_date = $res['POST_DATE'];
$edit_date = $res['EDIT_DATE'];
$job_salary = "RM" . $job_salary_min . " - RM" . $job_salary_max;
$cmp_state = $res['CMP_STATE'];
$new_edit_date = date("j F Y", strtotime($edit_date));
echo '
<div id="div'.$job_id.'">
<div id="act-posted">';
if ($post_date != $edit_date) {
echo "Edited on $new_edit_date";
}
else{
echo "Posted on $new_edit_date";
}
echo '</div>
<div id="act-box" class="row">
<div class="col-md-4">
<a href="jobs-details.php?job_id=' . $job_id . '"><img src="img/' . $cmp_logo . '" class="act-image"></a>
<a href="jobs-details.php?job_id=' . $job_id . '" id="no-blue"><h6 id="act-jobname">
' . $job_title . '
</h6></a>
<h6 id="job-company">
' . $cmp_name . '
</h6>
</div>
<div class="col-md-3">
<h6 id="act-salary">
' . $job_salary . '
</h6>
</div>
<div class="col-md">
<h6 id="act-location">
' . $cmp_state . '
</h6>
</div>
<div class="col-md-auto">
<button type="button" id="act-button" class="btn" data-bs-toggle="modal" data-bs-target="#warning"><img id="search-img" src="img/delete.png"></button>
<a href="jobs-edit.php?job_id='.$job_id.'"><button type="button" id="act-button" class="btn"><img id="search-img" src="img/edit.png"></button></a>
</div>
</div>
<hr>
</div>
<div class="modal fade" id="warning" tabindex="-1" aria-labelledby="warning" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body" style="text-align: center; font-weight: bold">
You\'re about to delete this job advertisement. <br>Are you sure?
</div>
<div class="modal-footer">
<button type="button" class="btn confirmbuttonModalSetting" data-bs-dismiss="modal">Cancel</button>
<button type="button" onclick="deletePost('.$job_id.')" data-bs-dismiss="modal" class="btn confirmbuttonModalSetting">Delete Job</button>
</div>
</div>
</div>
</div>'
;
}
mysqli_close($conn);
?>
</div>
</div>
</div>
</main>
<script>
//delete job
function deletePost(job_id) {
var x = document.getElementById("div"+job_id);
if (x.style.display === "none") {
x.style.display = "block";
}
else {
x.style.display = "none";
}
const xhttp = new XMLHttpRequest();
xhttp.onload = function() {
document.getElementById("act-count").innerHTML = this.responseText;
}
xhttp.open("GET", "php/job-ajax.php?do=delP&job_id="+job_id+"&alumni_id="+<?php echo $alumni_id?>, true);
xhttp.send();
}
</script>
<?php include_once("php/footer.php") ?>
</div>
<?php include_once("php/scripts.php") ?>
</body>
</html>