168 lines
3.6 KiB
PHP
168 lines
3.6 KiB
PHP
<?php
|
|
include('../koneksi.php');
|
|
$key=$_POST['key'];
|
|
|
|
if ($key=='simpan_torsatker') {
|
|
$id=$_POST['id'];
|
|
$tempat=$_POST['tempat'];
|
|
//$tgl_acara=$_POST['tgl_acara'];
|
|
$waktu_mulai=$_POST['waktu_mulai'];
|
|
$waktu_selesai=$_POST['waktu_selesai'];
|
|
$tujuan=$_POST['tujuan'];
|
|
$perencana_rapat=$_POST['perencana_rapat'];
|
|
|
|
|
|
$tgl_acara=$_POST['tgl_acara'];
|
|
$tgl_acara=str_replace('/','-',$tgl_acara);
|
|
$t=date('Y',strtotime($tgl_acara));
|
|
$b=date('m',strtotime($tgl_acara));
|
|
$h=date('d',strtotime($tgl_acara));
|
|
|
|
$sapi=$_POST['sapi'];
|
|
|
|
if ($sapi=='1') {
|
|
$cek_torsatker=pg_query("SELECT id FROM riwayat_kegiatan WHERE id='$id'");
|
|
$row_torsatker = pg_fetch_row($cek_torsatker);
|
|
if ($row_torsatker[0] > 0) {
|
|
$upd_torsatker = pg_query("UPDATE riwayat_kegiatan SET
|
|
tempat='$tempat',
|
|
tgl_acara='$t-$b-$h',
|
|
waktu_mulai='$waktu_mulai',
|
|
waktu_selesai='$waktu_selesai',
|
|
tujuan='$tujuan',
|
|
perencana_rapat='$perencana_rapat',
|
|
tanggal_pesan=NOW(),
|
|
st_pesan='Pending',
|
|
status_kegiatan_id='$sapi'
|
|
WHERE id='$id'");
|
|
} else {
|
|
$ins_torsatker = pg_query("INSERT into riwayat_kegiatan (
|
|
tempat,
|
|
tgl_acara,
|
|
waktu_mulai,
|
|
waktu_selesai,
|
|
tujuan,
|
|
perencana_rapat,
|
|
tanggal_pesan,
|
|
st_pesan,
|
|
status_kegiatan_id
|
|
) values (
|
|
'$tempat',
|
|
'$t-$b-$h',
|
|
'$waktu_mulai',
|
|
'$waktu_selesai',
|
|
'$tujuan',
|
|
'$perencana_rapat',
|
|
NOW(),
|
|
'Pending',
|
|
'$sapi'
|
|
)
|
|
");
|
|
}
|
|
} else {
|
|
$cek_torsatker=pg_query("SELECT id FROM riwayat_kegiatan WHERE id='$id'");
|
|
$row_torsatker = pg_fetch_row($cek_torsatker);
|
|
if ($row_torsatker[0] > 0) {
|
|
$upd_torsatker = pg_query("UPDATE riwayat_kegiatan SET
|
|
tempat='$tempat',
|
|
tgl_acara='$t-$b-$h',
|
|
waktu_mulai='$waktu_mulai',
|
|
waktu_selesai='$waktu_selesai',
|
|
tujuan='$tujuan',
|
|
perencana_rapat='$perencana_rapat',
|
|
tanggal_pesan=NOW(),
|
|
st_pesan='Pending',
|
|
status_kegiatan_id=NULL
|
|
WHERE id='$id'");
|
|
} else {
|
|
$ins_torsatker = pg_query("INSERT into riwayat_kegiatan (
|
|
tempat,
|
|
tgl_acara,
|
|
waktu_mulai,
|
|
waktu_selesai,
|
|
tujuan,
|
|
perencana_rapat,
|
|
tanggal_pesan,
|
|
st_pesan
|
|
) values (
|
|
'$tempat',
|
|
'$t-$b-$h',
|
|
'$waktu_mulai',
|
|
'$waktu_selesai',
|
|
'$tujuan',
|
|
'$perencana_rapat',
|
|
NOW(),
|
|
'Pending'
|
|
)
|
|
");
|
|
}
|
|
}
|
|
|
|
/*
|
|
$cek_torsatker=pg_query("SELECT id FROM riwayat_kegiatan WHERE id='$id'");
|
|
$row_torsatker = pg_fetch_row($cek_torsatker);
|
|
if ($row_torsatker[0] > 0) {
|
|
$upd_torsatker = pg_query("UPDATE riwayat_kegiatan SET
|
|
tempat='$tempat',
|
|
tgl_acara='$t-$b-$h',
|
|
waktu_mulai='$waktu_mulai',
|
|
waktu_selesai='$waktu_selesai',
|
|
tujuan='$tujuan',
|
|
perencana_rapat='$perencana_rapat',
|
|
tanggal_pesan=NOW(),
|
|
st_pesan='Pending',
|
|
status_kegiatan_id=NULL
|
|
WHERE id='$id'");
|
|
} else {
|
|
if ($sapi=='1') {
|
|
$ins_torsatker = pg_query("INSERT into riwayat_kegiatan (
|
|
tempat,
|
|
tgl_acara,
|
|
waktu_mulai,
|
|
waktu_selesai,
|
|
tujuan,
|
|
perencana_rapat,
|
|
tanggal_pesan,
|
|
st_pesan,
|
|
status_kegiatan_id
|
|
) values (
|
|
'$tempat',
|
|
'$t-$b-$h',
|
|
'$waktu_mulai',
|
|
'$waktu_selesai',
|
|
'$tujuan',
|
|
'$perencana_rapat',
|
|
NOW(),
|
|
'Pending',
|
|
'$sapi'
|
|
)
|
|
");
|
|
} else {
|
|
$ins_torsatker = pg_query("INSERT into riwayat_kegiatan (
|
|
tempat,
|
|
tgl_acara,
|
|
waktu_mulai,
|
|
waktu_selesai,
|
|
tujuan,
|
|
perencana_rapat,
|
|
tanggal_pesan,
|
|
st_pesan
|
|
) values (
|
|
'$tempat',
|
|
'$t-$b-$h',
|
|
'$waktu_mulai',
|
|
'$waktu_selesai',
|
|
'$tujuan',
|
|
'$perencana_rapat',
|
|
NOW(),
|
|
'Pending'
|
|
)
|
|
");
|
|
}
|
|
}*/
|
|
} else
|
|
if ($key=="delete_torsatker") {
|
|
$id=$_POST['id'];
|
|
$dl_torsatker=pg_query("DELETE FROM riwayat_kegiatan WHERE id='$id'");
|
|
}
|
|
?>
|