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:
174
client_api/back_up_profil.php
Normal file
174
client_api/back_up_profil.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include ("../inc/helper.php");
|
||||
include ("../inc/konfigurasi.php");
|
||||
include ("../inc/db.pdo.class.php");
|
||||
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
if($_POST){
|
||||
switch($_POST['act']){
|
||||
case 'lihat':
|
||||
$jenis=$_POST['j'];
|
||||
$id=$_POST['who'];
|
||||
|
||||
if(ctype_digit($id) && ctype_alnum($jenis)){
|
||||
if($jenis=="M"){
|
||||
$qu="SELECT * FROM tbmhs WHERE idMhs='$id' LIMIT 1";
|
||||
$db->runQuery($qu);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
$response=array();
|
||||
$response["profil"] = array();
|
||||
|
||||
$detail['nama_lengkap']=$r['nmLengkap'];
|
||||
$detail['id_user']=$r['idmhs'];
|
||||
$detail['id_prodi']=$r['idProdi'];
|
||||
$detail['username']=$r['nim'];
|
||||
$detail['email']=$r['email'];
|
||||
$detail['angkatan']=$r['thnmasuk'];
|
||||
$detail['foto']=LINK_GAMBAR.$r['foto'];
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Data Loaded";
|
||||
array_push($response["profil"], $detail);
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Load Data Failed (Data Not Found)";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else if($jenis=="D" OR $jenis=="K"){
|
||||
$qu="SELECT * FROM tbdosen WHERE idDosen='$id' LIMIT 1";
|
||||
$db->runQuery($qu);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
$response=array();
|
||||
$response["profil"] = array();
|
||||
|
||||
$detail['nama_lengkap']=$r['nmLengkap'];
|
||||
$detail['id_user']=$r['iddosen'];
|
||||
$detail['id_prodi']=$r['idProdi'];
|
||||
$detail['username']=$r['nip'];
|
||||
$detail['email']=$r['email'];
|
||||
$detail['nohp']=$r['jenis'];
|
||||
$detail['jabatan']=$r['jenis'];
|
||||
$detail['foto']=LINK_GAMBAR.$r['foto'];
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Data Loaded";
|
||||
array_push($response["profil"], $detail);
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Load Data Failed (Data Not Found)";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Load Data Failed";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Load Data Failed";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
$id=$_POST['id'];
|
||||
$jenis=$_POST['j'];
|
||||
if(ctype_digit($id)){
|
||||
if($jenis=="M"){
|
||||
$u="UPDATE tbmhs SET
|
||||
nmLengkap='".$_POST['nama']."',
|
||||
email='".$_POST['email']."'
|
||||
WHERE idmhs='$id'";
|
||||
}else if($jenis=="D" OR $jenis=="K"){
|
||||
$u="UPDATE tbdosen SET
|
||||
nmLengkap='".$_POST['nama']."',
|
||||
email='".$_POST['email']."',
|
||||
nohp='".$_POST['nohp']."',
|
||||
jabatan='".$_POST['jabatan']."'
|
||||
WHERE iddosen='$id'";
|
||||
}
|
||||
|
||||
if($db->runQuery($u)){
|
||||
$response["success"] = "1";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Profil Berhasil Diupdate";
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Gagal Update Data - ";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Sorry, Cant Process Your Request";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update_pwd':
|
||||
$id=$_POST['id'];
|
||||
$jenis=$_POST['j'];
|
||||
$pwd=$_POST['pwd'];
|
||||
$u="";
|
||||
if(ctype_digit($id)){
|
||||
if($jenis=="M"){
|
||||
$s="SELECT password FROM tbmhs WHERE idmhs='$id' LIMIT 1";
|
||||
$db->runQuery($s);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
if($r['password']==md5($pwd)){
|
||||
$u="UPDATE tbmhs SET password='".md5($pwd)."' WHERE idmhs='$id'";
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0",
|
||||
"profil"=>null,
|
||||
"msg"=>"Password Lama Tidak Sesuai"));
|
||||
}
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"Data Not Found"));
|
||||
}
|
||||
}else if($jenis=="D" OR $jenis=="K"){
|
||||
$s="SELECT password FROM tbdosen WHERE iddosen='$id' LIMIT 1";
|
||||
$db->runQuery($s);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
if($r['password']==md5($pwd)){
|
||||
$u="UPDATE tbdosen SET password='".md5($pwd)."' WHERE iddosen='$id'";
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"Password Lama Tidak Sesuai"));
|
||||
}
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"Data Not Found"));
|
||||
}
|
||||
}
|
||||
|
||||
if($db->runQuery($u)){
|
||||
echo json_encode(array("success"=>"1","profil"=>null,"msg"=>"Profil Berhasil diupdate"));
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"Gagal Update Data")); }
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Sorry, Cant Process Your Request";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
186
client_api/dosen.php
Normal file
186
client_api/dosen.php
Normal file
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include ("../inc/helper.php");
|
||||
include ("../inc/konfigurasi.php");
|
||||
include ("../inc/db.pdo.class.php");
|
||||
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
header('Content-Type: application/json');
|
||||
if($_POST){
|
||||
switch($_POST['act']){
|
||||
case 'profil':
|
||||
$jenis=$_POST['j'];
|
||||
$id=$_POST['who'];
|
||||
$prodi=$_POST['idprodi'];
|
||||
|
||||
if(ctype_digit($id)){
|
||||
$qu="SELECT * FROM tbdosen WHERE idDosen='$id' AND idProdi='$prodi' LIMIT 1";
|
||||
$db->runQuery($qu);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
$response=array();
|
||||
$response["profil"] = array();
|
||||
|
||||
$detail['nama_lengkap']=$r['nmLengkap'];
|
||||
$detail['id_user']=$r['iddosen'];
|
||||
$detail['id_prodi']=$r['idProdi'];
|
||||
$detail['username']=$r['nip'];
|
||||
$detail['email']=$r['email'];
|
||||
$detail['nohp']=$r['nohp'];
|
||||
$detail['jabatan']=$r['jenis'];
|
||||
$detail['foto']=LINK_GAMBAR.$r['foto'];
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Data Loaded";
|
||||
array_push($response["profil"], $detail);
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Load Data Failed (Data Not Found)";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Load Data Failed";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
$id=$_POST['id'];
|
||||
$jenis=$_POST['j'];
|
||||
|
||||
if(ctype_digit($id)){
|
||||
|
||||
$RandomNumber = rand(0, 9999999999);
|
||||
$ImageName = "dosen";
|
||||
$NewImageName = $ImageName.'_'.$RandomNumber.'.jpg';
|
||||
|
||||
if($_POST['pic']!=""){
|
||||
base64_to_jpeg($_POST['pic'],DIR_GAMBAR.$NewImageName);
|
||||
$foto=" foto='".$NewImageName."', ";
|
||||
}else{
|
||||
$foto="";
|
||||
}
|
||||
|
||||
$oldpic="SELECT foto FROM tbdosen WHERE iddosen='$id'";
|
||||
$db->runQuery($oldpic);
|
||||
$rpic=$db->dbFetch();
|
||||
$gambarlama=$rpic['foto'];
|
||||
|
||||
$u="UPDATE tbdosen SET
|
||||
nmLengkap='".$_POST['nama']."',
|
||||
email='".$_POST['email']."',
|
||||
nohp='".$_POST['nohp']."',
|
||||
$foto
|
||||
jabatan='".$_POST['jabatan']."'
|
||||
WHERE iddosen='$id'";
|
||||
|
||||
if($db->runQuery($u)){
|
||||
$response["success"] = "1";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Profil Berhasil Diupdate";
|
||||
if($_POST['pic']!=""){
|
||||
@unlink(DIR_GAMBAR.$gambarlama);
|
||||
}
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
@unlink(DIR_GAMBAR.$NewImageName);
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Gagal Update Data - ";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Sorry, Cant Process Your Request";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update_pwd':
|
||||
$id=$_POST['id'];
|
||||
$jenis=$_POST['j'];
|
||||
$pwdbaru=$_POST['pwdbaru'];
|
||||
$pwdlama=$_POST['pwdlama'];
|
||||
$u="";
|
||||
if(ctype_digit($id)){
|
||||
$s="SELECT password FROM tbdosen WHERE iddosen='$id' LIMIT 1";
|
||||
$db->runQuery($s);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
if($r['password']==md5($pwdlama)){
|
||||
$u="UPDATE tbdosen SET password='".md5($pwdbaru)."' WHERE iddosen='$id'";
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"Password Lama Tidak Sesuai"));
|
||||
}
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"Data Not Found"));
|
||||
}
|
||||
|
||||
if($db->runQuery($u)){
|
||||
echo json_encode(array("success"=>"1","profil"=>null,"msg"=>"Ganti Password Berhasil"));
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"DBError")); }
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Sorry, Cant Process Your Request";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'listdosen':
|
||||
$prodi=$_POST['idprodi'];
|
||||
$q="SELECT * FROM tbdosen WHERE idProdi='$prodi'";
|
||||
$db->runQuery($q);
|
||||
if($db->dbRows()>0){
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
|
||||
//$dosen=array();
|
||||
|
||||
//$dosen['nip']="";
|
||||
//$dosen['namadosen']="Pilih Dosen";
|
||||
//array_push($response["data"], $dosen);
|
||||
|
||||
while($r=$db->dbFetch()){
|
||||
$dosen=array();
|
||||
|
||||
$dosen['nip']=$r['nip'];
|
||||
$dosen['namadosen']=$r['nmLengkap'];
|
||||
array_push($response["data"], $dosen);
|
||||
}
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Sukses";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
function base64_to_jpeg($base64_string, $output_file) {
|
||||
$ifp = fopen($output_file, "wb");
|
||||
|
||||
fwrite($ifp, base64_decode($base64_string));
|
||||
fclose($ifp);
|
||||
|
||||
return $output_file;
|
||||
}
|
||||
20
client_api/jadwal.php
Normal file
20
client_api/jadwal.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include ("../inc/helper.php");
|
||||
include ("../inc/konfigurasi.php");
|
||||
include ("../inc/db.pdo.class.php");
|
||||
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
|
||||
if($_POST){
|
||||
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data_jadwal"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
?>
|
||||
93
client_api/login.php
Normal file
93
client_api/login.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include ("../inc/helper.php");
|
||||
include ("../inc/konfigurasi.php");
|
||||
include ("../inc/db.pdo.class.php");
|
||||
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
header('Content-Type: application/json');
|
||||
if($_POST){
|
||||
$user=$_POST['u'];
|
||||
$password=$_POST['p'];
|
||||
$jenis_user="";
|
||||
$regid=$_POST['regid'];
|
||||
if(substr($user, 0,1)=='D'){
|
||||
$jenis_user="MHS";
|
||||
$qu="SELECT * FROM tbmhs WHERE nim='$user' LIMIT 1";
|
||||
}else{
|
||||
$jenis_user="DOSEN";
|
||||
$qu="SELECT * FROM tbdosen WHERE nip='$user' LIMIT 1";
|
||||
}
|
||||
|
||||
//$qu="SELECT * FROM tbadmin WHERE username='$user' LIMIT 1";
|
||||
$db->runQuery($qu);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
$dbpass=$r['password'];
|
||||
$response=array();
|
||||
$response["login"] = array();
|
||||
if($r['status']=='A'){
|
||||
if($dbpass==md5($password)){
|
||||
if($jenis_user=="MHS"){
|
||||
$detail['nama_lengkap']=$r['nmLengkap'];
|
||||
$detail['id_user']=$r['idmhs'];
|
||||
$detail['id_prodi']=$r['idProdi'];
|
||||
$detail['username']=$r['nim'];
|
||||
$detail['email']=$r['email'];
|
||||
$detail['jenis']="M";
|
||||
|
||||
$gcm_reg="REPLACE INTO gcm_service SET
|
||||
iduser='".$r['nim']."',
|
||||
jenisuser='M',
|
||||
regid='".$regid."',
|
||||
aktif='Y'";
|
||||
|
||||
}else{
|
||||
$detail['nama_lengkap']=$r['nmLengkap'];
|
||||
$detail['id_user']=$r['iddosen'];
|
||||
$detail['id_prodi']=$r['idProdi'];
|
||||
$detail['username']=$r['nip'];
|
||||
$detail['email']=$r['email'];
|
||||
$detail['jenis']=$r['jenis'];
|
||||
|
||||
$gcm_reg="REPLACE INTO gcm_service SET
|
||||
iduser='".$r['nip']."',
|
||||
jenisuser='".$r['jenis']."',
|
||||
regid='".$regid."',
|
||||
aktif='Y'";
|
||||
}
|
||||
//comingsoon
|
||||
$db->runQuery($gcm_reg);
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Login Sukses";
|
||||
array_push($response["login"], $detail);
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["login"] = null;
|
||||
$response["msg"] = "Password Salah";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["login"] = null;
|
||||
$response["msg"] = "Akun anda tidak aktif";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["login"] = null;
|
||||
$response["msg"] = "Anda Tidak Terdaftar";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
?>
|
||||
38
client_api/logout.php
Normal file
38
client_api/logout.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include ("../inc/helper.php");
|
||||
include ("../inc/konfigurasi.php");
|
||||
include ("../inc/db.pdo.class.php");
|
||||
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if($_POST){
|
||||
$regid=$_POST['regid'];
|
||||
if($regid!=""){
|
||||
$q="DELETE FROM gcm_service WHERE regid='$regid'";
|
||||
if($db->runQuery($q)){
|
||||
$response["success"] = "1";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Logout Berhasil";
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Logout Gagal";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Registration id not Found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
148
client_api/mahasiswa.php
Normal file
148
client_api/mahasiswa.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include ("../inc/helper.php");
|
||||
include ("../inc/konfigurasi.php");
|
||||
include ("../inc/db.pdo.class.php");
|
||||
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
header('Content-Type: application/json');
|
||||
if($_POST){
|
||||
switch($_POST['act']){
|
||||
|
||||
case 'profil':
|
||||
$id=$_POST['who'];
|
||||
$prodi=$_POST['idprodi'];
|
||||
if(ctype_digit($id)){
|
||||
$qu="SELECT * FROM tbmhs WHERE idMhs='$id' AND idProdi='$prodi' LIMIT 1";
|
||||
$db->runQuery($qu);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
$response=array();
|
||||
$response["profil"] = array();
|
||||
|
||||
$detail['nama_lengkap']=$r['nmLengkap'];
|
||||
$detail['id_user']=$r['idmhs'];
|
||||
$detail['id_prodi']=$r['idProdi'];
|
||||
$detail['username']=$r['nim'];
|
||||
$detail['email']=$r['email'];
|
||||
$detail['angkatan']=$r['thnmasuk'];
|
||||
$detail['foto']=LINK_GAMBAR.$r['foto'];
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Data Loaded";
|
||||
array_push($response["profil"], $detail);
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Load Data Failed (Data Not Found)";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Load Data Failed";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
$id=$_POST['id'];
|
||||
|
||||
if(ctype_digit($id)){
|
||||
|
||||
$RandomNumber = rand(0, 9999999999);
|
||||
$ImageName = "mhs";
|
||||
$NewImageName = $ImageName.'_'.$RandomNumber.'.jpg';
|
||||
|
||||
if($_POST['pic']!=""){
|
||||
base64_to_jpeg($_POST['pic'],DIR_GAMBAR.$NewImageName);
|
||||
$foto=" foto='".$NewImageName."', ";
|
||||
}else{
|
||||
$foto="";
|
||||
}
|
||||
|
||||
$oldpic="SELECT foto FROM tbmhs WHERE idmhs='$id'";
|
||||
$db->runQuery($oldpic);
|
||||
$rpic=$db->dbFetch();
|
||||
$gambarlama=$rpic['foto'];
|
||||
|
||||
$u="UPDATE tbmhs SET
|
||||
nmLengkap='".$_POST['nama']."',
|
||||
$foto
|
||||
email='".$_POST['email']."'
|
||||
WHERE idmhs='$id'";
|
||||
|
||||
if($db->runQuery($u)){
|
||||
$response["success"] = "1";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Profil Berhasil Diupdate";
|
||||
if($_POST['pic']!=""){
|
||||
@unlink(DIR_GAMBAR.$gambarlama);
|
||||
}
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
@unlink(DIR_GAMBAR.$NewImageName);
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Gagal Update Data - ";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Sorry, Cant Process Your Request";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update_pwd':
|
||||
$id=$_POST['id'];
|
||||
$pwdbaru=$_POST['pwdbaru'];
|
||||
$pwdlama=$_POST['pwdlama'];
|
||||
$u="";
|
||||
if(ctype_digit($id)){
|
||||
$s="SELECT password FROM tbmhs WHERE idmhs='$id' LIMIT 1";
|
||||
$db->runQuery($s);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
if($r['password']==md5($pwdlama)){
|
||||
$u="UPDATE tbmhs SET password='".md5($pwdbaru)."' WHERE idmhs='$id'";
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0",
|
||||
"profil"=>null,
|
||||
"msg"=>"Password Lama Tidak Sesuai"));
|
||||
}
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"Data Not Found"));
|
||||
}
|
||||
|
||||
if($db->runQuery($u)){
|
||||
echo json_encode(array("success"=>"1","profil"=>null,"msg"=>"Ganti Password Berhasil"));
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"DBError")); }
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Sorry, Cant Process Your Request";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
function base64_to_jpeg($base64_string, $output_file) {
|
||||
$ifp = fopen($output_file, "wb");
|
||||
|
||||
fwrite($ifp, base64_decode($base64_string));
|
||||
fclose($ifp);
|
||||
|
||||
return $output_file;
|
||||
}
|
||||
59
client_api/pemberitahuan.php
Normal file
59
client_api/pemberitahuan.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include ("../inc/helper.php");
|
||||
include ("../inc/konfigurasi.php");
|
||||
include ("../inc/db.pdo.class.php");
|
||||
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
header('Content-Type: application/json');
|
||||
if($_POST){
|
||||
if($_POST['jenis_user']=="M"){
|
||||
$jenis="M";
|
||||
}else if ($_POST['jenis_user']=="D" OR $_POST['jenis_user']=="K"){
|
||||
$jenis="D";
|
||||
}else{
|
||||
$jenis="A";
|
||||
}
|
||||
|
||||
$prodi=$_POST['prodi'];
|
||||
$user=$_POST['user'];
|
||||
$q="SELECT tnr.*
|
||||
FROM tmp_notif_r tnr
|
||||
LEFT JOIN tbpraoutline tp ON(tp.id=tnr.idkonten)
|
||||
WHERE tnr.read = 'N'
|
||||
AND tnr.jns_usr = '".$jenis."'
|
||||
AND tnr.user = '".$user."'
|
||||
AND tnr.idProdi = '".$prodi."'";
|
||||
$db->runQuery($q);
|
||||
if($db->dbRows()>0){
|
||||
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
while($p=$db->dbFetch()){
|
||||
$draft=array();
|
||||
$draft['idkonten']=$p['idkonten'];
|
||||
$draft['tgl']=tanggalIndo($p['tgl'],'j F Y H:i:s');
|
||||
$draft['pesan']=$p['msg'];
|
||||
$draft['read']=$p['read'];
|
||||
array_push($response["data"], $draft);
|
||||
}
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Sukses";
|
||||
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "1";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Tidak Ada Pemberitahuan Terbaru";
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
115
client_api/pengumuman.php
Normal file
115
client_api/pengumuman.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include ("../inc/helper.php");
|
||||
include ("../inc/konfigurasi.php");
|
||||
include ("../inc/db.pdo.class.php");
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if($_POST){
|
||||
switch ($_POST['act']) {
|
||||
case 'list':
|
||||
$jenis=$_POST['j'];
|
||||
$id_prodi=$_POST['prodi'];
|
||||
$iduser=$_POST['iduser'];
|
||||
if($jenis!=""){
|
||||
$p="";
|
||||
switch ($jenis) {
|
||||
case 'M':
|
||||
$p="SELECT tp.id,tp.judul,tp.tgl,
|
||||
(SELECT count(id) FROM tmp_notif WHERE idkonten=tp.id AND iduser='".$iduser."' AND idProdi='".$id_prodi."' AND jenis='P' AND typeuser='M') as baca
|
||||
FROM tbpengumuman tp WHERE tp.publish='Y' AND tp.idProdi = '$id_prodi' AND tp.tujuan IN('A','M') ORDER BY tp.tgl DESC";
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
case 'K':
|
||||
$p="SELECT tp.id,tp.judul,tp.tgl,
|
||||
(SELECT count(id) FROM tmp_notif WHERE idkonten=tp.id AND iduser='".$iduser."' AND idProdi='".$id_prodi."' AND jenis='P' AND typeuser='D') as baca
|
||||
FROM tbpengumuman tp WHERE tp.publish='Y' AND tp.idProdi = '$id_prodi' AND tp.tujuan IN('A','D') ORDER BY tp.tgl DESC";
|
||||
break;
|
||||
}
|
||||
|
||||
$db->runQuery($p);
|
||||
if($db->dbRows()>0){
|
||||
$response=array();
|
||||
$response["data"] = array();
|
||||
while($r=$db->dbFetch()){
|
||||
$peng=array();
|
||||
$peng['id']=$r['id'];
|
||||
$peng['judul']=str_replace('"', '`', $r['judul']);
|
||||
$peng['tgl']=tanggalIndo($r['tgl'],'j F Y');
|
||||
$peng['baca']=$r['baca'];
|
||||
array_push($response["data"], $peng);
|
||||
}
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Get List Pengumuman Success";
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Tidak Ada Pengumuman";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'detail':
|
||||
$id_prodi=$_POST['prodi'];
|
||||
$id_pengumuman=$_POST['id'];
|
||||
$iduser=$_POST['iduser'];
|
||||
$jenis=$_POST['j'];
|
||||
|
||||
$s="SELECT judul, isi, tgl FROM tbpengumuman WHERE idProdi='$id_prodi' AND publish='Y' AND id='$id_pengumuman' LIMIT 1";
|
||||
$db->runQuery($s);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
$response=array();
|
||||
$response["data"] = array();
|
||||
|
||||
$detail['judul']=str_replace('"', '`', $r['judul']);
|
||||
$detail['isi']=str_replace('"', '`', $r['isi']);
|
||||
$detail['tgl']=tanggalIndo($r['tgl'],'j F Y');
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Data Loaded";
|
||||
array_push($response["data"], $detail);
|
||||
|
||||
$checknotif="SELECT COUNT(id) as jlh FROM tmp_notif WHERE idkonten='$id_pengumuman' AND idProdi='$id_prodi' AND iduser='$iduser' AND typeuser='$jenis' AND jenis='P'";
|
||||
$db->runQuery($checknotif);
|
||||
$r=$db->dbFetch();
|
||||
if($r['jlh']==0){
|
||||
$db->runQuery("INSERT INTO tmp_notif SET idkonten='$id_pengumuman', idProdi='$id_prodi',iduser='$iduser',typeuser='$jenis',jenis='P', `date`=NOW()");
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Data Pengumuman Tidak Ditemukan";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request act not found";
|
||||
echo json_encode($response);
|
||||
break;
|
||||
}
|
||||
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
?>
|
||||
874
client_api/praoutline.php
Normal file
874
client_api/praoutline.php
Normal file
@@ -0,0 +1,874 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include ("../inc/helper.php");
|
||||
include ("../inc/gcm_helper.php");
|
||||
include ("../inc/konfigurasi.php");
|
||||
include ("../inc/db.pdo.class.php");
|
||||
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
header('Content-Type: application/json');
|
||||
if($_POST){
|
||||
switch($_POST['act']){
|
||||
|
||||
case 'cari':
|
||||
//pencarian draft praoutline
|
||||
$key=$_POST['keyword'];
|
||||
$prodi=$_POST['idprodi'];
|
||||
$pecah=explode(" ", $key);
|
||||
$jpecah=count($pecah);
|
||||
/*if($jpecah==1){*/
|
||||
if(ctype_alnum($key)){
|
||||
$by=" tp.nim LIKE '%$key%' OR tp.judul LIKE '%$key%' ";
|
||||
}else{
|
||||
$newkey=str_replace("'", "\'", $key);
|
||||
$by=" tp.nim LIKE '%$key%' OR tp.judul LIKE '%$newkey%' ";
|
||||
}
|
||||
|
||||
/*}else{
|
||||
$by="";
|
||||
if(ctype_alnum($key)){
|
||||
for($x=0;$x<$jpecah;$x++){
|
||||
if($x==0){
|
||||
$by.=" tp.nim LIKE '%$key%' OR tp.judul like '%$pecah[$x]%' ";
|
||||
}else{
|
||||
$by.=" tp.nim LIKE '%$key%' OR OR tp.judul like '%$pecah[$x]%' ";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$newpecah=str_replace("'", "\'", $pecah[$x]);
|
||||
for($x=0;$x<$jpecah;$x++){
|
||||
if($x==0){
|
||||
$by.=" tp.nim LIKE '%$key%' OR tp.judul like '%$newpecah[$x]%' ";
|
||||
}else{
|
||||
$by.=" tp.nim LIKE '%$key%' OR OR tp.judul like '%$newpecah[$x]%' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
$cari="SELECT
|
||||
tp.id,
|
||||
tp.nim,
|
||||
tp.deskripsi,
|
||||
tm.nmLengkap as nama,
|
||||
tp.judul,
|
||||
tp.tgl_upload,
|
||||
tp.wkt_upload,
|
||||
tp.status_usulan,
|
||||
COUNT(tr.id) as jlhreview,
|
||||
COUNT(if(tr.jenis_review='0',1,null)) as komentar,
|
||||
COUNT(if(tr.jenis_review='1',1,null)) as putusan,
|
||||
COUNT(if(tr.putusan='1',1,null)) as setuju,
|
||||
count(if(tr.putusan='0',1,null)) as tdk_setuju
|
||||
FROM tbpraoutline tp
|
||||
LEFT JOIN tbreview tr ON (tp.id=tr.idpraoutline)
|
||||
JOIN tbmhs tm ON (tp.nim=tm.nim)
|
||||
WHERE $by GROUP BY tp.id";
|
||||
|
||||
$db->runQuery($cari);
|
||||
if($db->dbRows()>0){
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
while($rcari=$db->dbFetch()){
|
||||
$draft=array();
|
||||
|
||||
if($rcari['status_usulan']==0){
|
||||
$draft['status']='Dalam Proses';
|
||||
}else if($rcari['status_usulan']==1){
|
||||
$draft['status']='Judul Diterima';
|
||||
}else if($rcari['status_usulan']==2){
|
||||
$draft['status']='Judul Ditolak';
|
||||
}else if($rcari['status_usulan']==3){
|
||||
$draft['status']='Judul Gugur';
|
||||
}
|
||||
|
||||
$draft['iddraft']=$rcari['id'];
|
||||
$draft['judul']=$rcari['judul'];
|
||||
$draft['tgl']=tanggalIndo($rcari['tgl_upload'],'j F Y');
|
||||
$draft['setuju']=$rcari['setuju']." Setuju";
|
||||
$draft['tolak']=$rcari['tdk_setuju']." Tidak Setuju";
|
||||
$draft['nim']=$rcari['nim'];
|
||||
$draft['namamhs']=$rcari['nama'];
|
||||
$draft['jlhrev']=$rcari['jlhreview'];
|
||||
|
||||
array_push($response["data"], $draft);
|
||||
}
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Sukses";
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Data Tidak Ada";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
//menampilkan informasi draft praoutline
|
||||
case 'lihat':
|
||||
$id=$_POST['iddraft'];
|
||||
$username=$_POST['username'];
|
||||
$iduser=$_POST['iduser'];
|
||||
$jenisuser=$_POST['jenisuser'];
|
||||
$prodi=$_POST['idprodi'];
|
||||
if($id!=""){
|
||||
$q="SELECT
|
||||
tp.id,
|
||||
tp.nim,
|
||||
tp.deskripsi,
|
||||
tm.nmLengkap as nama,
|
||||
tp.judul,
|
||||
tp.tgl_upload,
|
||||
tp.wkt_upload,
|
||||
tp.berkas,
|
||||
tp.status_usulan,
|
||||
tm.foto,
|
||||
COUNT(tr.id) as jlhreview,
|
||||
COUNT(if(tr.jenis_review='0',1,null)) as komentar,
|
||||
COUNT(if(tr.jenis_review='1',1,null)) as putusan,
|
||||
COUNT(if(tr.putusan='1',1,null)) as setuju,
|
||||
COUNT(if(tr.putusan='0',1,null)) as tdk_setuju
|
||||
FROM tbpraoutline tp
|
||||
LEFT JOIN tbreview tr ON (tp.id=tr.idpraoutline)
|
||||
JOIN tbmhs tm ON (tp.nim=tm.nim)
|
||||
WHERE tp.id='$id'";
|
||||
|
||||
$db->runQuery($q);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
|
||||
if($r['status_usulan']==0){
|
||||
$draft['status']='Dalam Proses';
|
||||
}else if($r['status_usulan']==1){
|
||||
$draft['status']='Judul Diterima';
|
||||
}else if($r['status_usulan']==2){
|
||||
$draft['status']='Judul Ditolak';
|
||||
}else if($r['status_usulan']==3){
|
||||
$draft['status']='Judul Gugur';
|
||||
}
|
||||
|
||||
$draft['iddraft']=$r['id'];
|
||||
$draft['idprodi']=$r['idProdi'];
|
||||
$draft['judul']=$r['judul'];
|
||||
$draft['berkas']=DOMAIN_UTAMA."/download.php?doc_id=".$r['id'];
|
||||
$draft['tgl']=tanggalIndo($r['tgl_upload'],'j F Y');
|
||||
$draft['setuju']=$r['setuju']." Setuju";
|
||||
$draft['tolak']=$r['tdk_setuju']." Tidak Setuju";
|
||||
$draft['jlhreview']=$r['jlhreview']." Tanggapan";
|
||||
$draft['nim']=$r['nim'];
|
||||
$draft['kdstatus']=$r['status_usulan'];
|
||||
$draft['namamhs']=$r['nama'];
|
||||
$draft['foto']=LINK_GAMBAR.$r['foto'];
|
||||
|
||||
$q_rekap_hasil="SELECT *,
|
||||
(SELECT nmLengkap FROM tbdosen WHERE tbdosen.nip=pemb1) as dpemb1,
|
||||
(SELECT nmLengkap FROM tbdosen WHERE tbdosen.nip=pemb2) as dpemb2,
|
||||
(SELECT nmLengkap FROM tbdosen WHERE tbdosen.nip=peng1) as dpeng1,
|
||||
(SELECT nmLengkap FROM tbdosen WHERE tbdosen.nip=peng2) as dpeng2
|
||||
FROM tbrekaphasil where kep_akhir='".$r['status_usulan']."' AND idpraoutline='".$r['id']."' LIMIT 1";
|
||||
$db->runQuery($q_rekap_hasil);
|
||||
if($db->dbRows()>0){
|
||||
$rkh=$db->dbFetch();
|
||||
$draft['kep_judul']=$rkh['judul_final'];
|
||||
$draft['kep_pemb1']=$rkh['dpemb1'];
|
||||
$draft['kep_pemb2']=$rkh['dpemb2'];
|
||||
$draft['kep_peng1']=$rkh['dpeng1'];
|
||||
$draft['kep_peng2']=$rkh['dpeng2'];
|
||||
$draft['kep_tgl']=tanggalIndo($rkh['tgl_kep']." ".$rkh['wkt_kep'],'j F Y H:i');
|
||||
$draft['kep_ket']=($rkh['ket']!="")?$rkh['ket']:"Tidak Ada.";
|
||||
$draft['kep_smt']=$rkh['semester'];
|
||||
$draft['kep_thn_ajaran']=$rkh['tahun_ajaran'];
|
||||
}
|
||||
|
||||
//------------
|
||||
//aksi untuk insert ke tmp_notif dan tmp_notif_r untuk judul terbaru dan pemberitahuan terbaru
|
||||
if($jenisuser=="K"){
|
||||
$jenisuser="D";
|
||||
}
|
||||
$notifr="UPDATE tmp_notif_r SET `read`='Y' WHERE idkonten='$id' AND idProdi='$prodi' AND user='$username' AND jns_usr='$jenisuser' AND `read`='N'";
|
||||
$db->runQuery($notifr);
|
||||
|
||||
$checknotif="SELECT COUNT(id) as jlh FROM tmp_notif WHERE idkonten='$id' AND idProdi='$prodi' AND iduser='$iduser' AND typeuser='$jenisuser' AND jenis='J'";
|
||||
$db->runQuery($checknotif);
|
||||
$r=$db->dbFetch();
|
||||
if($r['jlh']==0){
|
||||
$db->runQuery("INSERT INTO tmp_notif SET idkonten='$id', idProdi='$prodi',iduser='$iduser',typeuser='$jenisuser',jenis='J', `date`='".NOW."'");
|
||||
}
|
||||
//-----------
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Sukses ";
|
||||
array_push($response["data"], $draft);
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Data Tidak Ada";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
//menampilka data review dari draft praoutline
|
||||
case 'review':
|
||||
$id=$_POST['iddraft'];
|
||||
$prodi=$_POST['idprodi'];
|
||||
if($id!=""){
|
||||
$rev="SELECT tr.*,td.nmLengkap as nmDosen,
|
||||
td.foto as ftdosen,
|
||||
tm.nmLengkap as nmMhs,
|
||||
tm.foto as ftmhs FROM
|
||||
tbreview tr
|
||||
LEFT JOIN tbdosen td ON (td.nip=tr.reviewer)
|
||||
LEFT JOIN tbmhs tm ON (tm.nim=tr.reviewer)
|
||||
WHERE tr.idProdi='$prodi'
|
||||
GROUP BY tr.id HAVING tr.idpraoutline='".$id."'
|
||||
ORDER BY id DESC";
|
||||
$db->runQuery($rev);
|
||||
if($db->dbRows()>0){
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
|
||||
while($r=$db->dbFetch()){
|
||||
$review=array();
|
||||
|
||||
if($r['putusan']=='1'){
|
||||
$review['putusan']="Setuju";
|
||||
}else if($r['putusan']=='0'){
|
||||
$review['putusan']="Tidak Setuju";
|
||||
}else{
|
||||
$review['putusan']="";
|
||||
}
|
||||
|
||||
$review['revid']=$r['id'];
|
||||
$review['reviewer']=($r['nmMhs']!="")?$r['nmMhs']:$r['nmDosen'];
|
||||
$review['revtext']=strip_tags(bbcode_quote($r['review_text'],"webapi"));
|
||||
// $review['revwebtext']=bbcode_quote(strip_tags($r['review_text']));
|
||||
$review['revwebtext']=bbcode_quote(($r['review_text']));
|
||||
$review['revtgl']=tanggalIndo($r['tgl']." ".$r['wkt'],'j F Y H:i');
|
||||
|
||||
array_push($response["data"], $review);
|
||||
}
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Sukses";
|
||||
|
||||
echo json_encode($response);
|
||||
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Data Tidak Ada";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
//aksi post tanggapan / review untuk draft praoutline
|
||||
case 'postrev':
|
||||
$idpraoutline=$_POST['iddraft'];
|
||||
$reviewer=$_POST['reviewer'];
|
||||
$prodi=$_POST['prodi'];
|
||||
$jenisuser=$_POST['juser'];
|
||||
$nama_reviewer="";
|
||||
$putusan=$_POST['putusan'];
|
||||
if($putusan!=""){
|
||||
$jenisrev=" jenis_review='1', ";
|
||||
}else{
|
||||
$jenisrev=" jenis_review='0', ";
|
||||
if($putusan!=""){
|
||||
$kep="jenis_review='1', putusan='".$putusan."',";
|
||||
$check="SELECT id FROM tbreview WHERE idProdi='$prodi' AND idpraoutline='$idpraoutline'
|
||||
AND reviewer='$reviewer' AND (putusan IS NOT NULL AND putusan <> '')";
|
||||
$db->runQuery($check);
|
||||
if($db->dbRows()>0){
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Maaf, Anda Telah Memberikan Keputusan pada Draft Praoutline ini";
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
$revtext=$_POST['revtext'];
|
||||
if(ctype_digit($idpraoutline)){
|
||||
$insert="INSERT INTO tbreview SET
|
||||
idpraoutline='".$idpraoutline."',
|
||||
idProdi='".$prodi."',
|
||||
reviewer='".$reviewer."',
|
||||
review_text='".$revtext."',
|
||||
putusan='".$putusan."',
|
||||
$jenisrev
|
||||
tgl='".CURDATE."',
|
||||
wkt='".CURTIME."'";
|
||||
|
||||
if($db->runQuery($insert)){
|
||||
$response["success"] = "1";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Sukses Menambahkan Tanggapan";
|
||||
echo json_encode($response);
|
||||
|
||||
if($jenisuser=="M"){
|
||||
$nmq="SELECT nmLengkap FROM tbmhs WHERE nim='$reviewer'";
|
||||
$jenis=" jns_usr='D', ";
|
||||
}else{
|
||||
$nmq="SELECT nmLengkap FROM tbdosen WHERE nip='$reviewer'";
|
||||
$jenis=" jns_usr='M', ";
|
||||
}
|
||||
$db->runQuery($nmq);
|
||||
if($db->dbRows()>0){
|
||||
$x=$db->dbFetch();
|
||||
$nama_reviewer=$x['nmLengkap'];
|
||||
}
|
||||
|
||||
$notif="SELECT DISTINCT(reviewer),gs.regid
|
||||
FROM tbreview
|
||||
LEFT JOIN gcm_service gs ON (gs.iduser=tbreview.reviewer)
|
||||
WHERE reviewer<>'$reviewer' AND idpraoutline='$idpraoutline'";
|
||||
//echo $notif;
|
||||
$db->runQuery($notif);
|
||||
if($db->dbRows()>0){
|
||||
$revnama=array();
|
||||
$registrationid=array();
|
||||
while($r=$db->dbFetch()){
|
||||
$revnama[]=$r['reviewer'];
|
||||
array_push($registrationid, $r['regid']);
|
||||
}
|
||||
if(count($revnama)>0){
|
||||
for($ss=0;$ss<count($revnama);$ss++){
|
||||
$setnotif="INSERT INTO tmp_notif_r SET
|
||||
idkonten='$idpraoutline',
|
||||
idProdi='".$prodi."',
|
||||
user='".$revnama[$ss]."',
|
||||
$jenis
|
||||
tgl='".NOW."',
|
||||
msg='".$nama_reviewer." (".$reviewer.") Menambahkan Tanggapan baru',
|
||||
`read`='N'";
|
||||
|
||||
$db->runQuery($setnotif);
|
||||
}
|
||||
//gcm
|
||||
//-----------------------------------------------------------------------------
|
||||
$isipesan=$nama_reviewer. " Menambahkan Tanggapan Baru";
|
||||
$pesan=json_encode(array("jenisnotif"=>"P","pesan"=>$isipesan));
|
||||
$message = array("spota" => $pesan);
|
||||
|
||||
sendPushNotificationToGCM($registrationid, $message);
|
||||
//--------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Gagal Menambahkan Tanggapan, DBError";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found la";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
//aksi close draft praoutline
|
||||
case 'closedraft':
|
||||
$idpraoutline=$_POST['idpraoutline'];
|
||||
$nim=$_POST['nim'];
|
||||
$putusan=$_POST['putusan'];
|
||||
$keterangan=$_POST['ket'];
|
||||
$idprodi=$_POST['idprodi'];
|
||||
switch ($putusan) {
|
||||
case '1':
|
||||
$q1="INSERT INTO tbrekaphasil SET
|
||||
idpraoutline='".$idpraoutline."',
|
||||
idProdi='".$idprodi."',
|
||||
nim='".$nim."',
|
||||
kep_akhir='".$putusan."',
|
||||
judul_final='".$_POST['judulfinal']."',
|
||||
pemb1='".$_POST['pemb1']."',
|
||||
pemb2='".$_POST['pemb2']."',
|
||||
peng1='".$_POST['peng1']."',
|
||||
peng2='".$_POST['peng2']."',
|
||||
tgl_kep='".CURDATE."',
|
||||
wkt_kep='".CURTIME."',
|
||||
semester=(SELECT `values` FROM web_setting WHERE idProdi='".$idprodi."' AND `name`='smt'),
|
||||
tahun_ajaran=(SELECT `values` FROM web_setting WHERE idProdi='".$idprodi."' AND `name`='thn_ajaran'),
|
||||
ket='".$keterangan."'";
|
||||
|
||||
$notif="INSERT INTO tmp_notif_r SET
|
||||
idkonten='$idpraoutline',
|
||||
idProdi='".$idprodi."',
|
||||
user='".$nim."',
|
||||
jns_usr='M',
|
||||
tgl='".NOW."',
|
||||
msg='Usulan Draft Anda Diterima.',
|
||||
`read`='N'";
|
||||
$isipesan="Selamat, Draft Praoutline Yang Anda Ajukan Disetujui";
|
||||
break;
|
||||
|
||||
case '2':
|
||||
$q1="INSERT INTO tbrekaphasil SET
|
||||
idpraoutline='".$idpraoutline."',
|
||||
idProdi='".$idprodi."',
|
||||
nim='".$nim."',
|
||||
kep_akhir='".$putusan."',
|
||||
tgl_kep='".CURDATE."',
|
||||
wkt_kep='".CURTIME."',
|
||||
semester=(SELECT `values` FROM web_setting WHERE idProdi='".$idprodi."' AND `name`='smt'),
|
||||
tahun_ajaran=(SELECT `values` FROM web_setting WHERE idProdi='".$idprodi."' AND `name`='thn_ajaran'),
|
||||
ket='".$keterangan."'";
|
||||
|
||||
$notif="INSERT INTO tmp_notif_r SET
|
||||
idkonten='$idpraoutline',
|
||||
idProdi='".$idprodi."',
|
||||
user='".$nim."',
|
||||
jns_usr='M',
|
||||
tgl='".NOW."',
|
||||
msg='Usulan Draft Anda Ditolak.',
|
||||
`read`='N'";
|
||||
$isipesan="Maaf, Draft Praoutline Yang Anda Ajukan Tidak Disetujui";
|
||||
break;
|
||||
|
||||
case '3':
|
||||
$q1="INSERT INTO tbrekaphasil SET
|
||||
idpraoutline='".$idpraoutline."',
|
||||
idProdi='".$idprodi."',
|
||||
nim='".$nim."',
|
||||
kep_akhir='".$putusan."',
|
||||
tgl_kep='".CURDATE."',
|
||||
wkt_kep='".CURTIME."',
|
||||
semester=(SELECT `values` FROM web_setting WHERE idProdi='".$idprodi."' AND `name`='smt'),
|
||||
tahun_ajaran=(SELECT `values` FROM web_setting WHERE idProdi='".$idprodi."' AND `name`='thn_ajaran'),
|
||||
ket='".$keterangan."'";
|
||||
|
||||
$notif="INSERT INTO tmp_notif_r SET
|
||||
idkonten='$idpraoutline',
|
||||
idProdi='".$idprodi."',
|
||||
user='".$nim."',
|
||||
jns_usr='M',
|
||||
tgl='".NOW."',
|
||||
msg='Usulan Draft Anda Gugur.',
|
||||
`read`='N'";
|
||||
$isipesan="Maaf, Draft Praoutline Yang Anda Ajukan Gugur";
|
||||
break;
|
||||
}
|
||||
|
||||
$q2="UPDATE tbpraoutline SET status_usulan='".$putusan."' WHERE id='".$idpraoutline."' ";
|
||||
if($db->runQuery($q1)){
|
||||
echo json_encode(array("success"=>"1","data"=>null,"msg"=>"Putusan Draft Praoutline Sukses"));
|
||||
$db->runQuery($q2);
|
||||
$db->runQuery($notif);
|
||||
//gcm
|
||||
//-----------------------------------------------------------------------------
|
||||
$g="SELECT regid FROM gcm_service WHERE jenisuser IN('M') AND iduser='$nim'";
|
||||
$db->runQuery($g);
|
||||
$registrationid=array();
|
||||
while($r=$db->dbFetch()){
|
||||
array_push($registrationid, $r['regid']);
|
||||
}
|
||||
$pesan=json_encode(array("jenisnotif"=>"P","pesan"=>$isipesan));
|
||||
$message = array("spota" => $pesan);
|
||||
|
||||
sendPushNotificationToGCM($registrationid, $message);
|
||||
//--------------------------------------------------------------------------------
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","data"=>null,"msg"=>"Aksi Gagal."));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//aksi mengambil id draft praoutline aktif (untuk mahasiswa)
|
||||
case 'getid':
|
||||
$nim=$_POST['nim'];
|
||||
if(ctype_alnum($nim)){
|
||||
$cq="SELECT id FROM tbpraoutline WHERE nim='$nim' ORDER BY tgl_upload DESC, wkt_upload DESC LIMIT 1";
|
||||
$db->runQuery($cq);
|
||||
if($db->dbRows()>0){
|
||||
$d=$db->dbFetch();
|
||||
$idpra=$d['id'];
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["data"] = $idpra;
|
||||
$response["msg"] = "Sukses";
|
||||
echo json_encode($response);
|
||||
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Anda Belum Mengupload Draft Praoutline, Silakan Upload Terlebih Dahulu Pada Website SPOTA Teknik Informatika Untan.";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
//menampilkan daftar draft praoutline yang baru di upload mahasiswa (untuk dosen)
|
||||
case 'new':
|
||||
$iduser=$_POST['iddosen'];
|
||||
$prodi=$_POST['idprodi'];
|
||||
$new="SELECT
|
||||
tp.id,
|
||||
tp.nim,
|
||||
tp.deskripsi,
|
||||
tm.nmLengkap as nama,
|
||||
tp.judul,
|
||||
tp.tgl_upload,
|
||||
tp.wkt_upload,
|
||||
tp.status_usulan,
|
||||
COUNT(tr.id) as jlhreview,
|
||||
COUNT(if(tr.jenis_review='0',1,null)) as komentar,
|
||||
COUNT(if(tr.jenis_review='1',1,null)) as putusan,
|
||||
COUNT(if(tr.putusan='1',1,null)) as setuju,
|
||||
count(if(tr.putusan='0',1,null)) as tdk_setuju
|
||||
FROM tbpraoutline tp
|
||||
LEFT JOIN tbreview tr ON (tp.id=tr.idpraoutline)
|
||||
JOIN tbmhs tm ON (tp.nim=tm.nim)
|
||||
WHERE tp.idProdi='$prodi' AND tp.id NOT IN (SELECT idkonten FROM tmp_notif WHERE iduser='$iduser' AND typeuser IN ('D','K'))
|
||||
AND tp.status_usulan='0'
|
||||
GROUP BY tp.id";
|
||||
|
||||
$db->runQuery($new);
|
||||
if($db->dbRows()>0){
|
||||
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
while($r=$db->dbFetch()){
|
||||
$draft=array();
|
||||
if($r['status_usulan']==0){
|
||||
$draft['status']='Dalam Proses';
|
||||
}else if($r['status_usulan']==1){
|
||||
$draft['status']='Judul Diterima';
|
||||
}else if($r['status_usulan']==2){
|
||||
$draft['status']='Judul Ditolak';
|
||||
}else if($r['status_usulan']==3){
|
||||
$draft['status']='Judul Gugur';
|
||||
}
|
||||
|
||||
$draft['iddraft']=$r['id'];
|
||||
$draft['idprodi']=$r['idProdi'];
|
||||
$draft['judul']=$r['judul'];
|
||||
$draft['berkas']=DOMAIN_UTAMA."/download.php?doc_id=".$r['id'];
|
||||
$draft['tgl']=tanggalIndo($r['tgl_upload'],'j F Y');
|
||||
$draft['setuju']=$r['setuju']." Setuju";
|
||||
$draft['tolak']=$r['tdk_setuju']." Tidak Setuju";
|
||||
$draft['jlhreview']=$r['jlhreview']." Tanggapan";
|
||||
$draft['nim']=$r['nim'];
|
||||
$draft['kdstatus']=$r['status_usulan'];
|
||||
$draft['namamhs']=$r['nama'];
|
||||
|
||||
array_push($response["data"], $draft);
|
||||
}
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Sukses";
|
||||
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "1";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Data Tidak Ada";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
//menampilkan daftar draft praoutline yang siap di close dari batas minimum jumlah setuju
|
||||
case 'accepted':
|
||||
$prodi=$_POST['idprodi'];
|
||||
$new="SELECT
|
||||
tp.id,
|
||||
tp.nim,
|
||||
tp.deskripsi,
|
||||
tm.nmLengkap as nama,
|
||||
tp.judul,
|
||||
tp.tgl_upload,
|
||||
tp.wkt_upload,
|
||||
tp.status_usulan,
|
||||
COUNT(tr.id) as jlhreview,
|
||||
COUNT(if(tr.jenis_review='0',1,null)) as komentar,
|
||||
COUNT(if(tr.jenis_review='1',1,null)) as putusan,
|
||||
COUNT(if(tr.putusan='1',1,null)) as setuju,
|
||||
count(if(tr.putusan='0',1,null)) as tdk_setuju
|
||||
FROM tbpraoutline tp
|
||||
LEFT JOIN tbreview tr ON (tp.id=tr.idpraoutline)
|
||||
JOIN tbmhs tm ON (tp.nim=tm.nim)
|
||||
WHERE tp.idProdi='$prodi' AND tp.status_usulan='0'
|
||||
GROUP BY tp.id
|
||||
HAVING (COUNT(if(tr.putusan='1',1,null))) >= (SELECT `values` FROM web_setting WHERE `name`='min_close' AND idProdi='$prodi')";
|
||||
|
||||
$db->runQuery($new);
|
||||
if($db->dbRows()>0){
|
||||
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
while($r=$db->dbFetch()){
|
||||
$draft=array();
|
||||
if($r['status_usulan']==0){
|
||||
$draft['status']='Dalam Proses';
|
||||
}else if($r['status_usulan']==1){
|
||||
$draft['status']='Judul Diterima';
|
||||
}else if($r['status_usulan']==2){
|
||||
$draft['status']='Judul Ditolak';
|
||||
}else if($r['status_usulan']==3){
|
||||
$draft['status']='Judul Gugur';
|
||||
}
|
||||
|
||||
$draft['iddraft']=$r['id'];
|
||||
$draft['idprodi']=$r['idProdi'];
|
||||
$draft['judul']=$r['judul'];
|
||||
$draft['berkas']=DOMAIN_UTAMA."/download.php?doc_id=".$r['id'];
|
||||
$draft['tgl']=tanggalIndo($r['tgl_upload'],'j F Y');
|
||||
$draft['setuju']=$r['setuju']." Setuju";
|
||||
$draft['tolak']=$r['tdk_setuju']." Tidak Setuju";
|
||||
$draft['jlhreview']=$r['jlhreview']." Tanggapan";
|
||||
$draft['nim']=$r['nim'];
|
||||
$draft['kdstatus']=$r['status_usulan'];
|
||||
$draft['namamhs']=$r['nama'];
|
||||
|
||||
array_push($response["data"], $draft);
|
||||
}
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Sukses";
|
||||
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "1";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Data Tidak Ada";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
//menampilkan daftar draft praoutline yang pernah di komentari/ditanggapi oleh dosen
|
||||
case 'history':
|
||||
$nipdosen=$_POST['nip'];
|
||||
$prodi=$_POST['idprodi'];
|
||||
//$optional="(SELECT CONCAT(tgl," ",wkt)FROM tbreview WHERE reviewer='$nipdosen' AND idpraoutline=tp.id ORDER BY tgl DESC,wkt DESC LIMIT 1)lastcomment,";
|
||||
$history="SELECT
|
||||
tp.id,
|
||||
tp.nim,
|
||||
tp.deskripsi,
|
||||
tm.nmLengkap as nama,
|
||||
tp.judul,
|
||||
tp.tgl_upload,
|
||||
tp.wkt_upload,
|
||||
tp.berkas,
|
||||
tp.status_usulan,
|
||||
COUNT(tr.id) as jlhreview,
|
||||
COUNT(if(tr.jenis_review='0',1,null)) as komentar,
|
||||
COUNT(if(tr.jenis_review='1',1,null)) as putusan,
|
||||
COUNT(if(tr.putusan='1',1,null)) as setuju,
|
||||
COUNT(if(tr.putusan='0',1,null)) as tdk_setuju
|
||||
FROM tbpraoutline tp
|
||||
LEFT JOIN tbreview tr ON (tp.id=tr.idpraoutline)
|
||||
JOIN tbmhs tm ON (tp.nim=tm.nim)
|
||||
WHERE tp.idProdi='$prodi' AND tp.id IN
|
||||
(SELECT idpraoutline
|
||||
FROM tbreview
|
||||
WHERE reviewer='$nipdosen')
|
||||
GROUP BY tp.id
|
||||
ORDER BY (select tgl FROM tbreview where reviewer='$nipdosen' AND idpraoutline=tp.id ORDER BY tgl DESC, wkt DESC LIMIT 1) DESC
|
||||
";
|
||||
|
||||
$db->runQuery($history);
|
||||
if($db->dbRows()>0){
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
while($r=$db->dbFetch()){
|
||||
$draft=array();
|
||||
|
||||
if($r['status_usulan']==0){
|
||||
$draft['status']='Dalam Proses';
|
||||
}else if($r['status_usulan']==1){
|
||||
$draft['status']='Judul Diterima';
|
||||
}else if($r['status_usulan']==2){
|
||||
$draft['status']='Judul Ditolak';
|
||||
}else if($r['status_usulan']==3){
|
||||
$draft['status']='Judul Gugur';
|
||||
}
|
||||
|
||||
$draft['iddraft']=$r['id'];
|
||||
$draft['idprodi']=$r['idProdi'];
|
||||
$draft['judul']=$r['judul'];
|
||||
$draft['berkas']=DOMAIN_UTAMA."/download.php?doc_id=".$r['id'];
|
||||
$draft['tgl']=tanggalIndo($r['tgl_upload'],'j F Y');
|
||||
$draft['setuju']=$r['setuju']." Setuju";
|
||||
$draft['tolak']=$r['tdk_setuju']." Tidak Setuju";
|
||||
$draft['jlhreview']=$r['jlhreview']." Tanggapan";
|
||||
$draft['nim']=$r['nim'];
|
||||
$draft['kdstatus']=$r['status_usulan'];
|
||||
$draft['namamhs']=$r['nama'];
|
||||
array_push($response["data"], $draft);
|
||||
}
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Sukses";
|
||||
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "1";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Data Tidak Ada";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
//menampilkan daftar draft praoutline yang pernah di komentari/ditanggapi oleh dosen
|
||||
case 'notreviewed':
|
||||
$nipdosen=$_POST['nip'];
|
||||
$prodi=$_POST['idprodi'];
|
||||
$notrev="SELECT
|
||||
tp.id,
|
||||
tp.nim,
|
||||
tp.deskripsi,
|
||||
tm.nmLengkap as nama,
|
||||
tp.judul,
|
||||
tp.tgl_upload,
|
||||
tp.wkt_upload,
|
||||
tp.berkas,
|
||||
tp.status_usulan,
|
||||
COUNT(tr.id) as jlhreview,
|
||||
COUNT(if(tr.jenis_review='0',1,null)) as komentar,
|
||||
COUNT(if(tr.jenis_review='1',1,null)) as putusan,
|
||||
COUNT(if(tr.putusan='1',1,null)) as setuju,
|
||||
COUNT(if(tr.putusan='0',1,null)) as tdk_setuju
|
||||
FROM tbpraoutline tp
|
||||
LEFT JOIN tbreview tr ON (tp.id=tr.idpraoutline)
|
||||
JOIN tbmhs tm ON (tp.nim=tm.nim)
|
||||
WHERE tp.idProdi='$prodi' AND tp.status_usulan='0' AND tp.id NOT IN
|
||||
(SELECT idpraoutline
|
||||
FROM tbreview
|
||||
WHERE reviewer='$nipdosen')
|
||||
GROUP BY tp.id";
|
||||
|
||||
$db->runQuery($notrev);
|
||||
if($db->dbRows()>0){
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
while($r=$db->dbFetch()){
|
||||
$draft=array();
|
||||
|
||||
if($r['status_usulan']==0){
|
||||
$draft['status']='Dalam Proses';
|
||||
}else if($r['status_usulan']==1){
|
||||
$draft['status']='Judul Diterima';
|
||||
}else if($r['status_usulan']==2){
|
||||
$draft['status']='Judul Ditolak';
|
||||
}else if($r['status_usulan']==3){
|
||||
$draft['status']='Judul Gugur';
|
||||
}
|
||||
|
||||
$draft['iddraft']=$r['id'];
|
||||
$draft['idprodi']=$r['idProdi'];
|
||||
$draft['judul']=$r['judul'];
|
||||
$draft['berkas']=DOMAIN_UTAMA."/download.php?doc_id=".$r['id'];
|
||||
$draft['tgl']=tanggalIndo($r['tgl_upload'],'j F Y');
|
||||
$draft['setuju']=$r['setuju']." Setuju";
|
||||
$draft['tolak']=$r['tdk_setuju']." Tidak Setuju";
|
||||
$draft['jlhreview']=$r['jlhreview']." Tanggapan";
|
||||
$draft['nim']=$r['nim'];
|
||||
$draft['kdstatus']=$r['status_usulan'];
|
||||
$draft['namamhs']=$r['nama'];
|
||||
array_push($response["data"], $draft);
|
||||
}
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Sukses";
|
||||
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "1";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Data Tidak Ada";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
//menampilkan daftar draft praoutline hasil keputusan dimana dosen menjadi salah satu bagian dari team.
|
||||
case 'keputusan':
|
||||
$nipdosen=$_POST['nip'];
|
||||
$prodi=$_POST['idprodi'];
|
||||
$kep="SELECT trh.*,
|
||||
(SELECT nmLengkap FROM tbdosen WHERE nip=trh.pemb1) as dpemb1,
|
||||
(SELECT nmLengkap FROM tbdosen WHERE nip=trh.pemb2) as dpemb2,
|
||||
(SELECT nmLengkap FROM tbdosen WHERE nip=trh.peng1) as dpeng1,
|
||||
(SELECT nmLengkap FROM tbdosen WHERE nip=trh.peng2) as dpeng2,
|
||||
(SELECT nmLengkap FROM tbmhs WHERE nim=trh.nim) as nm_mhs
|
||||
FROM tbrekaphasil trh
|
||||
WHERE trh.idProdi='$prodi' AND trh.kep_akhir='1' AND (trh.pemb1='$nipdosen' OR trh.pemb2='$nipdosen' OR trh.peng1='$nipdosen' OR trh.peng2='$nipdosen')
|
||||
ORDER BY trh.tgl_kep DESC, trh.wkt_kep DESC";
|
||||
|
||||
$db->runQuery($kep);
|
||||
if($db->dbRows()>0){
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
while($r=$db->dbFetch()){
|
||||
$draft=array();
|
||||
|
||||
if($r['pemb1']==$nipdosen){
|
||||
$draft['stat_sebagai']='Sebagai Pembimbing 1';
|
||||
}
|
||||
if($r['pemb2']==$nipdosen){
|
||||
$draft['stat_sebagai']='Sebagai Pembimbing 2';
|
||||
}
|
||||
if($r['peng1']==$nipdosen){
|
||||
$draft['stat_sebagai']='Sebagai Penguji 1';
|
||||
}
|
||||
if($r['peng2']==$nipdosen){
|
||||
$draft['stat_sebagai']='Sebagai Penguji 2';
|
||||
}
|
||||
|
||||
$draft['iddraft']=$r['idpraoutline'];
|
||||
$draft['idprodi']=$r['idProdi'];
|
||||
$draft['judul']=$r['judul_final'];
|
||||
$draft['tgl']=tanggalIndo($r['tgl_kep']." ".$r['wkt_kep'],'j F Y H:i');
|
||||
$draft['nim']=$r['nim'];
|
||||
$draft['namamhs']=$r['nm_mhs'];
|
||||
array_push($response["data"], $draft);
|
||||
}
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Sukses";
|
||||
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "1";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Data Tidak Ada";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
break;
|
||||
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
223
client_api/profil.php
Normal file
223
client_api/profil.php
Normal file
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include ("../inc/helper.php");
|
||||
include ("../inc/konfigurasi.php");
|
||||
include ("../inc/db.pdo.class.php");
|
||||
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
header('Content-Type: application/json');
|
||||
if($_POST){
|
||||
switch($_POST['act']){
|
||||
case 'lihat':
|
||||
$jenis=$_POST['j'];
|
||||
$id=$_POST['who'];
|
||||
$prodi=$_POST['idprodi'];
|
||||
|
||||
if(ctype_digit($id) && ctype_alnum($jenis)){
|
||||
if($jenis=="M"){
|
||||
$qu="SELECT * FROM tbmhs WHERE idMhs='$id' AND idProdi='$prodi' LIMIT 1";
|
||||
$db->runQuery($qu);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
$response=array();
|
||||
$response["profil"] = array();
|
||||
|
||||
$detail['nama_lengkap']=$r['nmLengkap'];
|
||||
$detail['id_user']=$r['idmhs'];
|
||||
$detail['id_prodi']=$r['idProdi'];
|
||||
$detail['username']=$r['nim'];
|
||||
$detail['email']=$r['email'];
|
||||
$detail['angkatan']=$r['thnmasuk'];
|
||||
$detail['foto']=LINK_GAMBAR.$r['foto'];
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Data Loaded";
|
||||
array_push($response["profil"], $detail);
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Load Data Failed (Data Not Found)";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else if($jenis=="D" OR $jenis=="K"){
|
||||
$qu="SELECT * FROM tbdosen WHERE idDosen='$id' AND idProdi='$prodi' LIMIT 1";
|
||||
$db->runQuery($qu);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
$response=array();
|
||||
$response["profil"] = array();
|
||||
|
||||
$detail['nama_lengkap']=$r['nmLengkap'];
|
||||
$detail['id_user']=$r['iddosen'];
|
||||
$detail['id_prodi']=$r['idProdi'];
|
||||
$detail['username']=$r['nip'];
|
||||
$detail['email']=$r['email'];
|
||||
$detail['nohp']=$r['nohp'];
|
||||
$detail['jabatan']=$r['jenis'];
|
||||
$detail['foto']=LINK_GAMBAR.$r['foto'];
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Data Loaded";
|
||||
array_push($response["profil"], $detail);
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Load Data Failed (Data Not Found)";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Load Data Failed";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Load Data Failed";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
$id=$_POST['id'];
|
||||
$jenis=$_POST['j'];
|
||||
|
||||
if(ctype_digit($id)){
|
||||
|
||||
$RandomNumber = rand(0, 9999999999);
|
||||
|
||||
if($jenis=="M"){
|
||||
$ImageName = "mhs";
|
||||
}else{
|
||||
$ImageName = "dosen";
|
||||
}
|
||||
$NewImageName = $ImageName.'_'.$RandomNumber.'.jpg';
|
||||
|
||||
if($_POST['pic']!=""){
|
||||
base64_to_jpeg($_POST['pic'],DIR_GAMBAR.$NewImageName);
|
||||
$foto=" foto='".$NewImageName."', ";
|
||||
}else{
|
||||
$foto="";
|
||||
}
|
||||
|
||||
|
||||
if($jenis=="M"){
|
||||
$oldpic="SELECT foto FROM tbmhs WHERE idmhs='$id'";
|
||||
$db->runQuery($oldpic);
|
||||
$rpic=$db->dbFetch();
|
||||
$gambarlama=$rpic['foto'];
|
||||
|
||||
$u="UPDATE tbmhs SET
|
||||
nmLengkap='".$_POST['nama']."',
|
||||
$foto
|
||||
email='".$_POST['email']."'
|
||||
WHERE idmhs='$id'";
|
||||
}else if($jenis=="D" OR $jenis=="K"){
|
||||
$oldpic="SELECT foto FROM tbdosen WHERE iddosen='$id'";
|
||||
$db->runQuery($oldpic);
|
||||
$rpic=$db->dbFetch();
|
||||
$gambarlama=$rpic['foto'];
|
||||
|
||||
$u="UPDATE tbdosen SET
|
||||
nmLengkap='".$_POST['nama']."',
|
||||
email='".$_POST['email']."',
|
||||
nohp='".$_POST['nohp']."',
|
||||
$foto
|
||||
jabatan='".$_POST['jabatan']."'
|
||||
WHERE iddosen='$id'";
|
||||
}
|
||||
|
||||
if($db->runQuery($u)){
|
||||
$response["success"] = "1";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Profil Berhasil Diupdate";
|
||||
if($_POST['pic']!=""){
|
||||
@unlink(DIR_GAMBAR.$gambarlama);
|
||||
}
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
@unlink(DIR_GAMBAR.$NewImageName);
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Gagal Update Data - ";
|
||||
echo json_encode($response);
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Sorry, Cant Process Your Request";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update_pwd':
|
||||
$id=$_POST['id'];
|
||||
$jenis=$_POST['j'];
|
||||
$pwdbaru=$_POST['pwdbaru'];
|
||||
$pwdlama=$_POST['pwdlama'];
|
||||
$u="";
|
||||
if(ctype_digit($id)){
|
||||
if($jenis=="M"){
|
||||
$s="SELECT password FROM tbmhs WHERE idmhs='$id' LIMIT 1";
|
||||
$db->runQuery($s);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
if($r['password']==md5($pwdlama)){
|
||||
$u="UPDATE tbmhs SET password='".md5($pwdbaru)."' WHERE idmhs='$id'";
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0",
|
||||
"profil"=>null,
|
||||
"msg"=>"Password Lama Tidak Sesuai"));
|
||||
}
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"Data Not Found"));
|
||||
}
|
||||
}else if($jenis=="D" OR $jenis=="K"){
|
||||
$s="SELECT password FROM tbdosen WHERE iddosen='$id' LIMIT 1";
|
||||
$db->runQuery($s);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
if($r['password']==md5($pwdlama)){
|
||||
$u="UPDATE tbdosen SET password='".md5($pwdbaru)."' WHERE iddosen='$id'";
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"Password Lama Tidak Sesuai"));
|
||||
}
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"Data Not Found"));
|
||||
}
|
||||
}
|
||||
|
||||
if($db->runQuery($u)){
|
||||
echo json_encode(array("success"=>"1","profil"=>null,"msg"=>"Ganti Password Berhasil"));
|
||||
}else{
|
||||
echo json_encode(array("success"=>"0","profil"=>null,"msg"=>"DBError")); }
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Sorry, Cant Process Your Request";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["profil"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
function base64_to_jpeg($base64_string, $output_file) {
|
||||
$ifp = fopen($output_file, "wb");
|
||||
|
||||
//$data = explode(',', $base64_string);
|
||||
|
||||
fwrite($ifp, base64_decode($base64_string));
|
||||
fclose($ifp);
|
||||
|
||||
return $output_file;
|
||||
}
|
||||
164
client_api/statistik.php
Normal file
164
client_api/statistik.php
Normal file
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include ("../inc/helper.php");
|
||||
include ("../inc/gcm_helper.php");
|
||||
include ("../inc/konfigurasi.php");
|
||||
include ("../inc/db.pdo.class.php");
|
||||
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
header('Content-Type: application/json');
|
||||
if($_POST){
|
||||
switch ($_POST['act']) {
|
||||
case 'praoutline':
|
||||
$prodi=$_POST['idprodi'];
|
||||
$smt=$_POST['smt'];
|
||||
|
||||
if($smt!=""){
|
||||
$filtersmt="AND tp.semester='".$smt."' ";
|
||||
}else{
|
||||
$filtersmt="AND tp.semester= (SELECT `values` FROM web_setting WHERE `name`='smt' AND idProdi='".$prodi."') ";
|
||||
}
|
||||
$qs="SELECT
|
||||
tp.semester,
|
||||
COUNT(if(tp.status_usulan='1',1,null)) as terima,
|
||||
COUNT(if(tp.status_usulan='2',1,null)) as tolak,
|
||||
COUNT(if(tp.status_usulan='3',1,null)) as gugur,
|
||||
COUNT(if(tp.status_usulan='0',1,null)) as proses,
|
||||
COUNT(tp.semester) as totaldraft
|
||||
FROM tbpraoutline tp
|
||||
WHERE tp.idProdi='$prodi' $filtersmt
|
||||
GROUP BY tp.semester";
|
||||
|
||||
//echo $qs;
|
||||
$db->runQuery($qs);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
|
||||
$stat['smt']=$r['semester'];
|
||||
$stat['jlhterima']=$r['terima'];
|
||||
$stat['jlhtolak']=$r['tolak'];
|
||||
$stat['jlhgugur']=$r['gugur'];
|
||||
$stat['jlhproses']=$r['proses'];
|
||||
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Statistik Draft Praoutline Berdasarkan Tgl Pengajuan Per Semester";
|
||||
array_push($response["data"], $stat);
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
|
||||
$stat['smt']=$smt;
|
||||
$stat['jlhterima']=0;
|
||||
$stat['jlhtolak']=0;
|
||||
$stat['jlhgugur']=0;
|
||||
$stat['jlhproses']=0;
|
||||
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Statistik Draft Praoutline Berdasarkan Tgl Pengajuan Per Semester";
|
||||
array_push($response["data"], $stat);
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'dosen':
|
||||
$nip=$_POST['nip'];
|
||||
$prodi=$_POST['idprodi'];
|
||||
$smt=$_POST['smt'];
|
||||
|
||||
if($smt!=""){
|
||||
$filtersmt="AND trh.semester='".$smt."' ";
|
||||
}else{
|
||||
$filtersmt="AND trh.semester= (SELECT `values` FROM web_setting WHERE `name`='smt' AND idProdi='".$prodi."') ";
|
||||
}
|
||||
|
||||
$q="SELECT td.nmLengkap,trh.semester,COUNT(if(trh.pemb1=td.nip,1,null)) as pemb1,
|
||||
COUNT(if(trh.pemb2=td.nip,1,null)) as pemb2,
|
||||
COUNT(if(trh.peng1=td.nip,1,null)) as peng1,
|
||||
COUNT(if(trh.peng2=td.nip,1,null)) as peng2
|
||||
FROM tbrekaphasil trh,tbdosen td
|
||||
WHERE td.nip='".$nip."' $filtersmt AND td.idProdi='".$prodi."'
|
||||
GROUP BY td.nip";
|
||||
|
||||
//echo $q;
|
||||
$db->runQuery($q);
|
||||
if($db->dbRows()>0){
|
||||
$r=$db->dbFetch();
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
|
||||
$stat['nip']=$nip;
|
||||
$stat['smt']=$r['semester'];
|
||||
$stat['pemb1']=$r['pemb1'];
|
||||
$stat['pemb2']=$r['pemb2'];
|
||||
$stat['peng1']=$r['peng1'];
|
||||
$stat['peng2']=$r['peng2'];
|
||||
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Statistik Dosen Per Semester";
|
||||
array_push($response["data"], $stat);
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
|
||||
$stat['nip']=$nip;
|
||||
$stat['smt']=$smt;
|
||||
$stat['pemb1']=0;
|
||||
$stat['pemb2']=0;
|
||||
$stat['peng1']=0;
|
||||
$stat['peng2']=0;
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Sukses";
|
||||
array_push($response["data"], $stat);
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'listsmt':
|
||||
$prodi=$_POST['idprodi'];
|
||||
$q="SELECT DISTINCT(semester) as smt FROM tbpraoutline
|
||||
WHERE idProdi='$prodi' ORDER BY semester DESC";
|
||||
$db->runQuery($q);
|
||||
if($db->dbRows()>0){
|
||||
$response=array();
|
||||
$response["data"]=array();
|
||||
while($s=$db->dbFetch()){
|
||||
$smt['smt']=$s['smt'];
|
||||
|
||||
array_push($response["data"], $smt);
|
||||
}
|
||||
|
||||
$response["success"] = "1";
|
||||
$response["msg"] = "Data found";
|
||||
echo json_encode($response);
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Data not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
$response["success"] = "0";
|
||||
$response["data"] = null;
|
||||
$response["msg"] = "Request not found";
|
||||
echo json_encode($response);
|
||||
}
|
||||
Reference in New Issue
Block a user