Ejemplo n.º 1
0
function Edit($TahunID, $ProdiID, $ProgramID, $md)
{
    if ($md == 0) {
        $jdl = "Edit Tahun Akademik";
        $w = GetFields('tahun', "ProdiID='{$ProdiID}' and ProgramID='{$ProgramID}' and TahunID", $TahunID, '*');
        $_prdnm = GetaField('prodi', "KodeID='" . KodeID . "' and ProdiID", $w['ProdiID'], 'Nama');
        $_prgnm = GetaField('program', "KodeID='" . KodeID . "' and ProgramID", $w['ProgramID'], 'Nama');
        $_prd = "<input type=hidden name='ProdiID' value='{$ProdiID}' /><sup>{$ProdiID}</sup> {$_prdnm}";
        $_prg = "<input type=hidden name='ProgramID' value='{$ProgramID}' /><sup>{$ProgramID}</sup> {$_prgnm}";
        $_thn = "<input type=hidden name='TahunID' value='{$w['TahunID']}'><b>{$w['TahunID']}</b>";
    } elseif ($md == 1) {
        $jdl = "Tambah Tahun Akademik";
        $w = array();
        $optprd = GetOption2('prodi', "concat(ProdiID, ' - ', Nama)", 'ProdiID', $ProdiID, "KodeID='" . KodeID . "'", 'ProdiID');
        $optprg = GetOption2('program', "concat(ProgramID, ' - ', Nama)", 'ProgramID', $ProgramID, "KodeID='" . KodeID . "'", 'ProgramID');
        $_prd = "<select id='ProdiID' name='ProdiID'>{$optprd}</select>";
        $_prg = "<select id='ProgramID' name='ProgramID'>{$optprg}</select>";
        $_thn = "<input type=text id='TahunID' name='TahunID' size=10 maxlength=10 />";
        $dt = "";
        $w['TglKuliahMulai'] = $dt;
        $w['TglKuliahSelesai'] = $dt;
        $w['TglKRSMulai'] = $dt;
        $w['TglKRSSelesai'] = $dt;
        $w['TglBayarMulai'] = $dt;
        $w['TglBayarSelesai'] = $dt;
        $w['TglUTSMulai'] = $dt;
        $w['TglUTSSelesai'] = $dt;
        $w['TglUASMulai'] = $dt;
        $w['TglUASSelesai'] = $dt;
        $w['TglCuti'] = $dt;
        $w['TglNilai'] = $dt;
        $w['SP'] = 'N';
        $w['NA'] = 'N';
    } else {
        die(ErrorMsg('Error', "Mode edit: {$md} tidak dikenali oleh sistem"));
    }
    // Parameters
    $optkuliahmulai = GetDateOption3($w['TglKuliahMulai'], 'TglKuliahMulai');
    $optkuliahselesai = GetDateOption3($w['TglKuliahSelesai'], 'TglKuliahSelesai');
    $optkrsmulai = GetDateOption3($w['TglKRSMulai'], 'TglKRSMulai');
    $optkrsselesai = GetDateOption3($w['TglKRSSelesai'], 'TglKRSSelesai');
    $optbayarmulai = GetDateOption3($w['TglBayarMulai'], 'TglBayarMulai');
    $optbayarselesai = GetDateOption3($w['TglBayarSelesai'], 'TglBayarSelesai');
    $optutsmulai = GetDateOption3($w['TglUTSMulai'], 'TglUTSMulai');
    $optutsselesai = GetDateOption3($w['TglUTSSelesai'], 'TglUTSSelesai');
    $optuasmulai = GetDateOption3($w['TglUASMulai'], 'TglUASMulai');
    $optuasselesai = GetDateOption3($w['TglUASSelesai'], 'TglUASSelesai');
    $optcuti = GetDateOption3($w['TglCuti'], 'TglCuti');
    $optnilai = GetDateOption3($w['TglNilai'], 'TglNilai');
    $_sp = $w['SP'] == 'Y' ? 'checked' : '';
    $_na = $w['NA'] == 'Y' ? 'checked' : '';
    // Tampilkan form
    echo "\r\n  \t<script>\r\n\tfunction getDateTime(ob){\r\n\t\tvar curDate = document.getElementById('alt'+ob).value;\r\n\t\tcurDate = curDate.replace('-','/');\r\n\t\tcurDate = curDate.replace('-','/');\r\n\t\tvar period = Date.parse(curDate);\r\n\t\treturn period;\r\n\t}\r\n\t\tfunction CheckKalender(){\r\n\t\t\tvar ProdiID = \$('#ProdiID').val();\r\n\t\t\tvar ProgramID = \$('#ProgramID').val();\r\n\t\t\tvar TahunID = \$('#TahunID').val();\r\n\t\t\tvar Nama = \$('#Nama').val();\r\n\t\t\tvar TglKuliahMulai = \$('#altTglKuliahMulai').val();\r\n\t\t\tvar TglKuliahSelesai = \$('#altTglKuliahSelesai').val();\r\n\t\t\tvar TglKRSMulai = \$('#altTglKRSMulai').val();\r\n\t\t\tvar TglKRSSelesai = \$('#altTglKRSSelesai').val();\r\n\t\t\tvar TglBayarMulai = \$('#altTglBayarMulai').val();\r\n\t\t\tvar TglBayarSelesai = \$('#altTglBayarSelesai').val();\r\n\t\t\tvar TglUTSMulai = \$('#altTglUTSMulai').val();\r\n\t\t\tvar TglUTSSelesai = \$('#altTglUTSSelesai').val();\r\n\t\t\tvar TglUASMulai = \$('#altTglUASMulai').val();\r\n\t\t\tvar TglUASSelesai = \$('#altTglUASSelesai').val();\r\n\t\t\tvar TglCuti = \$('#altTglCuti').val();\r\n\t\t\tvar TglNilai = \$('#altTglNilai').val();\r\n\t\t\t\r\n\t\t\tvar kuliahMulai = getDateTime('TglKuliahMulai');\r\n\t\t\tvar kuliahSelesai = getDateTime('TglKuliahSelesai');\r\n\t\t\t\r\n\t\t\tvar KRSMulai = getDateTime('TglKRSMulai');\r\n\t\t\tvar KRSSelesai = getDateTime('TglKRSSelesai');\r\n\t\t\t\r\n\t\t\tvar bayarMulai = getDateTime('TglBayarMulai');\r\n\t\t\tvar bayarSelesai = getDateTime('TglBayarSelesai');\r\n\t\t\t\r\n\t\t\tvar UTSMulai = getDateTime('TglUTSMulai');\r\n\t\t\tvar UTSSelesai = getDateTime('TglUTSSelesai');\r\n\t\t\t\r\n\t\t\tvar UASMulai = getDateTime('TglUASMulai');\r\n\t\t\tvar UASSelesai = getDateTime('TglUASSelesai');\r\n\r\n\t\t\tvar errmsg = '';\r\n\t\t\tif (ProdiID == ''){\r\n\t\t\t\terrmsg += 'Program Studi tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (ProgramID == ''){\r\n\t\t\t\terrmsg += 'Program Pendidikan tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TahunID == ''){\r\n\t\t\t\terrmsg += 'Kode Tahun tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (Nama == ''){\r\n\t\t\t\terrmsg += 'Nama Tahun tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TglKRSMulai == '/'){\r\n\t\t\t\terrmsg += 'Mulai KRS tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TglKRSSelesai == '/'){\r\n\t\t\t\terrmsg += 'Selesai KRS tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TglKuliahMulai == '/'){\r\n\t\t\t\terrmsg += 'Mulai Kuliah tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TglKuliahSelesai == '/'){\r\n\t\t\t\terrmsg += 'Selesai Kuliah tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TglBayarMulai == '/'){\r\n\t\t\t\terrmsg += 'Mulai Bayar tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TglBayarSelesai == '/'){\r\n\t\t\t\terrmsg += 'Selesai Bayar tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TglUTSMulai == '/'){\r\n\t\t\t\terrmsg += 'Mulai UTS tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TglUTSSelesai == '/'){\r\n\t\t\t\terrmsg += 'Selesai UTS tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TglUASMulai == '/'){\r\n\t\t\t\terrmsg += 'Mulai UAS tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TglUASSelesai == '/'){\r\n\t\t\t\terrmsg += 'Selesai UAS tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TglNilai == '/'){\r\n\t\t\t\terrmsg += 'Penilaian tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\tif (TglCuti == '/'){\r\n\t\t\t\terrmsg += 'Pengajuan Cuti tidak boleh kosong \\n';\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (kuliahMulai < KRSSelesai){\r\n\t\t\t\terrmsg += 'Mulai Kuliah harus dilakukan setelah masa pengisian KRS \\n';\r\n\t\t\t}\r\n\t\t\tif ((UTSMulai < kuliahMulai || UTSMulai > kuliahSelesai) || (UTSSelesai < kuliahMulai || UTSSelesai > kuliahSelesai)){\r\n\t\t\t\terrmsg += 'UTS harus berada dalam masa perkuliahan \\n';\r\n\t\t\t}\r\n\t\t\tif ((UASMulai < kuliahMulai || UASMulai > kuliahSelesai) || (UASSelesai < kuliahMulai || UASSelesai > kuliahSelesai)){\r\n\t\t\t\terrmsg += 'UAS harus berada dalam masa perkuliahan \\n';\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (errmsg != ''){\r\n\t\t\t\talert (errmsg);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t</script>\r\n  ";
    echo "<p><table class=bsc cellspacing=1 width=100%>\r\n  <form action='../{$_SESSION['mnux']}.edit.php' method=POST onSubmit='return CheckKalender()'>\r\n  <input type=hidden name='md' value='{$md}' />\r\n  <input type=hidden name='gos' value='Simpan' />\r\n  \r\n  <tr><th class=ttl colspan=4>{$jdl}</th></tr>\r\n  <tr><td class=inp>Prg. Studi:</td>\r\n      <td class=ul1>{$_prd}</td>\r\n      <td class=inp>Prg. Pendidikan:</td>\r\n      <td class=ul1>{$_prg}</td>\r\n      </tr>\r\n  <tr><td class=inp>Kode Tahun:</td>\r\n      <td class=ul1>{$_thn}</td>\r\n      <td class=inp>Nama Tahun:</td>\r\n      <td class=ul1><input type=text id='Nama' name='Nama' value='{$w['Nama']}' size=25 maxlength=50 /></td>\r\n      </tr>\r\n  \r\n  <tr><th class=ttl colspan=4>Detail Kalendar</th></tr>\r\n  <tr><td class=inp>Mulai KRS:</td>\r\n      <td class=ul1>{$optkrsmulai}</td>\r\n      <td class=inp>Selesai:</td>\r\n      <td class=ul1>{$optkrsselesai}</td>\r\n      </tr>\r\n  <tr><td class=inp>Mulai Kuliah:</td>\r\n      <td class=ul1 nowrap>{$optkuliahmulai}</td>\r\n      <td class=inp>Tgl Selesai:</td>\r\n      <td class=ul1 nowrap>{$optkuliahselesai}</td>\r\n      </tr>\r\n  <tr><td class=inp>Mulai Bayar:</td>\r\n      <td class=ul1>{$optbayarmulai}</td>\r\n      <td class=inp>Selesai:</td>\r\n      <td class=ul1>{$optbayarselesai}</td>\r\n      </tr>\r\n  <tr><td class=inp>Mulai UTS:</td>\r\n      <td class=ul1>{$optutsmulai}</td>\r\n      <td class=inp>Selesai:</td>\r\n      <td class=ul1>{$optutsselesai}</td>\r\n      </tr>\r\n  <tr><td class=inp>Mulai UAS:</td>\r\n      <td class=ul1>{$optuasmulai}</td>\r\n      <td class=inp>Selesai:</td>\r\n      <td class=ul1>{$optuasselesai}</td>\r\n      </tr>\r\n  <tr><td class=inp>Penilaian:</td>\r\n      <td class=ul1>{$optnilai}</td>\r\n      <td class=inp>Pengajuan Cuti:</td>\r\n      <td class=ul1>{$optcuti}</td>\r\n      </tr>\r\n  \r\n  <tr><td class=inp>Catatan:</td>\r\n      <td class=ul1 colspan=3><textarea name='Catatan' cols=70 rows=2>{$w['Catatan']}</textarea></td>\r\n      </tr>\r\n  <tr><td class=inp>Semester Pendek (SP)</td>\r\n      <td class=ul1 colspan=3>\r\n      <input type=checkbox name='SP' value='Y' {$_sp} /> *) Beri centang jika termasuk semester pendek.\r\n      </td>\r\n      </tr>\r\n  <tr><td class=inp>Tidak Aktif? (NA)</td>\r\n      <td class=ul1 colspan=3>\r\n      <input type=checkbox name='NA' value='Y' {$_na} /> *) Beri centang jika tidak aktif.\r\n      </td>\r\n      </tr>\r\n  \r\n  <tr><td class=ul1 colspan=4 align=center>\r\n      <input type=submit name='Simpan' value='Simpan' />\r\n      <input type=button name='Batal' value='Batal' onClick=\"window.close()\" />\r\n      </td></tr>\r\n  \r\n  </form>\r\n  </table></p>";
}
Ejemplo n.º 2
0
function Edit($md, $id, $bck)
{
    if ($md == 0) {
        $jdl = "Edit Gelombang";
        $w = GetFields('pmbperiod', "KodeID='" . KodeID . "' and PMBPeriodID", $id, "*");
        $_id = "<input type=hidden name='id' value='{$id}' /><b>{$id}</b>";
    } elseif ($md == 1) {
        $jdl = "Tambah Gelombang";
        $w = array();
        $w['Tahun'] = date('Y');
        $w['TglMulai'] = date('Y-m-d');
        $w['TglSelesai'] = date('Y-m-d');
        $w['UjianMulai'] = date('Y-m-d');
        $w['UjianSelesai'] = date('Y-m-d');
        $w['WawancaraMulai'] = date('Y-m-d');
        $w['WawancaraSelesai'] = date('Y-m-d');
        $w['BayarMulai'] = date('Y-m-d');
        $w['BayarSelesai'] = date('Y-m-d');
        $w['NA'] = 'N';
        $_id = "<input type=text name='id' value='{$id}' size=10 maxlength=50 />";
    } else {
        die(ErrorMsg('Error', "Mode edit tidak dikenali."));
    }
    TampilkanJudul($jdl);
    // Parameters
    $arrTahun = array();
    for ($i = date('Y') + 1; $i >= date('Y') - 5; $i--) {
        $arrTahun[] = $i;
    }
    $opttahun = GetOptionsFromData($arrTahun, $w['Tahun'], 1);
    $TglMulai = GetDateOption3($w['TglMulai'], 'TglMulai');
    $TglSelesai = GetDateOption3($w['TglSelesai'], 'TglSelesai');
    $UjianMulai = GetDateOption3($w['UjianMulai'], 'UjianMulai');
    $UjianSelesai = GetDateOption3($w['UjianSelesai'], 'UjianSelesai');
    $WawancaraMulai = GetDateOption3($w['WawancaraMulai'], 'WawancaraMulai');
    $WawancaraSelesai = GetDateOption3($w['WawancaraSelesai'], 'WawancaraSelesai');
    $BayarMulai = GetDateOption3($w['BayarMulai'], 'BayarMulai');
    $BayarSelesai = GetDateOption3($w['BayarSelesai'], 'BayarSelesai');
    CheckFormScript("id,Nama,Tahun,Urutan");
    $NA = $w['NA'] == 'Y' ? 'checked' : '';
    $arrDigitNoAplikan = array(3, 4, 5);
    $arrDigitNoPMB = array(3, 4, 5);
    $optdigitnoaplikan = GetDigitOption($arrDigitNoAplikan, $w['DigitNoAplikan']);
    $optdigitnopmb = GetDigitOption($arrDigitNoPMB, $w['DigitNoPMB']);
    // Tampilkan
    echo "<p><table class=bsc cellspacing=1 width=100%>\r\n  <form action='../{$_SESSION['mnux']}.gelombang.edit.php' method=POST onSubmit=\"return CheckForm(this)\">\r\n  <input type=hidden name='gos' value='Simpan' />\r\n  <input type=hidden name='md' value='{$md}' />\r\n  <input type=hidden name='bck' value='{$bck}' />\r\n  \r\n  <tr><td class=inp nowrap>Kode Gelombang:</td>\r\n      <td class=ul1>{$_id}</td>\r\n      </tr>\r\n  <tr><td class=inp nowrap>Nama Gelombang:</td>\r\n      <td class=ul1><input type=text name='Nama' value='{$w['Nama']}' size=30 maxlength=50 /></td>\r\n      </tr>\r\n  <tr><td class=inp nowrap>Tahun Gelombang:</td>\r\n      <td class=ul1><select name='Tahun'>{$opttahun}</select></td>\r\n      </tr>\r\n  <tr><td class=inp nowrap>Urutan Gelombang:</td>\r\n\t  <td class=ul1><input type=text name='Urutan' value='{$w['Urutan']}' size=3 maxlength=5 /></td>\r\n\t  </tr>\r\n  <tr><td class=inp nowrap>Format No. Aplikan:</td>\r\n\t  <td class=ul1><input type=text name='FormatNoAplikan' value='{$w['FormatNoAplikan']}' size=6>\r\n\t\t\t\t    <select name='DigitNoAplikan'>{$optdigitnoaplikan}</select></td></tr>\r\n  <tr><td class=inp nowrap>Format No. Pendaftaran:</td>\r\n\t  <td class=ul1><input type=text name='FormatNoPMB' value='{$w['FormatNoPMB']}' size=6>\r\n\t\t\t\t\t<select name='DigitNoPMB'>{$optdigitnopmb}</select></td></tr>\r\n  <tr><td class=inp nowrap>Mulai Tgl:</td>\r\n      <td class=ul1>{$TglMulai}</td>\r\n      </tr>\r\n  <tr><td class=inp nowrap>Selesai Tgl:</td>\r\n      <td class=ul1>{$TglSelesai}</td>\r\n      </tr>\r\n  <tr><td class=inp nowrap>Mulai USM:</td>\r\n      <td class=ul1>{$UjianMulai}</td>\r\n      </tr>\r\n  <tr><td class=inp nowrap>Selesai USM:</td>\r\n      <td class=ul1>{$UjianSelesai}</td>\r\n      </tr>\r\n  <tr><td class=inp nowrap>Mulai Wawancara:</td>\r\n\t  <td class=ul1>{$WawancaraMulai}</td>\r\n\t  </tr>\r\n  <tr><td class=inp nowrap>Selesai Wawancara:</td>\r\n\t  <td class=ul1>{$WawancaraSelesai}</td>\r\n\t  </tr>\r\n  <tr><td class=inp nowrap>Mulai Registrasi Ulang:</td>\r\n      <td class=ul1>{$BayarMulai}</td>\r\n      </tr>\r\n  <tr><td class=inp nowrap>Selesai Registrasi Ulang:</td>\r\n      <td class=ul1>{$BayarSelesai}</td>\r\n      </tr>\r\n  <tr><td class=inp>Tidak Aktif?</td>\r\n      <td class=ul1>\r\n        <input type=checkbox name='NA' value='Y' {$NA} /> *) Beri centang jika tidak aktif\r\n      </td></tr>\r\n  <tr><td class=ul1 colspan=2 align=center>\r\n      <input type=submit name='Simpan' value='Simpan' />\r\n      <input type=button name='Batal' value='Batal' onClick='window.close()' />\r\n      </td></tr>\r\n  </form>\r\n  </table></p>";
}
Ejemplo n.º 3
0
function Edit($md, $TAID)
{
    if ($md == 0) {
        $jdl = "Edit: Skripsi/Tugas Akhir";
        $w = GetFields('ta', 'TAID', $TAID, '*');
        $w['NamaMhsw'] = GetaField('mhsw', "KodeID='" . KodeID . "' and MhswID", $w['MhswID'], 'Nama');
        $w['DosenID'] = $w['Pembimbing'];
        $w['Dosen'] = GetaField('dosen', "KodeID='" . KodeID . "' and Login", $w['Pembimbing'], 'Nama');
        $ro = "readonly=TRUE disabled=TRUE";
        $edtMhsw = "";
        // Apakah sudah lulus?
        if ($w['Lulus'] == 'Y') {
            die(ErrorMsg("Error", "Skripsi/TA sudah diset lulus.<br />\r\n        Data sudah tidak dapat diedit lagi.<br />\r\n        Hubungi Sysadmin untuk informasi lebih lanjut.\r\n        <hr size=1 color=silver />\r\n        Opsi: <input type=button name='Tutup' value='Tutup' onClick='window.close()' >"));
        }
    } elseif ($md == 1) {
        $jdl = "Tambah: Skripsi/Tugas Akhir";
        $w = array();
        $w['TahunID'] = $_SESSION['TahunID'];
        $w['TglDaftar'] = date('Y-m-d');
        $w['TglMulai'] = date('Y-m-d');
        $w['TglSelesai'] = date('Y-m-d');
        $ro = '';
        $edtMhsw = <<<SCR
        &raquo;
        <a href='#'
          onClick="javascript:CariMhsw('{$_SESSION['FilterProdiID']}', 'frmTA')" />Cari...</a> |
        <a href='#' onClick="javascript:frmTA.MhswID.value='';frmTA.NamaMhsw.value=''">Reset</a>
SCR;
    } else {
        die(ErrorMsg("Error", "<p align=center>Mode edit: <b>{$md}</b> tidak dikenali oleh sistem.<br />\r\n    <input type=button name='Tutup' value='Tutup'\r\n      onClick=\"window.close()\" />"));
    }
    // Tampilkan
    TampilkanJudul($jdl);
    echo '
<link type="text/css" href="../datepicker2/datePicker.css" rel="stylesheet" />	
<script type="text/javascript" src="../datepicker2/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../datepicker2/date-id.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../datepicker2/jquery.bgiframe.js"></script>
<![endif]-->
<script type="text/javascript" src="../datepicker2/jquery.datePicker.js"></script>
';
    echo "\r\n<script>\r\nfunction setDatePicker(selector,rangeSelector,stat){\r\n\tvar dt = \$('#alt'+selector).val().replace('-',',');\r\n\tdt = dt.replace('-',',');\r\n\t\r\n\t\$('#'+selector).datePicker({startDate:'01/01/1990'});\r\n\t\$('#'+selector).datePicker().val(new Date(dt).asString()).trigger('change');\r\n\t\$('#'+selector).dpSetPosition(\$.dpConst.POS_TOP, \$.dpConst.POS_RIGHT);\r\n\t\r\n\tif (rangeSelector != ''){\r\n\t\tvar dts = \$('#'+rangeSelector).val().replace('-',',');\r\n\t\tdts = dts.replace('-',',');\r\n\t\t\r\n\t\tif (dts) {\r\n\t\t\tdts = new Date(dts);\r\n\t\t\t\r\n\t\t\tif (stat == 'end'){\r\n\t\t\t\t\$('#'+selector).dpSetEndDate(dts.addDays(-1).asString());\r\n\t\t\t} else if (stat == 'start'){\r\n\t\t\t\t\$('#'+selector).dpSetStartDate(dts.addDays(1).asString());\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t// bind to event\r\n\t\t\$('#'+rangeSelector).bind(\r\n\t\t\t'dpClosed',\r\n\t\t\tfunction(e, selectedDates)\r\n\t\t\t{\r\n\t\t\t\tvar year = selectedDates[0].getFullYear();\r\n\t\t\t\tvar mon = selectedDates[0].getMonth()+1;\r\n\t\t\t\tvar day = selectedDates[0].getDate();\r\n\t\t\t\tvar realvalue = year+'-'+mon+'-'+day;\r\n\t\t\t\t\$('#alt'+rangeSelector).val(realvalue);\r\n\t\t\t\t\r\n\t\t\t\tvar d = selectedDates[0];\r\n\t\t\t\tif (d) {\r\n\t\t\t\t\td = new Date(d);\r\n\t\t\t\t\tif (stat == 'end'){\r\n\t\t\t\t\t\t\$('#'+selector).dpSetEndDate(d.addDays(-1).asString());\r\n\t\t\t\t\t} else if (stat == 'start'){\r\n\t\t\t\t\t\t\$('#'+selector).dpSetStartDate(d.addDays(1).asString());\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t)\r\n\t}\t\r\n}\r\n\r\n\$(function()\r\n{\r\n\tDate.format = 'dd mmmm yyyy';\r\n\tsetDatePicker('TglDaftar','TglDaftar','');\r\n\tsetDatePicker('TglMulai','TglSelesai','end');\r\n\tsetDatePicker('TglSelesai','TglMulai','start');\r\n});\r\n</script>";
    function GetDateOption3($value, $name)
    {
        $a = "<input type=hidden name=" . $name . " id=alt" . $name . " value=" . $value . " /><input type=text id=" . $name . " value=" . $value . " readonly=true />";
        return $a;
    }
    // parameters
    $opttgldaftar = GetDateOption3($w['TglDaftar'], 'TglDaftar');
    $opttglmulai = GetDateOption3(date('Y-m-d'), 'TglMulai');
    $opttglselesai = GetDateOption3(date('Y-m-d'), 'TglSelesai');
    CheckFormScript("MhswID,Judul,DosenID");
    echo <<<SCR
  <table class=box cellspacing=1 width=100%>
  <form name='frmTA' action='../{$_SESSION['mnux']}.edit.php' method=POST
    onSubmit='return CheckForm(this)'>
  <input type=hidden name='gos' value='Simpan' />
  <input type=hidden name='md' value='{$md}' />
  <input type=hidden name='TAID' value='{$TAID}' />
  
  <tr><td class=inp>Tahun Akd:</td>
      <td class=ul>
      <input type=text name='TahunID' value='{$w['TahunID']}' size=5 maxlength=5 {$ro} />
      </td></tr>
  <tr><td class=inp>Mahasiswa:</td>
      <td class=ul>
        <input type=text name='MhswID' value='{$w['MhswID']}' size=10 maxlength=30 {$ro} />
        <input type=text name='NamaMhsw' value='{$w['NamaMhsw']}' size=30 maxlength=50 {$ro}
          onKeyUp="javascript:CariMhsw('{$_SESSION['FilterProdiID']}', 'frmTA')"/>
        {$edtMhsw}
      </td></tr>
  <tr><td class=inp>Tgl Daftar:</td>
      <td class=ul>{$opttgldaftar}</td>
      </tr>
  <tr><td class=inp>Tgl Mulai:</td>
      <td class=ul>{$opttglmulai}</td>
      </tr>
  <tr><td class=inp>Tgl Selesai:</td>
      <td class=ul>{$opttglselesai}</td>
      </tr>
  <tr><td class=inp>Judul Skripsi/TA:</td>
      <td class=ul><input type=text name='Judul' value='{$w['Judul']}'
        size=60 maxlength=255 /></td>
      </tr>
  <tr><td class=inp>Deskripsi/<br />Abstrak:</td>
      <td class=ul>
      <textarea name='Deskripsi' cols=70 rows=3>{$w['Deskripsi']}</textarea>
      </td></tr>
  <tr><td class=inp>Dosen Pembimbing:</td>
      <td class=ul>
      <input type=text name='DosenID' value='{$w['DosenID']}' size=10 maxlength=50 />
      <input type=text name='Dosen' value='{$w['Dosen']}' size=30 maxlength=50 onKeyUp="javascript:CariDosen('{$_SESSION['ProdiID']}', 'frmTA')" />
      &raquo;
      <a href='#'
        onClick="javascript:CariDosen('{$_SESSION['ProdiID']}', 'frmTA')" />Cari...</a> |
      <a href='#' onClick="javascript:frmTA.DosenID.value='';frmTA.Dosen.value=''">Reset</a>
      </td></tr>
  <tr><td class=ul colspan=2 align=center>
      <input type=submit name='Simpan' value='Simpan' />
      <input type=button name='Batal' value='Batal' onClick='window.close()' />
      </td></tr>
  </form>
  </table>
  
  <div class='box0' id='caridosen'></div>
  <div class='box0' id='carimhsw'></div>
  
  <script>
  <!--
  function toggleBox(szDivID, iState) // 1 visible, 0 hidden
  {
    if(document.layers)\t   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)\t  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)\t// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
  }
  function CariDosen(ProdiID, frm) {
    if (eval(frm + ".Dosen.value != ''")) {
      eval(frm + ".Dosen.focus()");
      showDosen(ProdiID, frm, eval(frm +".Dosen.value"), 'caridosen');
      toggleBox('caridosen', 1);
    }
  }
  function CariMhsw(ProdiID, frm) {
    if (eval(frm + ".NamaMhsw.value != ''")) {
      eval(frm + ".NamaMhsw.focus()");
      showMhsw(ProdiID, frm, eval(frm +".NamaMhsw.value"), 'carimhsw');
      toggleBox('carimhsw', 1);
    }
  }
  //-->
  </script>
SCR;
}
Ejemplo n.º 4
0
function Edit($md, $id, $resid, $Kembali)
{
    echo '
<link type="text/css" href="../datepicker2/datePicker.css" rel="stylesheet" />	
<script type="text/javascript" src="../datepicker2/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../datepicker2/date-id.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../datepicker2/jquery.bgiframe.js"></script>
<![endif]-->
<script type="text/javascript" src="../datepicker2/jquery.datePicker.js"></script>
';
    $s2 = "select date_format(TglMulai, '%d')+0 as _fromday, date_format(TglMulai, '%m')+0 as _frommonth, date_format(TglMulai, '%Y')+0 as _fromyear,\r\n\tdate_format(TglSelesai, '%d')+0 as _today, date_format(TglSelesai, '%m')+0 as _tomonth, date_format(TglSelesai, '%Y')+0 as _toyear\r\n\tfrom jadwal where NA = 'N' and JadwalID = {$id}";
    $q2 = _query($s2);
    $w2 = _fetch_array($q2);
    $start = $w2[_fromyear] . "," . $w2[_frommonth] . "," . $w2[_fromday];
    $end = $w2[_toyear] . ',' . $w2[_tomonth] . ',' . $w2[_today];
    echo "\r\n<script>\r\nfunction setDatePicker(selector,rangeSelector,stat){\r\n\tvar dt = \$('#alt'+selector).val().replace('-',',');\r\n\tdt = dt.replace('-',',');\r\n\t\r\n\t\$('#'+selector).datePicker({startDate:'01/01/1990'});\r\n\t\$('#'+selector).datePicker().val(new Date(dt).asString()).trigger('change');\r\n\t\$('#'+selector).dpSetPosition(\$.dpConst.POS_TOP, \$.dpConst.POS_RIGHT);\r\n\t\r\n\tif (rangeSelector != ''){\r\n\t\tvar dts = \$('#'+rangeSelector).val().replace('-',',');\r\n\t\tdts = dts.replace('-',',');\r\n\t\t\r\n\t\tif (dts) {\r\n\t\t\tdts = new Date(dts);\r\n\t\t\t\r\n\t\t\tif (stat == 'end'){\r\n\t\t\t\t\$('#'+selector).dpSetEndDate(dts.addDays(-1).asString());\r\n\t\t\t} else if (stat == 'start'){\r\n\t\t\t\t\$('#'+selector).dpSetStartDate(dts.addDays(1).asString());\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t// bind to event\r\n\t\t\$('#'+rangeSelector).bind(\r\n\t\t\t'dpClosed',\r\n\t\t\tfunction(e, selectedDates)\r\n\t\t\t{\r\n\t\t\t\tvar year = selectedDates[0].getFullYear();\r\n\t\t\t\tvar mon = selectedDates[0].getMonth()+1;\r\n\t\t\t\tvar day = selectedDates[0].getDate();\r\n\t\t\t\tvar realvalue = year+'-'+mon+'-'+day;\r\n\t\t\t\t\$('#alt'+rangeSelector).val(realvalue);\r\n\t\t\t\t\r\n\t\t\t\tvar d = selectedDates[0];\r\n\t\t\t\tif (d) {\r\n\t\t\t\t\td = new Date(d);\r\n\t\t\t\t\tif (stat == 'end'){\r\n\t\t\t\t\t\t\$('#'+selector).dpSetEndDate(d.addDays(-1).asString());\r\n\t\t\t\t\t} else if (stat == 'start'){\r\n\t\t\t\t\t\t\$('#'+selector).dpSetStartDate(d.addDays(1).asString());\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t)\r\n\t}\t\r\n}\r\n\r\n\$(function()\r\n{\r\n\tDate.format = 'dd mmmm yyyy';\r\n\tsetDatePicker('KuliahTanggal','KuliahTanggal','');\r\n\t\tvar dts = '" . $start . "';\r\n\t\tif (dts) {\r\n\t\t\tdts = new Date(dts);\r\n\t\t\t\t\$('#KuliahTanggal').dpSetStartDate(dts.addDays(0).asString());\r\n\t\t\t}\r\n\t\tvar dts = '" . $end . "';\r\n\t\tif (dts) {\r\n\t\t\tdts = new Date(dts);\r\n\t\t\t\t\$('#KuliahTanggal').dpSetEndDate(dts.addDays(0).asString());\r\n\t\t\t}\r\n});\r\n</script>";
    function GetDateOption3($value, $name)
    {
        $a = "<input type=hidden name=" . $name . " id=alt" . $name . " value=" . $value . " /><input type=text id=" . $name . " value=" . $value . " readonly=true />";
        return $a;
    }
    if ($Kembali == 1) {
        if ($md == 0) {
            $jdl = "Edit Jadwal Ekstra";
        } else {
            if ($md == 1) {
                $jdl = "Tambah Jadwal Ekstra";
            } else {
                die(ErrorMsg('Fatal Error', "Mode Edit tidak diketahui"));
            }
        }
        $w = GetFields('jadwal j left outer join prodi prd on j.ProdiID=prd.ProdiID
								 left outer join program prg on j.ProgramID=prg.ProgramID', 'j.JadwalID', $id, 'j.DosenID, j.NamaKelas, j.RencanaKehadiran, j.MaxAbsen, prd.Nama as _PRD, prg.Nama as _PRG,
				j.MKID, j.MKKode, j.Nama, j.SKS');
        $w['HariID'] = $_REQUEST['HariID'];
        $w['JamMulai'] = $_REQUEST['JamMulai'];
        $w['JamSelesai'] = $_REQUEST['JamSelesai'];
        $w['DosenID'] = $_REQUEST['DosenID'];
        $w['RuangID'] = $_REQUEST['RuangID'];
        $w['Kapasitas'] = $_REQUEST['Kapasitas'];
        $w['KuliahTanggal'] = $_REQUEST['KuliahTanggal'];
        $w['_RencanaKehadiranRes'] = $_REQUEST['_RencanaKehadiranRes'];
        $w['_MaxAbsenRes'] = $_REQUEST['_MaxAbsenRes'];
        $w['Dosen'] = GetaField('dosen', "KodeID='" . KodeID . "' and Login", $w['DosenID'], 'Nama');
    } else {
        if ($md == 0) {
            $jdl = "Edit Jadwal Ekstra";
            $w = GetFields('jadwal jr left outer join jadwal j on jr.JadwalRefID=j.JadwalID
										  left outer join prodi prd on j.ProdiID=prd.ProdiID 
										  left outer join program prg on j.ProgramID=prg.ProgramID 
										  left outer join kelas k on k.KelasID = j.NamaKelas', 'jr.JadwalID', $resid, 'jr.*, j.ProdiID, j.ProgramID, j.DosenID, j.NamaKelas, j.RencanaKehadiran, j.MaxAbsen, prd.Nama as _PRD, prg.Nama as _PRG,
				j.MKID, j.MKKode, j.Nama, j.SKS, jr.RencanaKehadiran as _RencanaKehadiranRes, jr.MaxAbsen as _MaxAbsenRes,  k.Nama as NamaKelas');
            $w['Dosen'] = GetaField('dosen', "KodeID='" . KodeID . "' and Login", $w['DosenID'], 'Nama');
            $w['JamMulai'] = substr($w['JamMulai'], 0, 5);
            $w['JamSelesai'] = substr($w['JamSelesai'], 0, 5);
        } elseif ($md == 1) {
            $jdl = "Tambah Jadwal Ekstra";
            $w = GetFields('jadwal j left outer join prodi prd on j.ProdiID=prd.ProdiID
								 left outer join program prg on j.ProgramID=prg.ProgramID 
								 left outer join kelas k on k.KelasID = j.NamaKelas', 'j.JadwalID', $id, 'j.DosenID, j.NamaKelas, j.RencanaKehadiran, j.MaxAbsen, prd.Nama as _PRD, prg.Nama as _PRG,
				j.MKID, j.MKKode, j.Nama, j.SKS,  k.Nama as NamaKelas');
            $w['Dosen'] = GetaField('dosen', "KodeID='" . KodeID . "' and Login", $w['DosenID'], 'Nama');
            $w['KuliahTanggal'] = date('Y-m-d');
            $w['HariID'] = date('w');
            $w['_RencanaKehadiranRes'] = $w['RencanaKehadiran'];
            $w['_MaxAbsenRes'] = $w['MaxAbsen'];
        } else {
            die(ErrorMsg('Fatal Error', "Mode Edit tidak diketahui"));
        }
    }
    $opthari = GetOption2('hari', "Nama", 'HariID', $w['HariID'], '', 'HariID');
    $opttglkuliah = GetDateOption3($w['KuliahTanggal'], 'KuliahTanggal');
    $optJamMulai = GetTimeOption($w['JamMulai'], 'JamMulai');
    $optJamSelesai = GetTimeOption($w['JamSelesai'], 'JamSelesai');
    $optjenisjadwal = GetOption2('jenisjadwal', "concat(JenisJadwalID, ' - ', Nama)", 'JenisJadwalID', $w['JenisJadwalID'], "NA='N' and Tambahan='Y'", 'JenisJadwalID', 0, 0);
    // Parameters
    JdwlScript();
    // Tampilkan
    CheckFormScript("HariID,RuangID");
    TampilkanJudul($jdl);
    echo '
  <script>
  	function cekJdwl(){
	
		var fromHour = document.forms[0].JamMulai_h.value;
		var fromMinutes = document.forms[0].JamMulai_n.value;

		var toHour = document.forms[0].JamSelesai_h.value;
		var toMinutes = document.forms[0].JamSelesai_n.value;
		
		var d4 = new Date();
		d4.setHours(fromHour);
		d4.setMinutes(fromMinutes);
		
		var fromJam = d4.getTime();
		
		var d5 = new Date();
		d5.setHours(toHour);
		d5.setMinutes(toMinutes);
		
		var toJam = d5.getTime();
		
		var kapasitas = document.forms[0].Kapasitas.value;
		
		var errmsg = "";
		
		if (fromJam >= toJam){
			errmsg += "Jam kuliah mulai harus lebih awal dari jam kuliah selesai\\n"
		}
		if (kapasitas == 0){
			errmsg += "Kapasitas tidak boleh bernilai 0\\n"
		}
		if (errmsg != ""){
			alert (errmsg);
			return false;
		}
	}
  </script>';
    echo <<<END
  <table class=bsc cellspacing=1 width=100%>
  <form name='frmJadwal' action='../{$_SESSION['mnux']}.editlab.php' method=POST onSubmit="return CheckForm(this)">
  <input type=hidden name='gos' value='Simpan' />
  <input type=hidden name='md' value='{$md}' />
  <input type=hidden name='TahunID' value='{$_SESSION['_jdwlTahun']}' />
  <input type=hidden name='ProdiID' value='{$_SESSION['_jdwlProdi']}' />
  <input type=hidden name='id' value='{$id}' />
  <input type=hidden name='resid' value='{$resid}' />
  
  <tr><td class=inp>Program Studi:</td>
      <td class=ul1><b>{$w['_PRD']}</b> <sup>({$_SESSION['_jdwlProdi']})</sup></td>
      <td class=inp>Program:</td>
      <td class=ul1>{$w['_PRG']} <sup>{$w['ProgramID']}</sup></td>
      </tr>
   <tr><td class=inp>Matakuliah:</td>
      <td class=ul1 colspan=3 nowrap>
\t  {$w['MKKode']} - {$w['Nama']} <sub>{$w['SKS']} SKS</sub></td></tr>
  <tr><td class=inp>Dosen Pengampu:</td>
      <td class=ul1 colspan=3 nowarp>{$w['DosenID']} - {$w['Dosen']}</td>
      </tr>
  <tr><td class=inp>Kelas:</td>
      <td class=ul1>{$w['NamaKelas']}</td>
      </tr>
  <tr><td class=inp>Rencana Kehadiran Dosen:</td>
      <td class=ul1>{$w['RencanaKehadiran']}</td>
      <td class=inp>Maksimum Absen:</td>
      <td class=ul1>{$w['MaxAbsen']}</td>
      </tr>
  <tr><td colspan=4><hr color=silver size=3></td></tr>
  <tr><td class=inp>Jenis Jadwal Tambahan:</td>
\t  <td class=ul1 colspan=3><select name='JenisJadwalID'>{$optjenisjadwal}</select></td>
\t  </tr>
  <tr><td class=inp>Tanggal Mulai Tambahan:</td>
      <td class=ul1 colspan=3>{$opttglkuliah}</td>
\t  </tr>
  <tr><td class=inp>Hari:</td>
      <td class=ul1><select name='HariID'>{$opthari}</select></td>
      <td class=inp>Jam Kuliah:</td>
      <td class=ul1>
        {$optJamMulai} &#8594;
        {$optJamSelesai}
        </td>
      </tr>
  <tr><td class=inp>Ruang:</td>
      <td class=ul1>
        <input type=text name='RuangID' value='{$w['RuangID']}' size=10 maxlength=50 
          onKeyUp="javascript:CariRuang('{$_SESSION['_jdwlProdi']}', 'frmJadwal')" />
        &raquo;
      <a href='#'
        onClick="javascript:CariRuang('{$_SESSION['_jdwlProdi']}', 'frmJadwal')" />Cari...</a> |
      <a href='#' onClick="javascript:frmJadwal.RuangID.value=''">Reset</a>
        </td>
      <td class=inp>Kapasitas:</td>
      <td class=ul1>
        <input type=text name='Kapasitas' value='{$w['Kapasitas']}' size=4 maxlength=5 />
        <sub>orang</sub>
        </td>
      </tr>
  <tr><td class=inp>Rencana Kehadiran Tambahan:</td>
      <td class=ul1><input type=text name='_RencanaKehadiranRes' value='{$w['_RencanaKehadiranRes']}' size=4 maxlength=4></td>
      <td class=inp>Maksimum Absen Tambahan:</td>
      <td class=ul1><input type=text name='_MaxAbsenRes' value='{$w['_MaxAbsenRes']}' size=4 maxlength=4></td>
      </tr>
  <tr><td class=ul1 colspan=4 align=center>
      <input type=submit name='Simpan' value='Simpan' onclick="return cekJdwl()" />
      <input type=button name='Batal' value='Batal' onClick="window.close()" />
      </td></tr>
  </form>
  </table>

  <div class='box0' id='cariruang'></div>
END;
}
Ejemplo n.º 5
0
function Edit($md, $jid, $pid)
{
    PresensiScript();
    echo '
<link type="text/css" href="../datepicker2/datePicker.css" rel="stylesheet" />	
<script type="text/javascript" src="../datepicker2/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../datepicker2/date-id.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../datepicker2/jquery.bgiframe.js"></script>
<![endif]-->
<script type="text/javascript" src="../datepicker2/jquery.datePicker.js"></script>
';
    $s2 = "select date_format(TglMulai, '%d')+0 as _fromday, date_format(TglMulai, '%m')+0 as _frommonth, date_format(TglMulai, '%Y')+0 as _fromyear,\r\n\tdate_format(TglSelesai, '%d')+0 as _today, date_format(TglSelesai, '%m')+0 as _tomonth, date_format(TglSelesai, '%Y')+0 as _toyear\r\n\tfrom jadwal where NA = 'N' and JadwalID = {$jid}";
    $q2 = _query($s2);
    $w2 = _fetch_array($q2);
    $start = $w2[_fromyear] . "," . $w2[_frommonth] . "," . $w2[_fromday];
    $end = $w2[_toyear] . ',' . $w2[_tomonth] . ',' . $w2[_today];
    echo "\r\n<script>\r\nfunction setDatePicker(selector,rangeSelector,stat){\r\n\tvar dt = \$('#alt'+selector).val().replace('-',',');\r\n\tdt = dt.replace('-',',');\r\n\t\r\n\t\$('#'+selector).datePicker({startDate:'01/01/1990'});\r\n\t\$('#'+selector).datePicker().val(new Date(dt).asString()).trigger('change');\r\n\t\$('#'+selector).dpSetPosition(\$.dpConst.POS_TOP, \$.dpConst.POS_RIGHT);\r\n\t\r\n\tif (rangeSelector != ''){\r\n\t\tvar dts = \$('#'+rangeSelector).val().replace('-',',');\r\n\t\tdts = dts.replace('-',',');\r\n\t\t\r\n\t\tif (dts) {\r\n\t\t\tdts = new Date(dts);\r\n\t\t\t\r\n\t\t\tif (stat == 'end'){\r\n\t\t\t\t\$('#'+selector).dpSetEndDate(dts.addDays(-1).asString());\r\n\t\t\t} else if (stat == 'start'){\r\n\t\t\t\t\$('#'+selector).dpSetStartDate(dts.addDays(1).asString());\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t// bind to event\r\n\t\t\$('#'+rangeSelector).bind(\r\n\t\t\t'dpClosed',\r\n\t\t\tfunction(e, selectedDates)\r\n\t\t\t{\r\n\t\t\t\tvar year = selectedDates[0].getFullYear();\r\n\t\t\t\tvar mon = selectedDates[0].getMonth()+1;\r\n\t\t\t\tvar day = selectedDates[0].getDate();\r\n\t\t\t\tvar realvalue = year+'-'+mon+'-'+day;\r\n\t\t\t\t\$('#alt'+rangeSelector).val(realvalue);\r\n\t\t\t\t\r\n\t\t\t\tvar d = selectedDates[0];\r\n\t\t\t\tif (d) {\r\n\t\t\t\t\td = new Date(d);\r\n\t\t\t\t\tif (stat == 'end'){\r\n\t\t\t\t\t\t\$('#'+selector).dpSetEndDate(d.addDays(-1).asString());\r\n\t\t\t\t\t} else if (stat == 'start'){\r\n\t\t\t\t\t\t\$('#'+selector).dpSetStartDate(d.addDays(1).asString());\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t)\r\n\t}\t\r\n}\r\n\r\n\$(function()\r\n{\r\n\tDate.format = 'dd mmmm yyyy';\r\n\tsetDatePicker('Tanggal','Tanggal','');\r\n\t\tvar dts = '" . $start . "';\r\n\t\tif (dts) {\r\n\t\t\tdts = new Date(dts);\r\n\t\t\t\t\$('#Tanggal').dpSetStartDate(dts.addDays(0).asString());\r\n\t\t\t}\r\n\t\tvar dts = '" . $end . "';\r\n\t\tif (dts) {\r\n\t\t\tdts = new Date(dts);\r\n\t\t\t\t\$('#Tanggal').dpSetEndDate(dts.addDays(0).asString());\r\n\t\t\t}\r\n});\r\n</script>";
    function GetDateOption3($value, $name)
    {
        $a = "<input type=hidden name=" . $name . " id=alt" . $name . " value=" . $value . " /><input type=text id=" . $name . " value=" . $value . " readonly=true />";
        return $a;
    }
    $jdwl = GetFields('jadwal', 'JadwalID', $jid, '*');
    if ($md == 0) {
        $w = GetFields('presensi', 'PresensiID', $pid, "*");
        $w['JamMulai'] = substr($w['JamMulai'], 0, 5);
        $w['JamSelesai'] = substr($w['JamSelesai'], 0, 5);
    } elseif ($md == 1) {
        $w = array();
        $w['Pertemuan'] = GetaField('presensi', "JadwalID", $jid, "max(Pertemuan)") + 1;
        $w['JamMulai'] = substr($jdwl['JamMulai'], 0, 5);
        $w['JamSelesai'] = substr($jdwl['JamSelesai'], 0, 5);
        $w['Tanggal'] = date('Y-m-d', strtotime('+' . ($w['Pertemuan'] - 1) * 7 . 'day', strtotime(GetaField('jadwal', 'JadwalID', $jid, 'TglMulai'))));
        $w['DosenID'] = $jdwl['DosenID'];
    } else {
        die(ErrorMsg('Error', "Mode edit: <b>{$md}</b> tidak dikenali.<br />\r\n    Hubungi Sysadmin untuk informasi lebih lanjut.\r\n    <hr size=1 color=silver />\r\n    <input type=button name='Tutup' value='Tutup' onClick=\"window.close()\" />"));
    }
    // Parameter
    $opttgl = GetDateOption3($w['Tanggal'], 'Tanggal');
    $optJamMulai = GetTimeOption($w['JamMulai'], 'JamMulai');
    $optJamSelesai = GetTimeOption($w['JamSelesai'], 'JamSelesai');
    $optdsn = GetDosenJadwal($jdwl, $w['DosenID']);
    $arrHari = array('Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu');
    $hr = $arrHari[date('w', strtotime($w['Tanggal'])) + 0];
    // Tampilkan
    CheckFormScript('DosenID');
    echo '
  <script>
  	function cekJdwl(){
	
		var fromHour = document.forms[0].JamMulai_h.value;
		var fromMinutes = document.forms[0].JamMulai_n.value;

		var toHour = document.forms[0].JamSelesai_h.value;
		var toMinutes = document.forms[0].JamSelesai_n.value;
		
		var d4 = new Date();
		d4.setHours(fromHour);
		d4.setMinutes(fromMinutes);
		
		var fromJam = d4.getTime();
		
		var d5 = new Date();
		d5.setHours(toHour);
		d5.setMinutes(toMinutes);
		
		var toJam = d5.getTime();
		
		
		var errmsg = "";
		
		if (fromJam >= toJam){
			errmsg += "Jam kuliah mulai harus lebih awal dari jam kuliah selesai\\n"
		}
		if (errmsg != ""){
			alert (errmsg);
			return false;
		}
	}
  </script>';
    echo "<table class=box cellspacing=1 width=100%>\r\n  <form name='frmPresensi' action='../{$_SESSION['mnux']}.edit.php' method=POST onSubmit='return CheckForm(this)'>\r\n  <input type=hidden name='gos' value='Simpan' />\r\n  <input type=hidden name='md' value='{$md}' />\r\n  <input type=hidden name='jid' value='{$jid}' />\r\n  <input type=hidden name='pid' value='{$pid}' />\r\n  \r\n  <tr><td class=inp>Pertemuan Ke:</td>\r\n      <td class=ul><input type=text name='Pertemuan' value='{$w['Pertemuan']}' size=4 maxlength=5 /></td>\r\n      </tr>\r\n  <tr><td class=inp>Tanggal:</td>\r\n      <td class=ul>{$opttgl}</td>\r\n      </tr>\r\n  <tr><td class=inp>Jam Kuliah:</td>\r\n      <td class=ul>\r\n        {$optJamMulai} &#8594;\r\n        {$optJamSelesai}\r\n      </td></tr>\r\n  <tr><td class=inp>Pemberi Kuliah:</td>\r\n      <td class=ul><select name='DosenID'>{$optdsn}</select></td>\r\n      </tr>\r\n  <tr><td class=inp>Catatan:</td>\r\n      <td class=ul>\r\n        <textarea name='Catatan' cols=40 rows=6>{$w['Catatan']}</textarea>\r\n      </td></tr>\r\n  <tr><td class=ul colspan=2 align=center>\r\n      <input type=submit name='Simpan' value='Simpan' onclick='return cekJdwl()' />\r\n      <input type=button name='Batal' value='Batal' onClick='window.close()' />\r\n      </td></tr>\r\n  </table>";
}