-
Notifications
You must be signed in to change notification settings - Fork 1
/
admin-view-assignment.php
84 lines (68 loc) · 2.62 KB
/
admin-view-assignment.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
<?php
require "admin-header.php";
?>
<?php
if(isset($_GET['assignment_id'])){
$assignment_id = $_GET['assignment_id'];
}
if(isset($_POST['delete-assignment-btn'])){
$assignment_id = $_POST['assignment_id'];
$del_sql = "DELETE FROM assignment WHERE assignment_id=?";
$del_stmt = $conn->prepare($del_sql);
$del_stmt->bind_param('s', $assignment_id);
if($del_stmt->execute()){
echo "<script>location.href = 'delete-assignment.php';</script>";
}
}
$sql = "SELECT * FROM assignment WHERE assignment_id='$assignment_id'";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result = $stmt->get_result();
if($result->num_rows > 0){
$data = $result->fetch_assoc();
$staff_id = $data['staff_id'];
$sql1 = "SELECT * FROM staff WHERE unique_id='$staff_id'";
$stmt1 = $conn->prepare($sql1);
$stmt1->execute();
$staff_result = $stmt1->get_result();
if($staff_result->num_rows > 0){
$staff_data = $staff_result->fetch_assoc();
$lastname = $staff_data['lastname'];
$firstname = $staff_data['firstname'];
}
}
?>
<main id="main" class="main">
<div class="pagetitle">
<nav>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.html">Home</a></li>
<li class="breadcrumb-item">Manage Assignment</li>
</ol>
</nav>
</div><!-- End Page Title -->
<section class="section">
<div class="row">
<div class="col-lg-6">
<div class="card">
<div class="card-body mt-3">
<p>Course Name: <span class="text-success fw-bold"><?= $data['subject']; ?></span><br />
Staff Name: <span class="text-success fw-bold"><?= $lastname .' '. $firstname; ?></span><br />
Class: <span class="text-success fw-bold"><?= $data['class']; ?></span><br />
Date Uploaded: <span class="text-success fw-bold"><?= $data['date']; ?></span>
Deadline: <span class="text-success fw-bold"><?= $data['deadline']; ?></span>
</p>
<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="post">
<a href="admin-view-assignment.php?path=<?= $data['assignment']; ?>" class="btn btn-success form-control mt-3" style="border-radius: 15px;">Download</a>
<input type="hidden" name="assignment_id" value="<?= $assignment_id; ?>">
<button class="btn btn-danger mt-3 w-100" style="border-radius: 15px;" name="delete-assignment-btn">Delete Assignment</button>
</form>
</div>
</div>
</div>
</div>
</section>
</main><!-- End #main -->
<?php
require "main-footer.php";
?>