<?php

session_start();
include "../koneksi.php";
include "../fungsi.php";
require_once "../model/usulan_pi_model.php";
$obj = new UsulanPI_Model();
$obj->Record($_GET["id_usulan"]);
$obj->Delete();
header("location:../../?mod=pi_daftar_usulan");
//echo("Data usulan telah disimpan");
<?php

session_start();
include "../koneksi.php";
include "../fungsi.php";
require_once "../model/usulan_pi_model.php";
function something_wrong($what_is_wrong)
{
    echo "\n            <script type='text/javascript'>\n                window.parent.window.something_wrong(\"" . $what_is_wrong . "\");\n            </script>\n        ";
}
function success()
{
    echo "\n            <script type='text/javascript'>\n                window.parent.window.success();\n            </script>\n        ";
}
$obj = new UsulanPI_Model();
$obj->Record($_POST["id_usulan"]);
$obj->no_usulan = $_POST["no_usulan"];
$obj->tgl_usulan = $_POST["tgl_usulan"];
$obj->jabatan_ttd_usulan = $_POST["jabatan_ttd_usulan"];
$obj->nama_ttd_usulan = $_POST["nama_ttd_usulan"];
$obj->nip_ttd_usulan = $_POST["nip_ttd_usulan"];
$obj->id_pangkat_ttd_usulan = $_POST["id_pangkat_ttd_usulan"];
$validation_result = $obj->Validation();
if ($validation_result == "") {
    $obj->Update();
    success();
} else {
    something_wrong($validation_result);
}
//echo("Data usulan telah disimpan");
<!-- CONTROLLER -->
<script type="text/javascript">
<?php 
require_once "php/model/usulan_pi_model.php";
$pangkat = array();
$sql_pangkat = "SELECT * FROM ref_pangkat";
$res_pangkat = mysql_query($sql_pangkat);
while ($ds_pangkat = mysql_fetch_array($res_pangkat)) {
    $row_pangkat["id_pangkat"] = $ds_pangkat["id_pangkat"];
    $row_pangkat["gol_ruang"] = $ds_pangkat["gol_ruang"];
    $row_pangkat["pangkat"] = $ds_pangkat["pangkat"];
    array_push($pangkat, $row_pangkat);
}
echo "var pangkat = " . json_encode($pangkat) . ";\n";
$obj = new UsulanPI_Model();
$obj->Record($_GET["id_usulan"]);
$record["id_usulan"] = $obj->id_usulan;
$record["no_usulan"] = $obj->no_usulan;
$record["tgl_usulan"] = $obj->tgl_usulan;
$record["jabatan_ttd_usulan"] = $obj->jabatan_ttd_usulan;
$record["nama_ttd_usulan"] = $obj->nama_ttd_usulan;
$record["nip_ttd_usulan"] = $obj->nip_ttd_usulan;
$record["id_pangkat_ttd_usulan"] = $obj->id_pangkat_ttd_usulan;
echo "var record = " . json_encode($record) . ";\n";
?>
</script>
<!-- END OF CONTROLLER -->

<!-- JAVASCRIPT PAGE -->
<script type="text/javascript">
<?php

session_start();
include "../koneksi.php";
include "../fungsi.php";
require_once "../model/usulan_pi_model.php";
function something_wrong($what_is_wrong)
{
    echo "\n            <script type='text/javascript'>\n                window.parent.window.something_wrong(\"" . $what_is_wrong . "\");\n            </script>\n        ";
}
function success()
{
    echo "\n            <script type='text/javascript'>\n                window.parent.window.success();\n            </script>\n        ";
}
$obj = new UsulanPI_Model();
$obj->no_usulan = $_POST["no_usulan"];
$obj->tgl_usulan = $_POST["tgl_usulan"];
$obj->jabatan_ttd_usulan = $_POST["jabatan_ttd_usulan"];
$obj->nama_ttd_usulan = $_POST["nama_ttd_usulan"];
$obj->nip_ttd_usulan = $_POST["nip_ttd_usulan"];
$obj->id_pangkat_ttd_usulan = $_POST["id_pangkat_ttd_usulan"];
$obj->kode_skpd = $_SESSION["simpeg_kode_skpd"];
$obj->status = 1;
$obj->catatan = "";
$validation_result = $obj->Validation();
if ($validation_result == "") {
    $obj->Insert();
    success();
} else {
    something_wrong($validation_result);
}
<?php

session_start();
include "../koneksi.php";
include "../fungsi.php";
require_once "../model/usulan_pi_model.php";
$obj = new UsulanPI_Model();
$obj->Record($_GET["id_usulan"]);
$obj->status = 2;
$obj->Update();
header("location:../../?mod=pi_daftar_usulan");
//echo("Data usulan telah disimpan");