Add the main admin, dosen, mahasiswa, API, and service code needed to run the core legacy application with configurable upload storage.
56 lines
1.8 KiB
PHP
56 lines
1.8 KiB
PHP
<?php
|
|
|
|
session_start();
|
|
if ($_POST) {
|
|
include '../../../inc/helper.php';
|
|
include '../../../inc/konfigurasi.php';
|
|
include '../../../inc/db.pdo.class.php';
|
|
|
|
$db = new dB($dbsetting);
|
|
|
|
switch ($_POST['act']) {
|
|
case 'insert':
|
|
$insert = "INSERT INTO tb_kelompok_keahlian SET
|
|
namaKK='".$_POST['namaKK']."',
|
|
ketuaKK='".$_POST['ketuaKK']."',
|
|
sekretarisKK='".$_POST['sekretarisKK']."'
|
|
";
|
|
//echo $insert;
|
|
if ($db->runQuery($insert)) {
|
|
echo json_encode(['result' => true, 'msg' => 'Data Kelompok Keahlian baru berhasil ditambahkan.']);
|
|
} else {
|
|
echo json_encode(['result' => false, 'msg' => 'Aksi Gagal DBERROR.']);
|
|
}
|
|
break;
|
|
|
|
case 'update':
|
|
$id = $_POST['idKK'];
|
|
if (ctype_digit($id)) {
|
|
$update = "UPDATE tb_kelompok_keahlian SET
|
|
namaKK='".$_POST['namaKK']."',
|
|
ketuaKK='".$_POST['ketuaKK']."',
|
|
sekretarisKK='".$_POST['sekretarisKK']."'
|
|
WHERE idKK='$id'";
|
|
//echo $update;
|
|
if ($db->runQuery($update)) {
|
|
echo json_encode(['result' => true, 'msg' => 'Data Kelompok Keahlian telah diupdate.']);
|
|
} else {
|
|
echo json_encode(['result' => false, 'msg' => 'Aksi update Gagal DBERROR.']);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 'hapuskk':
|
|
$id = $_POST['idKK'];
|
|
if (ctype_digit($id)) {
|
|
$hapus = "DELETE FROM tb_kelompok_keahlian WHERE idKK='$id'";
|
|
if ($db->runQuery($hapus)) {
|
|
echo json_encode(['result' => true, 'msg' => 'Data Kelompok Keahlian telah dihapus.']);
|
|
} else {
|
|
echo json_encode(['result' => false, 'msg' => 'Aksi gagal DBERROR.']);
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|