Add SPOTA core PHP application

Add the main admin, dosen, mahasiswa, API, and service code needed to run the core legacy application with configurable upload storage.
This commit is contained in:
Power BI Dev
2026-05-02 10:08:52 +07:00
parent 874dbbe8e8
commit efdb11db3f
221 changed files with 43273 additions and 0 deletions

View File

@@ -0,0 +1,304 @@
<?php
session_start();
$idprodi = $_SESSION['login-dosen']['prodi'];
$iddosen = $_SESSION['login-dosen']['id'];
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Easy set variables
*/
/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
$aColumns = ['tp.judul', 'tp.nim', 'tm.nmLengkap',];
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = 'tp.id';
/* DB table to use */
$sTable = 'tbpraoutline tp';
//$sTable .= ' LEFT JOIN tbreview tr ON (tp.id=tr.idpraoutline) ';
$sTable .= ' LEFT JOIN tbmhs tm ON (tm.nim=tp.nim) ';
$sTable .= ' LEFT JOIN tbrekaphasil trh ON (trh.idpraoutline=tp.id) ';
/* Database connection information */
include '../inc/helper.php';
include '../inc/konfigurasi.php';
include '../inc/db.pdo.class.php';
require_once '../konsultasi/libs/mpdf/autoload.php';
$db = new dB($dbsetting);
$query = "SELECT * FROM tb_kelompok_keahlian WHERE ketuaKK = '".$_SESSION['login-dosen']['id']."' OR sekretarisKK = '".$_SESSION['login-dosen']['id']."'";
$result = $db->runQuery($query);
$idKKKetua = -1;
$currentKK = '';
while ($aRow = $db->dbFetch($result)) {
$idKKKetua = $aRow['idKK'];
$currentKK = $aRow['namaKK'];
}
$query = "SELECT * FROM tbdosen WHERE iddosen = '".$_SESSION['login-dosen']['id']."'";
$result = $db->runQuery($query);
$namaDosen = '';
$nipDosen = '';
while ($aRow = $db->dbFetch($result)) {
$namaDosen = $aRow['nmLengkap'];
$nipDosen = $aRow['nip'];
}
/*
* Paging
*/
$sLimit = '';
if (isset($_GET['iDisplayStart']) && $_GET['iDisplayLength'] != '-1') {
$sLimit = 'LIMIT '.intval($_GET['iDisplayStart']).', '.
intval($_GET['iDisplayLength']);
}
/*
* Ordering
*/
//$sOrder = 'ORDER BY tp.tgl_upload DESC, tp.judul ASC';
$sOrder = 'ORDER BY t.tgl_upload DESC, t.judul ASC';
/*
* Filtering
*/
$sWhere = '';
if (isset($_GET['sSearch']) && $_GET['sSearch'] != '') {
$sWhere = 'WHERE (';
for ($i = 0; $i < count($aColumns); ++$i) {
if (isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == 'true') {
$sWhere .= ''.$aColumns[$i]." LIKE '%".$_GET['sSearch']."%' OR ";
}
}
$sWhere = substr_replace($sWhere, '', -3);
$sWhere .= ')';
}
/* Individual column filtering */
for ($i = 0; $i < count($aColumns); ++$i) {
if (isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == 'true' && $_GET['sSearch_'.$i] != '') {
if ($sWhere == '') {
$sWhere = 'WHERE ';
} else {
$sWhere .= ' AND ';
}
$sWhere .= ''.$aColumns[$i]." LIKE '%".$_GET['sSearch_'.$i]."%' ";
}
}
$where2 = '';
if ($sWhere != '') {
$where2 = " AND tp.idProdi='$idprodi' ";
} else {
$where2 = " WHERE tp.idProdi='$idprodi' ";
}
/*
* SQL queries
* Get data to display
*/
$sqlKK = 'SELECT * FROM tb_kelompok_keahlian';
$db->runQuery($sqlKK);
$dataKK = [];
while ($kk = $db->dbFetch()) {
$idKK = $kk['idKK'];
$namaKK = $kk['namaKK'];
$warnaLabel = $kk['warnaLabel'];
$dataKK[$idKK] = ['nama' => $namaKK, 'label' => $warnaLabel];
}
$whereJenis = '';
if (isset($_GET['jenis'])) {
$jenis = $_GET['jenis'];
if ($jenis != 'Semua') {
switch ($jenis) {
case 'Belum Disetujui': $whereJenis = ' AND found = 0 '; break;
case 'Sudah Disetujui': $whereJenis = ' AND found > 0 '; break;
}
}
}
$whereTanggal = '';
$periodeText = "SEMUA TANGGAL";
if (isset($_GET['show'])) {
$showTanggal = $_GET['show'];
if ($showTanggal == '1') {
$tanggalAwal = date('Y-m-d', strtotime($_GET['startDate']));
$tanggalAkhir = date('Y-m-d', strtotime($_GET['endDate']));
$tanggalAwalDMY = date('d-m-Y', strtotime($_GET['startDate']));
$tanggalAkhirDMY = date('d-m-Y', strtotime($_GET['endDate']));
$whereTanggal = " AND tgl_kep >= '$tanggalAwal' AND tgl_kep <= '$tanggalAkhir'";
$periodeText = "$tanggalAwalDMY s/d $tanggalAkhirDMY";
}
}
$sQuery0 = "
SELECT * FROM (SELECT tp.*,
tm.nmLengkap as nm_mhs,
tgl_kep,
(SELECT COUNT(id) as found FROM tbrekaphasil WHERE idpraoutline = tp.id),
wkt_kep
FROM $sTable
$sWhere
$where2
) t WHERE kelompokKeahlian = '$idKKKetua' $whereJenis $whereTanggal $sOrder
";
$db->runQuery($sQuery0);
$iFilteredTotal = $db->dbRows();
$result = $db->runQuery($sQuery0.$sLimit);
/* Total data set length */
$sQuery2 = "
SELECT COUNT(tp.id) as total FROM $sTable $sWhere $where2 GROUP BY tp.id
";
//echo $sQuery2;
$db->runQuery($sQuery2);
$aResultTotal = $db->dbFetch();
$iTotal = $aResultTotal['total'];
/*$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
$aResultTotal = mysql_fetch_array($rResultTotal);
$iTotal = $aResultTotal[0];*/
/*
* Output
*/
$output = [
'sEcho' => intval($_GET['sEcho']),
'iTotalRecords' => $iTotal,
'iTotalDisplayRecords' => $iFilteredTotal,
'aaData' => [],
];
$listData = [];
while ($aRow = $db->dbFetch($result)) {
$row = [];
$statusPraoutline = '';
if ($aRow['status_usulan'] == 0) {
$statusPraoutline = 'Belum Diterima';
} elseif ($aRow['status_usulan'] == 1) {
$statusPraoutline = 'Judul Diterima';
} elseif ($aRow['status_usulan'] == 2) {
$statusPraoutline = 'Judul Ditolak';
} elseif ($aRow['status_usulan'] == 3) {
$statusPraoutline = 'Judul Gugur';
}
$tglKep = '';
if($aRow['tgl_kep'] != null){
$tglKep = tanggalIndo($aRow['tgl_kep'], 'j F Y'). ' '.$aRow['wkt_kep'];
}
array_push($listData, [
'statusPraoutline' => $statusPraoutline,
'nama' => $aRow['nm_mhs'],
'nim' => $aRow['nim'],
'judul' => $aRow['judul'],
'sem' => $aRow['thn_ajaran'].' - '.$aRow['semester'],
'upload' => tanggalIndo($aRow['tgl_upload'], 'j F Y, H:i'),
'keputusan' => $tglKep,
]);
}
$titleDokumen = "LAPORAN KINERJA KELOMPOK KEAHLIAN $currentKK JURUSAN INFORMATIKA FAK. TEKNIK Periode: $periodeText";
$mpdf = new \Mpdf\Mpdf(['mode' => 'utf-8', 'format' => 'A4', 'margin_header' => 0, 'margin_top' => 10, 'margin_bottom' => 3, 'margin_left' => 10, 'margin_right' => 10, 'margin_footer' => 0], ['defaultPageNumStyle' => '1']);
$html = '
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>'.$titleDokumen.'</title>
<style>
body {
font-family: "Times New Roman";
font-size:12px;
}
table {overflow:wrap !important }
</style>
</head>
<body>
<div style="text-align:center; font-size:15px;font-weight:bold">LAPORAN KINERJA KELOMPOK KEAHLIAN<br>'.$currentKK.'<br>JURUSAN INFORMATIKA FAK. TEKNIK<br>Periode: '.$periodeText.'</div>
<hr>
<table style="border-collapse: collapse" border="1">
<thead>
<tr>
<th style="width:40px">No</th>
<th style="width:150px">Mahasiswa</th>
<th style="width:200px">Judul Usulan</th>
<th style="width:80px">Status</th>
<th style="width:80px">Tahun Ajaran</th>
<th style="width:80px">Tanggal Upload</th>
<th style="width:80px">Tanggal Keputusan</th>
</tr>
</thead>
<tbody>
';
if(sizeof($listData) == 0){
$html .= '<tr><td colspan="7">Tidak ada data.</td></tr>';
}
for ($i = 0; $i < sizeof($listData); ++$i) {
$dataProp = $listData[$i];
$no = $i + 1;
$html .= '
<tr>
<td style="padding: 5px 5px;text-align:center">'.$no.'</td>
<td style="padding: 5px 5px;">'.$dataProp['nama'].' / '.$dataProp['nim'].'</td>
<td style="padding: 5px 5px;">'.$dataProp['judul'].'</td>
<td style="padding: 5px 5px;">'.$dataProp['statusPraoutline'].'</td>
<td style="padding: 5px 5px;">'.$dataProp['sem'].'</td>
<td style="padding: 5px 5px;">'.$dataProp['upload'].'</td>
<td style="padding: 5px 5px;">'.$dataProp['keputusan'].'</td>
</tr>
';
}
$html .= '
</tbody>
</table>
<table style="width:100%; margin-top:20px;page-break-inside:avoid; font-size:12px !important">
<tr>
<td style="width:400px">
</td>
<td style="">
Pontianak, '.tanggalIndo(date('Y-m-d'), 'j F Y').'<br>
Ketua KK '.$currentKK.'<br>
<br>
<br><br><br><br>
<u>'.$namaDosen.'</u><br>
NIP. '.$nipDosen.'
</td>
</tr>
</table>
</body>
</html>
';
$mpdf->shrink_tables_to_fit = 0;
$mpdf->WriteHTML($html);
$namafile = $titleDokumen.'-'.time();
$mpdf->Output($namafile, 'I');