Add consultation module assets and libraries
This commit is contained in:
82
konsultasi/API/public/getKonsultasiHistory.php
Normal file
82
konsultasi/API/public/getKonsultasiHistory.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
include '../../conf/koneksiPDO.php';
|
||||
include '../../conf/function.php';
|
||||
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$conn = new createCon();
|
||||
$dbh = $conn->connect();
|
||||
|
||||
checkKey('GET', 'id');
|
||||
|
||||
$idPraoutline = intval($_GET['id']);
|
||||
|
||||
$sql = 'SELECT * FROM tugas_akhir WHERE idPraoutline = :id';
|
||||
$stmt = $dbh->prepare($sql);
|
||||
$stmt->bindParam(':id', $idPraoutline);
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->rowCount() == 0) {
|
||||
echo getKonsultasiNotFoundMessage();
|
||||
exit();
|
||||
}
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$pemb1 = $row['pemb1'];
|
||||
$pemb2 = $row['pemb2'];
|
||||
$idTugasAkhir = $row['idTugasAkhir'];
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM dosen WHERE nip IN('$pemb1','$pemb2')";
|
||||
$stmt = $dbh->prepare($sql);
|
||||
$stmt->execute();
|
||||
|
||||
$namaPemb1 = '-';
|
||||
$namaPemb2 = '-';
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$nipDb = $row['nip'];
|
||||
if ($nipDb == $pemb1) {
|
||||
$namaPemb1 = $row['namaDosen'];
|
||||
}
|
||||
|
||||
if ($nipDb == $pemb2) {
|
||||
$namaPemb2 = $row['namaDosen'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM konsultasi WHERE idTugasAkhir = :id AND (timestampDosen1 > 0 OR timestampDosen2 > 0) ORDER BY timestamp';
|
||||
$stmt = $dbh->prepare($sql);
|
||||
$stmt->bindParam(':id', $idTugasAkhir);
|
||||
$stmt->execute();
|
||||
|
||||
$data = array();
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$timestamp = $row['timestamp'];
|
||||
$waktuText = date('d-m-Y', $timestamp);
|
||||
$topik = $row['topik'];
|
||||
$timestampDosen1 = intval($row['timestampDosen1']);
|
||||
$timestampDosen2 = intval($row['timestampDosen2']);
|
||||
|
||||
if($timestampDosen1 > 0){
|
||||
$pemb = $namaPemb1;
|
||||
}
|
||||
|
||||
if($timestampDosen2 > 0){
|
||||
$pemb = $namaPemb2;
|
||||
}
|
||||
|
||||
array_push($data, array(
|
||||
'id' => $row['idKonsul'],
|
||||
'waktu' => $waktuText,
|
||||
'topik' => $topik,
|
||||
'pembimbing' => $pemb,
|
||||
));
|
||||
}
|
||||
|
||||
echo json_encode(utf8ize(array(
|
||||
'status' => 1,
|
||||
'data' => $data,
|
||||
)));
|
||||
0
konsultasi/API/public/index.php
Normal file
0
konsultasi/API/public/index.php
Normal file
Reference in New Issue
Block a user