106 lines
3.0 KiB
PHP
106 lines
3.0 KiB
PHP
<?php
|
|
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', '0');
|
|
|
|
include '../conf/class.server.php';
|
|
include '../conf/koneksiPDO.php';
|
|
include '../conf/function.php';
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
$conn = new createCon();
|
|
$dbh = $conn->connect();
|
|
|
|
requireRobotSecret();
|
|
|
|
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
|
|
if ($id <= 0) {
|
|
jsonResponse([
|
|
'status' => 0,
|
|
'msg' => 'Parameter id tidak valid',
|
|
], 422);
|
|
}
|
|
|
|
$listTahunMasukMahasiswa = [];
|
|
$sql = "SELECT * FROM tbmhs";
|
|
$stmt = $dbh->prepare($sql);
|
|
$stmt->execute();
|
|
|
|
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
|
|
$nimDb = $row['nim'];
|
|
$thnMasukDb = $row['thnmasuk'];
|
|
|
|
$listTahunMasukMahasiswa[$nimDb] = intval($thnMasukDb);
|
|
}
|
|
|
|
//$sql = "SELECT tbpraoutline.*, tbrekaphasil.judul_final, tbrekaphasil.pemb1, tbrekaphasil.pemb2, tbrekaphasil.peng1, tbrekaphasil.peng2, tbrekaphasil.kep_akhir, tbrekaphasil.tgl_kep, tbrekaphasil.wkt_kep FROM tbpraoutline LEFT JOIN tbrekaphasil ON tbpraoutline.id = tbrekaphasil.idpraoutline";
|
|
$sql = "SELECT tbrekaphasil.*, tbpraoutline.kelompokKeahlian FROM tbrekaphasil LEFT JOIN tbpraoutline ON tbrekaphasil.idpraoutline = tbpraoutline.id WHERE tbrekaphasil.id = :id";
|
|
$stmt = $dbh->prepare($sql);
|
|
$stmt->bindParam(':id', $id);
|
|
$stmt->execute();
|
|
|
|
if($stmt->rowCount() == 0){
|
|
jsonResponse([
|
|
'status' => 0,
|
|
'msg' => 'Data Not Found',
|
|
], 404);
|
|
}
|
|
$data = null;
|
|
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
|
$id = $row['id'];
|
|
$nim = $row['nim'];
|
|
$judul = $row['judul_final'];
|
|
$pemb1 = $row['pemb1'];
|
|
$pemb2 = $row['pemb2'];
|
|
$peng1 = $row['peng1'];
|
|
$peng2 = $row['peng2'];
|
|
$semester = $row['semester'];
|
|
$tahun = $row['tahun_ajaran'];
|
|
$tanggalKep = $row['tgl_kep'];
|
|
$waktuKep = $row['wkt_kep'];
|
|
$kepAkhir = $row['kep_akhir'];
|
|
$kelompokKeahlian = $row['kelompokKeahlian'];
|
|
$jadwal = [];
|
|
|
|
if(!isset($listTahunMasukMahasiswa[$nim])){
|
|
continue;
|
|
}else{
|
|
if($listTahunMasukMahasiswa[$nim] < 2014){
|
|
continue;
|
|
}
|
|
}
|
|
|
|
$sql = "SELECT * FROM tbjadwal LEFT JOIN tbmhs ON tbjadwal.idMhs = tbmhs.idmhs WHERE nim = :nim AND publish = 'Y' ORDER BY start";
|
|
$stmt1 = $dbh->prepare($sql);
|
|
$stmt1->bindParam(':nim', $nim);
|
|
$stmt1->execute();
|
|
|
|
while($row1 = $stmt1->fetch(PDO::FETCH_ASSOC)){
|
|
array_push($jadwal,[
|
|
'jenis' => $row1['jenis'],
|
|
'waktu' => $row1['start'],
|
|
'ruangan' => $row1['ruangan'],
|
|
]);
|
|
}
|
|
|
|
$data = array(
|
|
'id' => $id,
|
|
'judul' => $judul,
|
|
'nim' => $nim,
|
|
'pemb1' => $pemb1,
|
|
'pemb2' => $pemb2,
|
|
'peng1' => $peng1,
|
|
'peng2' => $peng2,
|
|
'semester' => $semester,
|
|
'tahun' => $tahun,
|
|
'tanggalKeputusan' => $tanggalKep,
|
|
'waktuKeputusan' => $waktuKep,
|
|
'kelompokKeahlian' => $kelompokKeahlian,
|
|
'jadwal' => $jadwal,
|
|
'kepAkhir' => $kepAkhir,
|
|
);
|
|
}
|
|
|
|
echo json_encode(utf8ize(['status' => 1, 'data' => $data]));
|