fix: ✅ Upload Sertif, tampil sertifikat, cek_sertifikat siswa dan operator
Upload Sertif login sebagai sisw, fix bug tampil sertifikat sebagai oprator dan siswa, cek_sertifikat login sebagai siswa bisa upload ulang file jika statusnya tidak valid
This commit is contained in:
parent
d16e94d65f
commit
b972fee6c4
0
.stfolder/syncthing-folder-a9cd4c.txt
Normal file → Executable file
0
.stfolder/syncthing-folder-a9cd4c.txt
Normal file → Executable file
0
koneksi.php
Normal file → Executable file
0
koneksi.php
Normal file → Executable file
@ -51,6 +51,14 @@ if(isset($_POST['tombol_login'])){
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<center>
|
||||||
|
<h1>Level_User Operator : </h1>
|
||||||
|
<h4> username = yenny</h4>
|
||||||
|
<h4> password = admin12345</h4>
|
||||||
|
<h1> Level_User Siswa :<h1>
|
||||||
|
<h4> username = 7024</h4>
|
||||||
|
<h4> password = siswa7024</h4>
|
||||||
|
</center>
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<table align="center" cellpadding="10">
|
<table align="center" cellpadding="10">
|
||||||
<tr>
|
<tr>
|
||||||
|
BIN
sertifikat/70244h6rs.pdf
Executable file
BIN
sertifikat/70244h6rs.pdf
Executable file
Binary file not shown.
BIN
sertifikat/7024bquks.pdf
Executable file
BIN
sertifikat/7024bquks.pdf
Executable file
Binary file not shown.
BIN
sertifikat/7024c9y1k.pdf
Executable file
BIN
sertifikat/7024c9y1k.pdf
Executable file
Binary file not shown.
BIN
sertifikat/7024d9e7r.pdf
Normal file
BIN
sertifikat/7024d9e7r.pdf
Normal file
Binary file not shown.
BIN
sertifikat/7024e2kq3.pdf
Executable file
BIN
sertifikat/7024e2kq3.pdf
Executable file
Binary file not shown.
BIN
sertifikat/7024lk8u3.pdf
Executable file
BIN
sertifikat/7024lk8u3.pdf
Executable file
Binary file not shown.
BIN
sertifikat/7024wi7jh.pdf
Executable file
BIN
sertifikat/7024wi7jh.pdf
Executable file
Binary file not shown.
BIN
sertifikat/7024ymd93.pdf
Normal file
BIN
sertifikat/7024ymd93.pdf
Normal file
Binary file not shown.
0
sertifikat/sertif1.pdf
Normal file → Executable file
0
sertifikat/sertif1.pdf
Normal file → Executable file
0
sertifikat/sertif10.pdf
Normal file → Executable file
0
sertifikat/sertif10.pdf
Normal file → Executable file
0
sertifikat/sertif2.pdf
Normal file → Executable file
0
sertifikat/sertif2.pdf
Normal file → Executable file
0
sertifikat/sertif3.pdf
Normal file → Executable file
0
sertifikat/sertif3.pdf
Normal file → Executable file
0
sertifikat/sertif4.pdf
Normal file → Executable file
0
sertifikat/sertif4.pdf
Normal file → Executable file
0
sertifikat/sertif5.pdf
Normal file → Executable file
0
sertifikat/sertif5.pdf
Normal file → Executable file
0
sertifikat/sertif6.pdf
Normal file → Executable file
0
sertifikat/sertif6.pdf
Normal file → Executable file
0
sertifikat/sertif7.pdf
Normal file → Executable file
0
sertifikat/sertif7.pdf
Normal file → Executable file
0
sertifikat/sertif8.pdf
Normal file → Executable file
0
sertifikat/sertif8.pdf
Normal file → Executable file
0
sertifikat/sertif9.pdf
Normal file → Executable file
0
sertifikat/sertif9.pdf
Normal file → Executable file
BIN
sertifikat/vjtpz.pdf
Executable file
BIN
sertifikat/vjtpz.pdf
Executable file
Binary file not shown.
0
tambah/tambah_jurusan.php
Normal file → Executable file
0
tambah/tambah_jurusan.php
Normal file → Executable file
0
tambah/tambah_kategori_kegiatan.php
Normal file → Executable file
0
tambah/tambah_kategori_kegiatan.php
Normal file → Executable file
0
tambah/tambah_pegawai.php
Normal file → Executable file
0
tambah/tambah_pegawai.php
Normal file → Executable file
0
tambah/tambah_siswa.php
Normal file → Executable file
0
tambah/tambah_siswa.php
Normal file → Executable file
174
tambah/upload_sertifikat.php
Executable file
174
tambah/upload_sertifikat.php
Executable file
@ -0,0 +1,174 @@
|
|||||||
|
<?php
|
||||||
|
if(!@$_COOKIE['level_user']) {
|
||||||
|
echo "<script>alert('belum login');window.location.href='../login.php'</script>";
|
||||||
|
}elseif($_COOKIE['level_user']=='operator') {
|
||||||
|
echo "<script>alert('anda operator, silahkan kembali');window.location.href='halaman_utama.php?page=sertifikat'</script>";
|
||||||
|
}
|
||||||
|
$nis = $_COOKIE['nis'];
|
||||||
|
|
||||||
|
if(isset($_POST['tombol_upload']) && isset($_FILES["sertifikat"])){
|
||||||
|
$tgl_Upload = date("Y-m-d");
|
||||||
|
$sertifikat = $_FILES["sertifikat"]['name'];
|
||||||
|
$kegiatan = htmlspecialchars($_POST['jenis_kegiatan']);
|
||||||
|
$id_kegiatan = mysqli_fetch_assoc(mysqli_query($koneksi, "SELECT Id_Kegiatan FROM kegiatan WHERE Jenis_Kegiatan = '$kegiatan'"))['Id_Kegiatan'];
|
||||||
|
$file = $_FILES["sertifikat"];
|
||||||
|
$folder = "../sertifikat/";
|
||||||
|
$ekstensi = strtolower(pathinfo($_FILES["sertifikat"]['name'], PATHINFO_EXTENSION));
|
||||||
|
$ukuran = $file["size"];
|
||||||
|
|
||||||
|
|
||||||
|
// Validasi file atau cek file
|
||||||
|
if ($ekstensi !== "pdf") {
|
||||||
|
echo "Hanya file .pdf yang diperbolehkan!";
|
||||||
|
} elseif ($ukuran > 2097152) { // 2MB dalam byte
|
||||||
|
echo "Ukuran file terlalu besar! Maksimal 2MB.";
|
||||||
|
} else {
|
||||||
|
// Generate nama file baru dengan format NIS + 5 random karakter
|
||||||
|
do {
|
||||||
|
$randomString = substr(str_shuffle("abcdefghijklmnopqrstuvwxyz0123456789"), 0, 5);
|
||||||
|
$newFileName = $nis . $randomString . ".pdf";
|
||||||
|
$targetFile = $folder . $newFileName;
|
||||||
|
} while (file_exists($targetFile)); // Cek apakah file sudah ada, jika ada buat ulang
|
||||||
|
|
||||||
|
// Proses upload
|
||||||
|
if (move_uploaded_file($file["tmp_name"], $targetFile)) {
|
||||||
|
$hasil = mysqli_query($koneksi, "INSERT INTO sertifikat VALUES(NULL, '$tgl_Upload', NULL, '$newFileName', 'Menunggu Validasi', NULL, '$nis', '$id_kegiatan')");
|
||||||
|
|
||||||
|
$id = mysqli_fetch_row(mysqli_query($koneksi, "SELECT LAST_INSERT_ID()"))[0];
|
||||||
|
|
||||||
|
if ($hasil) {
|
||||||
|
echo "<script>alert('Berhasil Mengunggah Sertifikat');window.location.href='halaman_utama.php?page=cek_sertifikat_siswa&id=".$id."&file=".$newFileName."'
|
||||||
|
</script>";
|
||||||
|
} else {
|
||||||
|
echo "Gagal Mengunggah File: " . mysqli_error($koneksi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<center>
|
||||||
|
<select name="kategori" onchange="pilihKategori(this.options[this.selectedIndex].value)">
|
||||||
|
<option value="">Pilih Kategori</option>
|
||||||
|
<?php
|
||||||
|
$list_kategori = mysqli_query($koneksi, "SELECT Kategori FROM kategori GROUP BY Kategori");
|
||||||
|
while($data_kategori = mysqli_fetch_assoc($list_kategori)){
|
||||||
|
?>
|
||||||
|
<option value="<?=$data_kategori['Kategori']?>"
|
||||||
|
<?php if(@$_GET['kategori']==$data_kategori['Kategori']){ echo "selected";}?>>
|
||||||
|
<?=$data_kategori['Kategori']?>
|
||||||
|
</option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<script>
|
||||||
|
function pilihKategori(value) {
|
||||||
|
window.location.href = 'halaman_utama.php?page=upload_sertifikat&kategori=' + value;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if(@$_GET['kategori']){
|
||||||
|
$kategori = htmlspecialchars($_GET['kategori']);
|
||||||
|
?>
|
||||||
|
<select name="sub_kategori" onchange="pilihSubKategori(this.options[this.selectedIndex].value)">
|
||||||
|
<option value="">Pilih Sub Kategori</option>
|
||||||
|
<?php
|
||||||
|
$list_kategori = mysqli_query($koneksi, "SELECT Sub_Kategori FROM kategori WHERE Kategori='$kategori'");
|
||||||
|
while($sub_kategori = mysqli_fetch_assoc($list_kategori)){
|
||||||
|
?>
|
||||||
|
<option value="<?=$sub_kategori['Sub_Kategori']?>"
|
||||||
|
<?php if(@$_GET['sub_kategori']==$sub_kategori['Sub_Kategori']){ echo "selected";}?>>
|
||||||
|
<?=$sub_kategori['Sub_Kategori']?>
|
||||||
|
</option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<script>
|
||||||
|
function pilihSubKategori(value) {
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const kategori = urlParams.get('kategori');
|
||||||
|
window.location.href =
|
||||||
|
`halaman_utama.php?page=upload_sertifikat&kategori=${kategori}&sub_kategori=${value}`;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if(@$_GET['sub_kategori']){
|
||||||
|
$kategori = htmlspecialchars($_GET['kategori']);
|
||||||
|
$sub_kategori = htmlspecialchars($_GET['sub_kategori']);
|
||||||
|
@$Id_Kategori = mysqli_fetch_assoc(mysqli_query($koneksi, "SELECT Id_Kategori FROM kategori WHERE Sub_Kategori = '$sub_kategori'"))['Id_Kategori'];
|
||||||
|
?>
|
||||||
|
<select name="jenis_kegiatan" onchange="pilihJenisKegiatan(this.value)" required>
|
||||||
|
<option value="">Pilih Jenis Kegiatan</option>
|
||||||
|
<?php
|
||||||
|
// Ambil daftar kegiatan berdasarkan kategori
|
||||||
|
$list_kategori = mysqli_query($koneksi, "SELECT Jenis_Kegiatan FROM kegiatan WHERE Id_Kategori='$Id_Kategori'");
|
||||||
|
|
||||||
|
// Ambil daftar kegiatan yang sudah diikuti oleh siswa (untuk disable option)
|
||||||
|
$list_kegiatan = mysqli_query($koneksi, "SELECT Jenis_Kegiatan FROM kegiatan INNER JOIN sertifikat USING(Id_Kegiatan) INNER JOIN kategori USING(Id_Kategori) WHERE NIS='$nis' AND Kategori='wajib' GROUP BY Jenis_Kegiatan");
|
||||||
|
|
||||||
|
// Buat array untuk menyimpan kegiatan yang sudah diikuti
|
||||||
|
$kegiatan_terdaftar = [];
|
||||||
|
while ($row = mysqli_fetch_assoc($list_kegiatan)) {
|
||||||
|
$kegiatan_terdaftar[] = $row['Jenis_Kegiatan'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop daftar kegiatan dan tampilkan dalam <option>
|
||||||
|
while ($jenis_kegiatan = mysqli_fetch_assoc($list_kategori)) {
|
||||||
|
$nama_kegiatan = $jenis_kegiatan['Jenis_Kegiatan'];
|
||||||
|
$isDisabled = in_array($nama_kegiatan, $kegiatan_terdaftar) ? "disabled" : "";
|
||||||
|
$isSelected = (isset($_GET['jenis_kegiatan']) && $_GET['jenis_kegiatan'] === $nama_kegiatan) ? "selected" : "";
|
||||||
|
?>
|
||||||
|
<option value="<?= htmlspecialchars($nama_kegiatan) ?>" <?= $isDisabled ?> <?= $isSelected ?>>
|
||||||
|
<?= htmlspecialchars($nama_kegiatan) ?>
|
||||||
|
</option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<script>
|
||||||
|
function pilihJenisKegiatan(value) {
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const kategori = urlParams.get('kategori');
|
||||||
|
const sub_kategori = urlParams.get('sub_kategori');
|
||||||
|
window.location.href =
|
||||||
|
`halaman_utama.php?page=upload_sertifikat&kategori=${kategori}&sub_kategori=${sub_kategori}&jenis_kegiatan=${value}`;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if(@$_GET['jenis_kegiatan']){
|
||||||
|
$kategori = htmlspecialchars($_GET['kategori']);
|
||||||
|
$sub_kategori = htmlspecialchars($_GET['sub_kategori']);
|
||||||
|
$jenis_kegiatan = htmlspecialchars($_GET['jenis_kegiatan']);
|
||||||
|
?>
|
||||||
|
<form action="" method="post" enctype="multipart/form-data">
|
||||||
|
<input type="text" hidden name="jenis_kegiatan" value="<?=$jenis_kegiatan?>">
|
||||||
|
<input type="file" accept=".pdf" name="sertifikat" required>
|
||||||
|
|
||||||
|
|
||||||
|
<input type="submit" name="tombol_upload" value="Upload">
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
</center>
|
39
tampilan/cek_sertifikat.php
Normal file → Executable file
39
tampilan/cek_sertifikat.php
Normal file → Executable file
@ -1,24 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
if(!@$_COOKIE['level_user']) {
|
||||||
|
echo "<script>alert('belum login');window.location.href='../login.php'</script>";
|
||||||
|
}elseif($_COOKIE['level_user']=='siswa') {
|
||||||
|
echo "<script>alert('anda siswa, silahkan kembali');window.location.href='halaman_utama.php?page=sertifikat_siswa'</script>";
|
||||||
|
}
|
||||||
// Mengambil parameter dari URL
|
// Mengambil parameter dari URL
|
||||||
$pdfFile = isset($_GET['file']) ? $_GET['file'] : '';
|
if(isset($_GET['file'])){
|
||||||
$id = isset($_GET['id']) ? $_GET['id'] : '';
|
$pdfFile = $_GET['file'];
|
||||||
|
}else{
|
||||||
// Validasi input
|
$pdfFile = '';
|
||||||
if (!$pdfFile) {
|
}
|
||||||
die("File PDF tidak ditemukan! Tambahkan parameter ?file=namafile.pdf di URL.");
|
if(isset($_GET['id'])){
|
||||||
|
$id = $_GET['id'];
|
||||||
|
}else{
|
||||||
|
$id = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ambil data siswa dan sertifikat
|
// Validasi input
|
||||||
$query = "SELECT Nama_Siswa, NIS, Jurusan, Kelas, No_Telp, Email, Angkatan, Kategori, Sub_Kategori, Jenis_Kegiatan, Status, Catatan
|
if (!$pdfFile){
|
||||||
FROM sertifikat
|
echo "File PDF tidak ditemukan!";
|
||||||
INNER JOIN kegiatan USING(Id_Kegiatan)
|
exit;
|
||||||
INNER JOIN kategori USING(Id_Kategori)
|
}
|
||||||
INNER JOIN siswa USING(NIS)
|
|
||||||
INNER JOIN jurusan USING(Id_Jurusan)
|
|
||||||
WHERE Id_Sertifikat = '$id'";
|
|
||||||
|
|
||||||
$result = mysqli_query($koneksi, $query);
|
// Ambil data siswa dan sertifikat
|
||||||
$data = mysqli_fetch_assoc($result);
|
$data = mysqli_fetch_assoc(mysqli_query($koneksi,"SELECT Nama_Siswa, NIS, Jurusan, Kelas, No_Telp, Email, Angkatan, Kategori, Sub_Kategori, Jenis_Kegiatan, Status, Catatan FROM sertifikat INNER JOIN kegiatan USING(Id_Kegiatan) INNER JOIN kategori USING(Id_Kategori) INNER JOIN siswa USING(NIS) INNER JOIN jurusan USING(Id_Jurusan) WHERE Id_Sertifikat = '$id'"));
|
||||||
|
|
||||||
$tgl = date("Y-m-d");
|
$tgl = date("Y-m-d");
|
||||||
|
|
||||||
@ -95,7 +100,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['tombol_submit'])) {
|
|||||||
<button id="btn-batal" type="button" style="display: none;" onclick="cancelInvalid()">Batal</button>
|
<button id="btn-batal" type="button" style="display: none;" onclick="cancelInvalid()">Batal</button>
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
<input type="hidden" name="status" value="Valid">
|
<input type="hidden" name="status" value="Valid">
|
||||||
<button type="submit" id="btn-valid" style="float:right;">✅ Valid</button>
|
<button type="submit" id="btn-valid" style="float:right;" name="tombol_submit">✅ Valid</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
|
148
tampilan/cek_sertifikat_siswa.php
Executable file
148
tampilan/cek_sertifikat_siswa.php
Executable file
@ -0,0 +1,148 @@
|
|||||||
|
<?php
|
||||||
|
if(!@$_COOKIE['level_user']) {
|
||||||
|
echo "<script>alert('belum login');window.location.href='../login.php'</script>";
|
||||||
|
}elseif($_COOKIE['level_user']=='operator') {
|
||||||
|
echo "<script>alert('anda operator, silahkan kembali');window.location.href='halaman_utama.php?page=sertifikat'</script>";
|
||||||
|
}
|
||||||
|
// Mengambil parameter dari URL
|
||||||
|
if(isset($_GET['file'])){
|
||||||
|
$pdfFile = $_GET['file'];
|
||||||
|
}else{
|
||||||
|
$pdfFile = '';
|
||||||
|
}
|
||||||
|
if(isset($_GET['id'])){
|
||||||
|
$id = $_GET['id'];
|
||||||
|
}else{
|
||||||
|
$id = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validasi input
|
||||||
|
if (!$pdfFile) {
|
||||||
|
echo "File PDF tidak ditemukan!";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil data siswa dan sertifikat
|
||||||
|
$data = mysqli_fetch_assoc(mysqli_query($koneksi,"SELECT Kategori, Sub_Kategori, Jenis_Kegiatan, Status, Catatan, Sertifikat FROM sertifikat INNER JOIN kegiatan USING(Id_Kegiatan) INNER JOIN kategori USING(Id_Kategori) WHERE Id_Sertifikat = '$id'"));
|
||||||
|
|
||||||
|
if(isset($_POST['tombol_upload']) && isset($_FILES["sertifikat"])){
|
||||||
|
$tgl = date("Y-m-d");
|
||||||
|
$sertifikat = $_FILES["sertifikat"]['name'];
|
||||||
|
$file = $_FILES["sertifikat"];
|
||||||
|
$folder = "../sertifikat/";
|
||||||
|
$ekstensi = strtolower(pathinfo($_FILES["sertifikat"]['name'], PATHINFO_EXTENSION));
|
||||||
|
$ukuran = $file["size"];
|
||||||
|
$nis = $_COOKIE['nis'];
|
||||||
|
|
||||||
|
// Validasi file atau cek file
|
||||||
|
if($ekstensi !== "pdf"){
|
||||||
|
echo "Hanya file .pdf yang diperbolehkan!";
|
||||||
|
}elseif($ukuran > 2097152){ // 2MB dalam byte
|
||||||
|
echo "Ukuran file terlalu besar! Maksimal 2MB.";
|
||||||
|
}else{
|
||||||
|
// Generate nama file baru dengan format NIS + 5 random karakter
|
||||||
|
do {
|
||||||
|
$randomString = substr(str_shuffle("abcdefghijklmnopqrstuvwxyz0123456789"), 0, 5);
|
||||||
|
$newFileName = $nis . $randomString . ".pdf";
|
||||||
|
$targetFile = $folder . $newFileName;
|
||||||
|
} while (file_exists($targetFile)); // Cek apakah file sudah ada, jika ada buat ulang
|
||||||
|
|
||||||
|
// Hapus file lama jika ada
|
||||||
|
$file_path = "../sertifikat/" . $data['Sertifikat'];
|
||||||
|
if (!empty($data['Sertifikat']) && file_exists($file_path)) {
|
||||||
|
unlink($file_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upload file dengan nama baru
|
||||||
|
if (move_uploaded_file($file["tmp_name"], $targetFile)) {
|
||||||
|
// Update database dengan nama file baru
|
||||||
|
$update = mysqli_query($koneksi, "UPDATE sertifikat
|
||||||
|
SET Sertifikat='$newFileName', Status='Menunggu Validasi', Tanggal_Status_Berubah='$tgl'
|
||||||
|
WHERE Id_Sertifikat='$id'");
|
||||||
|
|
||||||
|
if ($update) {
|
||||||
|
echo "<script>alert('Berhasil Mengunggah Ulang Sertifikat');window.location.href='halaman_utama.php?page=cek_sertifikat_siswa&id=".$id."&file=".$newFileName."'</script>";
|
||||||
|
} else {
|
||||||
|
echo "Gagal mengupdate database: " . mysqli_error($koneksi);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "Gagal mengunggah file.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pdf-container {
|
||||||
|
flex: 4;
|
||||||
|
border-right: 2px solid #ddd;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pdf-container embed {
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.siswa-container {
|
||||||
|
flex: 1;
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="pdf-container">
|
||||||
|
<embed src="../sertifikat/<?= htmlspecialchars($pdfFile) ?>" type="application/pdf">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="siswa-container">
|
||||||
|
<h3 style="color:#e5bb11"><?=$data["Status"]?></h3>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<h3>Kategori Kegiatan</h3><br>
|
||||||
|
<p><strong>Kategori:</strong> <?= $data["Kategori"] ?></p>
|
||||||
|
<p><strong>Sub Kategori:</strong> <?= $data["Sub_Kategori"] ?></p>
|
||||||
|
<p><strong>Kegiatan:</strong> <?= $data["Jenis_Kegiatan"] ?></p><br><br>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php if ($data["Status"] == "Tidak Valid"){ ?>
|
||||||
|
<div id="catatan-container">
|
||||||
|
<h3>Catatan</h3>
|
||||||
|
<textarea readonly name=" catatan" style="height: 150px"><?= $data["Catatan"] ?></textarea>
|
||||||
|
</div>
|
||||||
|
<form action="" method="POST" enctype="multipart/form-data">
|
||||||
|
<input type="file" accept=".pdf" name="sertifikat" autofocus required><br><br>
|
||||||
|
<input type="submit" name="tombol_upload" value="Upload Ulang">
|
||||||
|
</form>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function toggleInvalid() {
|
||||||
|
document.getElementById('btn-tidak-valid').style.display = 'none';
|
||||||
|
document.getElementById('btn-valid').style.display = 'none';
|
||||||
|
document.getElementById('btn-batal').style.display = 'inline-block';
|
||||||
|
document.getElementById('btn-submit').style.display = 'inline-block';
|
||||||
|
document.getElementById('catatan-container').style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelInvalid() {
|
||||||
|
document.getElementById('btn-tidak-valid').style.display = 'inline-block';
|
||||||
|
document.getElementById('btn-valid').style.display = 'inline-block';
|
||||||
|
document.getElementById('btn-batal').style.display = 'none';
|
||||||
|
document.getElementById('btn-submit').style.display = 'none';
|
||||||
|
document.getElementById('catatan-container').style.display = 'none';
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
14
tampilan/halaman_utama.php
Normal file → Executable file
14
tampilan/halaman_utama.php
Normal file → Executable file
@ -104,7 +104,7 @@ include "../koneksi.php";
|
|||||||
<?php
|
<?php
|
||||||
} elseif ($_COOKIE['level_user'] == 'siswa') {
|
} elseif ($_COOKIE['level_user'] == 'siswa') {
|
||||||
?>
|
?>
|
||||||
<li><a href="halaman_utama.php?page=upload_sertifikat">Sertifikat</a></li>
|
<li><a href="halaman_utama.php?page=sertifikat_siswa">Sertifikat</a></li>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -172,13 +172,19 @@ include "../koneksi.php";
|
|||||||
break;
|
break;
|
||||||
case "upload_sertifikat":
|
case "upload_sertifikat":
|
||||||
include "../tambah/upload_sertifikat.php";
|
include "../tambah/upload_sertifikat.php";
|
||||||
break;
|
break;
|
||||||
|
case "sertifikat_siswa":
|
||||||
|
include "sertifikat_siswa.php";
|
||||||
|
break;
|
||||||
case "sertifikat":
|
case "sertifikat":
|
||||||
include "sertifikat.php";
|
include "sertifikat.php";
|
||||||
break;
|
break;
|
||||||
case "cek_sertifikat":
|
case "cek_sertifikat":
|
||||||
include "cek_sertifikat.php";
|
include "cek_sertifikat.php";
|
||||||
break;
|
break;
|
||||||
|
case "cek_sertifikat_siswa":
|
||||||
|
include "cek_sertifikat_siswa.php";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
0
tampilan/jurusan.php
Normal file → Executable file
0
tampilan/jurusan.php
Normal file → Executable file
0
tampilan/kategori_kegiatan.php
Normal file → Executable file
0
tampilan/kategori_kegiatan.php
Normal file → Executable file
9
tampilan/sertifikat.php
Normal file → Executable file
9
tampilan/sertifikat.php
Normal file → Executable file
@ -1,4 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
if(!@$_COOKIE['level_user']) {
|
||||||
|
echo "<script>alert('belum login');window.location.href='../login.php'</script>";
|
||||||
|
}elseif($_COOKIE['level_user']=='siswa') {
|
||||||
|
echo "<script>alert('anda siswa, silahkan kembali');window.location.href='halaman_utama.php?page=sertifikat_siswa'</script>";
|
||||||
|
}
|
||||||
// Fungsi untuk mendapatkan data sertifikat berdasarkan status dan kegiatan
|
// Fungsi untuk mendapatkan data sertifikat berdasarkan status dan kegiatan
|
||||||
function getSertifikat($koneksi, $status = '', $kegiatan = '') {
|
function getSertifikat($koneksi, $status = '', $kegiatan = '') {
|
||||||
$whereClause = "WHERE 1"; // Default kondisi WHERE
|
$whereClause = "WHERE 1"; // Default kondisi WHERE
|
||||||
@ -14,13 +19,14 @@ function getSertifikat($koneksi, $status = '', $kegiatan = '') {
|
|||||||
INNER JOIN kegiatan USING(Id_Kegiatan)
|
INNER JOIN kegiatan USING(Id_Kegiatan)
|
||||||
INNER JOIN kategori USING(Id_Kategori)
|
INNER JOIN kategori USING(Id_Kategori)
|
||||||
INNER JOIN siswa USING(NIS)
|
INNER JOIN siswa USING(NIS)
|
||||||
$whereClause ORDER BY Sub_Kategori, Tanggal_Upload ASC";
|
$whereClause ORDER BY Status, Sub_Kategori, Tanggal_Upload ASC";
|
||||||
|
|
||||||
$result = mysqli_query($koneksi, $query);
|
$result = mysqli_query($koneksi, $query);
|
||||||
|
|
||||||
if (mysqli_num_rows($result) > 0) {
|
if (mysqli_num_rows($result) > 0) {
|
||||||
echo "<center><table border='1' cellpadding='5' cellspacing='0'>";
|
echo "<center><table border='1' cellpadding='5' cellspacing='0'>";
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
|
<th>NIS</th>
|
||||||
<th>Kategori</th>
|
<th>Kategori</th>
|
||||||
<th>Sub Kategori</th>
|
<th>Sub Kategori</th>
|
||||||
<th>Jenis Kegiatan</th>
|
<th>Jenis Kegiatan</th>
|
||||||
@ -32,6 +38,7 @@ function getSertifikat($koneksi, $status = '', $kegiatan = '') {
|
|||||||
|
|
||||||
while ($data = mysqli_fetch_assoc($result)) {
|
while ($data = mysqli_fetch_assoc($result)) {
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
|
<td>{$data['NIS']}</td>
|
||||||
<td>{$data['Kategori']}</td>
|
<td>{$data['Kategori']}</td>
|
||||||
<td>{$data['Sub_Kategori']}</td>
|
<td>{$data['Sub_Kategori']}</td>
|
||||||
<td>{$data['Jenis_Kegiatan']}</td>
|
<td>{$data['Jenis_Kegiatan']}</td>
|
||||||
|
91
tampilan/sertifikat_siswa.php
Executable file
91
tampilan/sertifikat_siswa.php
Executable file
@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
if(!@$_COOKIE['level_user']) {
|
||||||
|
echo "<script>alert('belum login');window.location.href='../login.php'</script>";
|
||||||
|
}elseif($_COOKIE['level_user']=='operator') {
|
||||||
|
echo "<script>alert('anda operator, silahkan kembali');window.location.href='halaman_utama.php?page=sertifikat'</script>";
|
||||||
|
}
|
||||||
|
// Fungsi untuk mendapatkan data sertifikat berdasarkan status dan kegiatan
|
||||||
|
function getSertifikat($koneksi, $status = '', $kegiatan = '') {
|
||||||
|
$whereClause = "WHERE 1"; // Default kondisi WHERE
|
||||||
|
|
||||||
|
if (!empty($status)) {
|
||||||
|
$whereClause .= " AND Status='" . mysqli_real_escape_string($koneksi, $status) . "'";
|
||||||
|
}
|
||||||
|
if (!empty($kegiatan)) {
|
||||||
|
$whereClause .= " AND Jenis_Kegiatan LIKE '%" . mysqli_real_escape_string($koneksi, $kegiatan) . "%'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$nis = $_COOKIE['nis'];
|
||||||
|
$query = "SELECT * FROM sertifikat
|
||||||
|
INNER JOIN kegiatan USING(Id_Kegiatan)
|
||||||
|
INNER JOIN kategori USING(Id_Kategori)
|
||||||
|
INNER JOIN siswa USING(NIS)
|
||||||
|
$whereClause AND NIS='$nis' ORDER BY Status, Sub_Kategori, Tanggal_Upload ASC";
|
||||||
|
|
||||||
|
$result = mysqli_query($koneksi, $query);
|
||||||
|
|
||||||
|
if (mysqli_num_rows($result) > 0) {
|
||||||
|
echo "<center><table border='1' cellpadding='5' cellspacing='0'>";
|
||||||
|
echo "<tr>
|
||||||
|
<th>Kategori</th>
|
||||||
|
<th>Sub Kategori</th>
|
||||||
|
<th>Jenis Kegiatan</th>
|
||||||
|
<th>Nama Siswa</th>
|
||||||
|
<th>Angkatan</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Lihat Sertifikat</th>
|
||||||
|
</tr>";
|
||||||
|
|
||||||
|
while ($data = mysqli_fetch_assoc($result)) {
|
||||||
|
echo "<tr>
|
||||||
|
<td>{$data['Kategori']}</td>
|
||||||
|
<td>{$data['Sub_Kategori']}</td>
|
||||||
|
<td>{$data['Jenis_Kegiatan']}</td>
|
||||||
|
<td>{$data['Nama_Siswa']}</td>
|
||||||
|
<td>{$data['Angkatan']}</td>
|
||||||
|
<td>{$data['Status']}</td>
|
||||||
|
<td><a href='halaman_utama.php?page=cek_sertifikat_siswa&id={$data['Id_Sertifikat']}&file={$data['Sertifikat']}' target='_blank'>Lihat File</a></td>
|
||||||
|
</tr>";
|
||||||
|
}
|
||||||
|
echo "</table></center>";
|
||||||
|
} else {
|
||||||
|
echo "<p>Tidak ada data</p>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<center>
|
||||||
|
<button onclick="window.location.href='halaman_utama.php?page=upload_sertifikat';">+ Upload
|
||||||
|
Sertifikat</button> <br><br>
|
||||||
|
<form method="POST" action="">
|
||||||
|
<label for="status">Pilih Status:</label>
|
||||||
|
<select name="status">
|
||||||
|
<option value="">Semua</option>
|
||||||
|
<option value="Menunggu Validasi">Menunggu Validasi</option>
|
||||||
|
<option value="Tidak Valid">Tidak Valid</option>
|
||||||
|
<option value="Valid">Sudah Tervalidasi</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label for="kegiatan">Pilih Kegiatan:</label>
|
||||||
|
<select name="kegiatan">
|
||||||
|
<option value="">Semua</option>
|
||||||
|
<?php
|
||||||
|
$list_kegiatan = mysqli_query($koneksi, "SELECT DISTINCT Jenis_Kegiatan FROM kegiatan");
|
||||||
|
while ($data_kegiatan = mysqli_fetch_assoc($list_kegiatan)) {
|
||||||
|
echo "<option value='{$data_kegiatan['Jenis_Kegiatan']}'>{$data_kegiatan['Jenis_Kegiatan']}</option>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<input type="submit" value="Cari">
|
||||||
|
</form>
|
||||||
|
</center>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Ambil nilai filter dari form
|
||||||
|
$status = isset($_POST['status']) ? $_POST['status'] : '';
|
||||||
|
$kegiatan = isset($_POST['kegiatan']) ? $_POST['kegiatan'] : '';
|
||||||
|
|
||||||
|
// Tampilkan hasil pencarian
|
||||||
|
getSertifikat($koneksi, $status, $kegiatan);
|
||||||
|
?>
|
0
tampilan/siswa.php
Normal file → Executable file
0
tampilan/siswa.php
Normal file → Executable file
0
ubah/ubah_jurusan.php
Normal file → Executable file
0
ubah/ubah_jurusan.php
Normal file → Executable file
0
ubah/ubah_kategori_kegiatan.php
Normal file → Executable file
0
ubah/ubah_kategori_kegiatan.php
Normal file → Executable file
0
ubah/ubah_pegawai.php
Normal file → Executable file
0
ubah/ubah_pegawai.php
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user