-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage_jadwal.php
130 lines (118 loc) · 6.05 KB
/
manage_jadwal.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
<?php
include './layout/navbar.php';
if (isset($_GET['error'])) {
echo $_GET['error'];
}
?>
<div class="container-xxl flex-grow-1 container-p-y">
<!-- Tambah Tugas Button -->
<div class="mb-4">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#tambahTugasModal">
Tambah Jadwal
</button>
</div>
<!-- /Tambah Tugas Button -->
<!-- Daftar Tugas -->
<div class="card mb-4">
<div class="card-header">
<h5 class="card-title">Daftar Jadwal</h5>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>ID</th>
<th>Kode Matkul</th>
<th>Nama Dosen</th>
<th>Waktu Kelas</th>
<th>Mata Kuliah</th>
<th>Prodi</th>
</tr>
</thead>
<tbody>
<?php
// Koneksi ke database
include './auth/koneksi.php';
// Query untuk mengambil data dari tabel tasks
$query = "SELECT * FROM jadwal";
$result = $koneksi->query($query);
// Loop untuk menampilkan data
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>{$row['id']}</td>";
echo "<td>{$row['kode_matkul']}</td>";
echo "<td>{$row['nama_dosen']}</td>";
echo "<td>{$row['waktu_kelas']}</td>";
echo "<td>{$row['mata_kuliah']}</td>";
echo "<td>{$row['prodi']}</td>";
// // Check if 'materi' key exists in the row array
// $materiLink = isset($row['tautan_materi']) ? "<a href='{$row['tautan_materi']}' target='_blank'>View</a>" : "Tidak Ada Materi";
// echo "<td>{$materiLink}</td>";
// echo "<td>{$row['detail_tugas']}</td>";
// echo "<td>";
// // Tambahkan hitung mundur dari deadline tugas
// $deadlineTimestamp = strtotime($row['deadline_tugas']);
// $currentTime = time();
// if ($currentTime < $deadlineTimestamp) {
// $timeDiff = $deadlineTimestamp - $currentTime;
// $days = floor($timeDiff / (60 * 60 * 24));
// $hours = floor(($timeDiff % (60 * 60 * 24)) / (60 * 60));
// $minutes = floor(($timeDiff % (60 * 60)) / 60);
// echo "{$days} hari, {$hours} jam, {$minutes} menit";
// } else {
// echo "Telah berakhir";
// }
echo "<td>";
echo "<a href='edit_jadwal.php?id={$row['id']}' class='btn btn-primary'>Edit</a> ";
echo "<a href='delete_jadwal.php?id={$row['id']}' class='btn btn-danger'>Hapus</a>";
echo "</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
<!-- /Daftar Jadwal -->
<!-- Modal Tambah Jadwal -->
<div class="modal fade" id="tambahJadwalModal" tabindex="-1" aria-labelledby="tambahJadwalModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="tambahJadwalModalLabel">Tambah Jadwal</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<!-- Formulir penambahan tugas -->
<form action="./add_jadwal.php" method="post" enctype="multipart/form-data">
<div class="mb-3">
<label for="kode_matkul" class="form-label">Kode Matkul</label>
<input type="text" class="form-control" id="kode_matkul" name="kode_matkul" required>
</div>
<div class="mb-3">
<label for="mata_kuliah" class="form-label">Nama Matkul</label>
<input type="text" class="form-control" id="mata_kuliah" name="mata_kuliah" required>
</div>
<div class="mb-3">
<label for="prodi" class="form-label">Prodi</label>
<input type="text" class="form-control" id="prodi" name="prodi" required>
</div>
<div class="mb-3">
<label for="nama_dosen" class="form-label">Nama Dosen</label>
<input type="text" class="form-control" id="nama_dosen" name="nama_dosen" required>
</div>
<div class="mb-3">
<label for="waktu_kelas" class="form-label">Waktu Kelas</label>
<input type="text" class="form-control" id="waktu_kelas" name="waktu_kelas" required>
</div>
<button type="submit" class="btn btn-primary">Tambah Jadwal</button>
</form>
</div>
</div>
</div>
</div>
<!-- /Modal Tambah Tugas -->
<!-- / Content -->
<?php include './layout/footer.php'; ?>