Modul Pemrograman CRUD PHP & Mysql

39 

Loading....

Loading....

Loading....

Loading....

Loading....

Teks penuh

(1)

Pemrograman Berbasis Web

Sistem Informasi Akademik (Kartu Rencana Studi)

Oleh

Muhammad Zaenol Arifin

12 1065 1099

JURUSAN TEKNIK INFORMATIKA

FAKULTAS TEKNIK

UNIVERSITAS MUHAMMADIYAH JEMBER

2013/2014

(2)

Kata Pengantar

Modul ini dibuat untuk menjadi panduan dalam membuat sebuat aplikasi web “Sistem

Informasi Akademik - KRS”. Aplikasi KRS digunakan untuk mempermudah mahasiswa dalam

memilih jadwal kuliah. Dalam modul ini akan dibahas mengenai :

1. Pembuatan Database

2. Pembuatan Table

3. Koneksi PHP ke Mysql

4. Pembuatan Form Input & List/Daftar

Dalam Aplikasi KRS ini merupakan gabungan dari beberapa data yaitu : Dosen,

Mahasiswa, Matakuliah, Ruangan. Dari data tersebut kita bisa memanfaatkan untuk membuat

sebuah Jadwal Matakuliah yang nantinya akan menjadi suatu jadwal yang akan dipilih oleh

masing-masing dengan fitur input, select, delete, dan update data. Semoga modul ini dapat

memberikan penjelasan secara keseluruhan mengenai aplikasi web sederhana. Sehingga

diharapkan teman-teman dapat memahami fundamental cara membuat sebuah web dinamis

menggunakan bahasa pemrograman PHP dan database MySQL.

1. Pembuatan Databases

Banyak aplikasi bantu untuk mengelola database mysql, diantaranya yang paling

mudah dan banyak digunakan adalah phpmyadmin. Aplikasi phpmyadmin dikembangkan

berbasis web sehingga sangat mudah digunakan. Biasanya aplikasi ini sudah terdapat

dalam paket web server seperti xampp, lamp dll.

Pertama, buka browser dan jalankan phpmyadmin dengan mengetik

http://localhost/phpmyadmin pada bagian address bar. Tunggu beberapa saat sampai

ada tampilan seperti berikut :

Gambar 1.0 phpMyadmin

Kolom sebelah kiri merupakan naviagasi daftar database yang sudah ada. Kolom

kanan tempat munculnya table atau operasi2 yang dapat dilakukan dengan

phpmyadmin.

(3)

Untuk membuat databases baru klik “Databases” sehingga tampilan seperti

berikut :

Gambar 1.1 phpMyadmin Databases

Untuk membuat database baru, ketikkan nama database pada kolom kanan

dibawa tulisan create new database (seperti gambar di atas). Nama database sebaiknya

ditulis tanpa spasi misal db_krs, kemudian tekan tombol create. Setelah itu akan muncul

tampilan seperti gambar berikut :

(4)

Kolom kiri menunjukkan database yang sedang aktif digunakan (baru dibuat),

kolom kanan berisi menu untuk operasi yang bisa dilakukan dalam database aktif.

2. Pembuatan Table

Sekarang membuat tabel dalam database aktif Klik sehingga tampilan seperti

gambar berikut :

Gambar 1.3 phpMyadmin SQL

Setelah tampilan seperti gambar diatas ketikan perintah dibawah ini untuk

membuat suatu table yang dibutuh dalam aplikasi KRS.

1. vz_agama

(5)

3. vz_mahasiswa

4. vz_matakuliah

(6)

6. vz_dosen

(7)

8. vz_krs

Setelah perintah diatas di inputkan klik tombol “GO” sehingga tampilan

seperti dibawah ini :

Gambar 1.3 phpMyadmin Daftar Tabel

3. Koneksi PHP ke Mysql

Seperti halnya dengan pemograman lain yang menggunakan database, hal

pertama yang harus kita lakukan adalah menghubungkan ke server database.

Menyambung ke database MySQL di PHP memerlukan beberapa informasi yaitu:

Hostname

database username

password

database name

Untuk menghubungkan ke database pertama-tama harus melakukan koneksi ke

database MySQL dan pada langkah berikutnya Anda harus memilih database yang akan

digunakan. Ingatlah jika koneksi kita gagal maka kita tidak akan bisa melanjutkan ke

script berikutnya. Perhatikan kode berikut :

<?php

$server = "localhost"; $username = "root"; $password = "";

$database = "tugaskrs";

$konek = mysql_connect($server, $username, $password) or die ("Gagal konek ke server MySQL" .mysql_error());

$bukadb = mysql_select_db($database) or die ("Gagal membuka database $database" .mysql_error());

(8)

Fungsi mysql_connect () adalah untuk membuat koneksi ke server MySQL dan

jika koneksinya berhasil maka sebagai langkah selanjutnya kita dapat memilih database

dengan perintah mysql_select_db().

4. Pembuatan Form Input & List/Daftar

Index.php (kontent) ketikan perintah berikut di bagian konten di index

$dir = "assets/"; $page = $_GET['page']; $file = $dir."$page.php"; if (!file_exists($file) || empty($file)){ include $dir."home.php"; }else{ include ("$file"); }

Home.php

<section id="typography"> <div class="page-header"> <h3>Data Profil</h3> </div> <center>

<img src="./img/D.jpg" class="img-polaroid" width="150px"> <h4>NAMA : MUHAMMAD ZAENOL ARIFIN</h4>

<h4>NIM : 12 1065 1099</h4>

<h4>UNIVERSITAS MUHAMMADIYAH JEMBER</h4> <h4>FAKULTAS TEKNIK</h4> <h4>TEKNIK INFORMATIKA</h4> <h4>2014</h4> </center> </section>

Mahasiswa

<?php if($_GET['act']=="del"){

mysql_query("DELETE FROM vz_mahasiswa WHERE MhsId= '".$_GET['id']."'"); echo "<script language='JavaScript'>window.location.href='?page=mahasiswa';</scrip t>"; } if(isset($_POST['Simpan'])){ $MhsId = $_POST['MhsId']; $Nim = $_POST['Nim']; $Nama = $_POST['Nama']; $Alamat = $_POST['Alamat']; $Sex = $_POST['Sex']; $TempLahir = $_POST['TempLahir']; $TglLahir = $_POST['TglLahir']; $Agama = $_POST['Agama']; $Telp = $_POST['Telp']; $HandPhone = $_POST['HandPhone']; $Email = $_POST['Email'];

$qverivikasi = mysql_num_rows(mysql_query("select * from vz_mahasiswa WHERE Nim='$Nim'"));

if($qverivikasi>0 && empty($MhsId)){

(9)

<button type="button" class="close" data-dismiss="alert">&times;</button>

<strong>Warning!</strong> Duplikasi NIM Mahasiswa.

</div>'; }else{

if(empty($MhsId)){

$Tabel = "Insert into vz_mahasiswa set"; $Field = "Nim='$Nim', Nama='$Nama', Alamat='$Alamat', JKelamin='$Sex', Agama='$Agama', TmpLahir='$TempLahir', TglLahir='$TglLahir', Telephone='$Telp', HandPhone='$HandPhone', Email='$Email'"; $Where = ""; }else{

$Tabel = "Update vz_mahasiswa set"; $Field = "Nim='$Nim', Nama='$Nama', Alamat='$Alamat', JKelamin='$Sex', Agama='$Agama', TmpLahir='$TempLahir', TglLahir='$TglLahir', Telephone='$Telp', HandPhone='$HandPhone', Email='$Email'";

$Where = "Where MhsId='$MhsId'"; }

$Query_Insert = mysql_query("$Tabel $Field $Where"); if($Query_Insert){

$Alert = '<div class="alert alert-success">

<button type="button" class="close" data-dismiss="alert">&times;</button>

<strong>Success!</strong> Data Mahasiswa Tersimpan.

</div>'; }else{

$Alert = '<div class="alert alert-error">

<button type="button" class="close" data-dismiss="alert">&times;</button> <strong>Error!</strong> '.mysql_error().'. </div>'; } } unset($_POST['Simpan']); } if(isset($_POST['SrcMahasiswa'])){ $SrcMahasiswa = $_POST['SrcMahasiswa']; }else{ $SrcMahasiswa = $_SESSION['SrcMahasiswa']; } $_SESSION['SrcMahasiswa'] = $SrcMahasiswa;

(10)

?>

<section id="typography">

<div class="page-header">

<h3>Master Data Mahasiswa</h3> </div>

<div>

<?=$Alert;?> </div>

<table class="table table-bordered table-striped"> <thead>

<tr>

<th colspan="4">

<form class="form-search" method="POST" action=""> <input type="text" class="input-medium search-query" size="35" name="SrcMahasiswa" value="<?=$SrcMahasiswa;?>"> <button type="submit" class="btn btn-primary btn-lg">

<i class="icon-search icon-white"></i> Tampilkan</button>

<!-- Modal -->

<button class="btn btn-primary btn-lg" toggle="modal" data-target="#frmRuangan" onclick="javascript:Add();">

<i class="icon-plus icon-white"></i> Tambah Mahasiswa </button> </form> </th> </tr> <tr> <th>#</th> <th>NIM</th> <th>Nama</th> <th>L/P</th> <th></th> </tr> </thead> <tbody> <?php

$query_table = ("select * from vz_mahasiswa WHERE Nim like '%$SrcMahasiswa%' or Nama like '%$SrcMahasiswa%' ORDER BY Nim");

include_once "assets/class.query.php"; $No=0; while($rows=mysql_fetch_array($qq)){ $No++; extract($rows); echo "<tr> <td>".$No."</td> <td>".$Nim."</td> <td>".$Nama."</td> <td>".$JKelamin."</td> <td>";?>

<button class='btn btn-success btn-small'

data-toggle='modal' data-target='#frmRuangan'

onclick='javascript:MyForm(<?=$MhsId?>, "<?=$Nim?>", "<?=$Nama?>", "<?=$Alamat?>", "<?=$JKelamin?>", "<?=$Agama?>", "<?=$TmpLahir?>", "<?=$TglLahir?>", "<?=$Telephone?>", "<?=$HandPhone?>", "<?=$Email?>")'><i class='icon-edit icon-white'></i></button>

(11)

<a href='?page=mahasiswa&id=<?=$MhsId?>&act=del' OnClick="return confirm('Yakin Data akan dihapus')"><button class='btn btn-danger btn-small'><i class='icon-trash icon-white'></i></button></a> </td> </tr> <? } ?> </tbody> </table> <center><?php include_once "assets/class.pagging.php"; ?></center> </section>

<div class="modal fade" id="frmRuangan" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

<div class="modal-dialog"> <div class="modal-content">

<form action="" method="POST" name="frmRuangan" autocomplete="off">

<input type="hidden" name="MhsId" id="MhsId"/> <div class="modal-header">

<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title" id="myModalLabel">Form Mahasiswa</h4> </div> <div class="modal-body"> <div class="form-horizontal"> <div class="control-group">

<label class="control-label" for="Nim">NIM*</label> <div class="controls">

<input type="text" name="Nim" id="Nim" class="form-control" placeholder="Kode Matakuliah." size="30" required="">

</div> </div>

<div class="control-group">

<label class="control-label" for="Nama">Nama</label> <div class="controls">

<input type="text" class="form-control" name="Nama" id="Nama" placeholder="Nama Matakuliah." size="50" required="">

</div> </div>

<div class="control-group">

<label class="control-label" for="Alamat">Alamat</label> <div class="controls">

<input type="text" class="form-control" name="Alamat" id="Alamat" placeholder="Alamat Tinggal." size="40" required=""> </div>

</div>

<div class="control-group">

<label class="control-label" for="JKelamin">Jenis Kelamin</label>

<div class="controls"> <label class="radio">

(12)

<input type="radio" name="Sex" id="SexL" value="L"> Laki-Laki</label>

<label class="radio">

<input type="radio" name="Sex" id="SexP" value="P"> Perempuan</label>

</div> </div>

<div class="control-group">

<label class="control-label" for="TempLahir">Tempat Lahir</label>

<div class="controls">

<input type="text" class="form-control" name="TempLahir" id="TempLahir" placeholder="Tempat Lahir." size="35" required=""> </div>

</div>

<div class="control-group">

<label class="control-label" for="TglLahir">Tanggal Lahir</label>

<div class="controls">

<div class="input-append date" id="dp3" data-date="<?=date("d-m-Y")?>" data-date-format="dd-mm-yyyy"><input class="form-control" name="TglLahir" id="TglLahir" placeholder="Tanggal Lahir." size="10" required="" type="text" readonly>

<span class="add-on"><i class="icon-calendar"></i></span>

</div> </div>

</div>

<div class="control-group">

<label class="control-label" for="Agama">Agama</label> <div class="controls">

<select name="Agama" id="Agama"> <option value=""></option> <?php

$qagama = mysql_query("select * from vz_agama order by Nama");

$Na = 0;

while($rowa=mysql_fetch_array($qagama)){ $Na++;

echo "<option value='".$rowa['Agama']."'> 0".$Na.".".$rowa['Nama']."</option>"; } ?> </select> </div> </div> <div class="control-group">

<label class="control-label" for="Contac">No. Telphone/HandPhone</label>

<div class="controls">

<input type="text" class="form-control" name="Telp" id="Telp" placeholder="No.Telp." size="15" required="">/

<input type="text" class="form-control" name="HandPhone" id="HandPhone" placeholder="HandPhone." size="15" required="">

</div> </div>

(13)

<label class="control-label" for="Email">Email</label> <div class="controls">

<input type="email" class="form-control" name="Email" id="Email" placeholder="Alamat Email." size="40" required="">

</div> </div>

</div> </div>

<div class="modal-footer">

<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

<button type="submit" class="btn btn-primary" name="Simpan">Save changes</button> </div> </form> </div> </div> </div> <script type="text/javascript">

function MyForm(IdM, Nom, Nm, Alm, JK, Ag, Tmp, Tgl, Telp, Hp, Email){

document.getElementById("MhsId").value = IdM; document.getElementById("Nim").value = Nom; document.getElementById("Nama").value = Nm; document.getElementById("Alamat").value = Alm;

if(JK=="L"){ document.getElementById("SexL").checked =true; }else if(JK=="P"){ document.getElementById("SexP").checked =true; } document.getElementById("TempLahir").value = Tmp; document.getElementById("TglLahir").value = Tgl; document.getElementById("Agama").value = Ag; document.getElementById("Telp").value = Telp; document.getElementById("HandPhone").value = Hp; document.getElementById("Email").value = Email; } function Add(){ document.getElementById("MhsId").value = ""; document.getElementById("Nim").value = ""; document.getElementById("Nama").value = ""; document.getElementById("Alamat").value = ""; document.getElementById("SexL").checked =true; document.getElementById("TempLahir").value = ""; document.getElementById("TglLahir").value = ""; document.getElementById("Agama").value = ""; document.getElementById("Telp").value = ""; document.getElementById("HandPhone").value = ""; document.getElementById("Email").value = ""; } </script>

Ruangan.php

<?php if($_GET['act']=="del"){

(14)

mysql_query("DELETE FROM vz_ruangan WHERE RuanganId= '".$_GET['id']."'"); echo "<script language='JavaScript'>window.location.href='?page=ruangan';</script> "; } if(isset($_POST['Simpan'])){ $RuanganId = $_POST['RuanganId']; $KdRuangan = $_POST['KdRuangan']; $Nama = $_POST['Nama']; $Kapasitas = $_POST['Kapasitas']; $Catatan = $_POST['Catatan'];

$qverivikasi = mysql_num_rows(mysql_query("select * from vz_ruangan WHERE KdRuangan='$KdRuangan'"));

if($qverivikasi>0 && empty($RuanganId)){

$Alert = '<div class="alert alert-error">

<button type="button" class="close" data-dismiss="alert">&times;</button>

<strong>Warning!</strong> Duplikasi Kode Ruangan.

</div>'; }else{

if(empty($RuanganId)){

$Tabel = "Insert into vz_ruangan set"; $Field = "KdRuangan='$KdRuangan', Nama='$Nama', Kapasitas='$Kapasitas', Note='$Catatan'"; $Where = ""; }else{

$Tabel = "Update vz_ruangan set"; $Field = "KdRuangan='$KdRuangan',

Nama='$Nama',

Kapasitas='$Kapasitas', Note='$Catatan'";

$Where = "Where RuanganId='$RuanganId'"; }

$Query_Insert = mysql_query("$Tabel $Field $Where"); if($Query_Insert){

$Alert = '<div class="alert alert-success">

<button type="button" class="close" data-dismiss="alert">&times;</button>

<strong>Success!</strong> Data Ruangan Tersimpan.

</div>'; }else{

$Alert = '<div class="alert alert-error">

<button type="button" class="close" data-dismiss="alert">&times;</button> <strong>Error!</strong> '.mysql_error().'. </div>'; } } unset($_POST['Simpan']); }

(15)

if(isset($_POST['SrcRuangan'])){ $SrcRuangan = $_POST['SrcRuangan']; }else{ $SrcRuangan = $_SESSION['SrcRuangan']; } $_SESSION['SrcRuangan'] = $SrcRuangan; ?> <section id="typography"> <div class="page-header"> <h3>Master Data Ruangan</h3> </div>

<div>

<?=$Alert;?> </div>

<table class="table table-bordered table-striped"> <thead>

<tr>

<th colspan="4">

<form class="form-search" method="POST" action=""> <input type="text" class="input-medium search-query" size="35" name="SrcRuangan" value="<?=$SrcRuangan;?>">

<button type="submit" class="btn btn-primary btn-lg">

<i class="icon-search icon-white"></i> Tampilkan</button>

<!-- Modal -->

<button class="btn btn-primary btn-lg" toggle="modal" data-target="#frmRuangan" onclick="javascript:Add();">

<i class="icon-plus icon-white"></i> Tambah Ruangan </button> </form> </th> </tr> <tr> <th>#</th> <th>Kode Ruangan</th> <th>Nama</th> <th>Kapasitas</th> <th></th> </tr> </thead> <tbody> <?php

$query_table = ("select * from vz_ruangan WHERE KdRuangan like '%$SrcRuangan%' or Nama like '%$SrcRuangan%' ORDER BY KdRuangan");

include_once "assets/class.query.php"; $No=0; while($rows=mysql_fetch_array($qq)){ $No++; extract($rows); echo "<tr> <td>".$No."</td> <td>".$KdRuangan."</td> <td>".$Nama."</td> <td>".$Kapasitas.",00</td> <td>";?>

<button class='btn btn-success btn-small'

(16)

onclick='javascript:MyForm(<?=$RuanganId?>, "<?=$KdRuangan?>", "<?=$Nama?>", "<?=$Kapasitas?>", "<?=$Note?>")'><i class='icon-edit icon-white'></i></button>

<a href='?page=ruangan&id=<?=$RuanganId?>&act=del' OnClick="return confirm('Yakin Data akan dihapus')"><button class='btn btn-danger btn-small'><i class='icon-trash icon-white'></i></button></a> </td> </tr> <? } ?> </tbody> </table> <center><?php include_once "assets/class.pagging.php"; ?></center> </section>

<div class="modal fade" id="frmRuangan" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

<div class="modal-dialog"> <div class="modal-content">

<form action="" method="POST" name="frmRuangan" autocomplete="off">

<input type="hidden" name="RuanganId" id="RuanganId"/> <div class="modal-header">

<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>

<h4 class="modal-title" id="myModalLabel">Form Ruangan</h4> </div>

<div class="modal-body"> <div class="form-horizontal"> <div class="control-group">

<label class="control-label" for="KdRuangan">Kode Ruangan</label>

<div class="controls">

<input type="text" name="KdRuangan" id="KdRuangan" class="form-control" placeholder="Kode Matakuliah." size="30" required="">

</div> </div>

<div class="control-group">

<label class="control-label" for="Nama">Nama</label> <div class="controls">

<input type="text" class="form-control" name="Nama" id="Nama" placeholder="Nama Matakuliah." size="50" required="">

</div> </div>

<div class="control-group">

<label class="control-label" for="Kapasitas">Kapasitas Ruangan</label>

<div class="controls">

<input type="number" class="form-control" name="Kapasitas" id="Kapasitas" placeholder="Kapasitas Ruangan." size="10" required="">

(17)

</div>

<div class="control-group">

<label class="control-label" for="Catatan">Catatan*</label> <div class="controls">

<textarea class="form-control" name="Catatan" id="Catatan" rows="4" cols="40" placeholder="Keterangan Mata Kuliah." required=""></textarea> </div> </div> </div> </div> <div class="modal-footer">

<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

<button type="submit" class="btn btn-primary" name="Simpan">Save changes</button> </div> </form> </div> </div> </div> <script type="text/javascript">

function MyForm(IdR, Kode, Nm, Kap, Nt){

document.getElementById("RuanganId").value = IdR; document.getElementById("KdRuangan").value = Kode; document.getElementById("Nama").value = Nm; document.getElementById("Kapasitas").value = Kap; document.getElementById("Catatan").value = Nt; } function Add(){ document.getElementById("RuanganId").value = ""; document.getElementById("KdRuangan").value = ""; document.getElementById("Nama").value = ""; document.getElementById("Kapasitas").value = ""; document.getElementById("Catatan").value = ""; } </script>

Dosen.php

<?php if($_GET['act']=="del"){

mysql_query("DELETE FROM vz_dosen WHERE IdDosen= '".$_GET['id']."'"); echo "<script language='JavaScript'>window.location.href='?page=dosen';</script>"; } if(isset($_POST['Simpan'])){ $IdDosen = $_POST['IdDosen']; $NIDN = $_POST['NIDN']; $Nama = $_POST['Nama']; $Alamat = $_POST['Alamat']; $TempLahir = $_POST['TempLahir']; $TglLahir = $_POST['TglLahir']; $Sex = $_POST['Sex']; $Agama = $_POST['Agama'];

(18)

$Pendidikan = $_POST['Pendidikan']; $Telp = $_POST['Telp']; $HandPhone = $_POST['HandPhone']; $Email = $_POST['Email']; $MK = $_POST['MK']; $Jumlah = count($MK); for($x = 0; $x < $Jumlah; $x++){ if($x==0){ $Mengajar = "[".$MK[$x]."]"; }else{ $Mengajar = $Mengajar.",[".$MK[$x]."]"; } }

$qverivikasi = mysql_num_rows(mysql_query("select * from vz_dosen WHERE NIDN='$NIDN'"));

if($qverivikasi>0 && empty($IdDosen)){

$Alert = '<div class="alert alert-error">

<button type="button" class="close" data-dismiss="alert">&times;</button>

<strong>Warning!</strong> Duplikasi Nomor Induk Dosen.

</div>'; }else{

if(empty($IdDosen)){

$Tabel = "Insert into vz_dosen set"; $Field = "NIDN='$NIDN', Nama='$Nama', Alamat='$Alamat', TmpLahir='$TempLahir', TglLahir='$TglLahir', JenisKelamin='$Sex', Agama='$Agama', PendidikanTerakhir='$Pendidikan', NoTelp='$Telp', NoHP='$HandPhone', Email='$Email', Mengajar='$Mengajar'"; $Where = ""; }else{

$Tabel = "Update vz_dosen set"; $Field = "NIDN='$NIDN', Nama='$Nama', Alamat='$Alamat', TmpLahir='$TempLahir', TglLahir='$TglLahir', JenisKelamin='$Sex', Agama='$Agama', PendidikanTerakhir='$Pendidikan', NoTelp='$Telp', NoHP='$HandPhone', Email='$Email', Mengajar='$Mengajar'"; $Where = "Where IdDosen='$IdDosen'";

(19)

}

$Query_Insert = mysql_query("$Tabel $Field $Where"); if($Query_Insert){

$Alert = '<div class="alert alert-success">

<button type="button" class="close" data-dismiss="alert">&times;</button>

<strong>Success!</strong> Data Dosen Tersimpan.

</div>'; }else{

$Alert = '<div class="alert alert-error">

<button type="button" class="close" data-dismiss="alert">&times;</button> <strong>Error!</strong> '.mysql_error().'. </div>'; } } unset($_POST['Simpan']); }

if(isset($_POST['SrcDosen'])){ $SrcDosen = $_POST['SrcDosen']; }else{ $SrcDosen = $_SESSION['SrcDosen']; } $_SESSION['SrcDosen'] = $SrcDosen; ?> <section id="typography"> <div class="page-header"> <h3>Master Data Dosen</h3> </div>

<div>

<?=$Alert;?> </div>

<table class="table table-bordered table-striped"> <thead>

<tr>

<th colspan="4">

<form class="form-search" method="POST" action=""> <input type="text" class="input-medium search-query" size="35" name="SrcDosen" value="<?=$SrcDosen;?>">

<!-- Modal -->

<button class="btn btn-primary btn-lg" toggle="modal" data-target="#frmDosen" onclick="javascript:Add();">

<i class="icon-plus icon-white"></i> Tambah Dosen </button> </form> </th> </tr> <tr> <th>#</th> <th>NIDN</th> <th>Nama</th> <th>Telephone / HandPhone</th> <th></th> </tr> </thead>

(20)

<tbody> <?php

$query_table = ("select * from vz_dosen WHERE NIDN like '%$SrcDosen%' or Nama like '%$SrcDosen%' ORDER BY Nama");

include_once "assets/class.query.php"; $No=0; while($rows=mysql_fetch_array($qq)){ $No++; extract($rows); echo "<tr> <td>".$No."</td> <td>".$NIDN."</td> <td>".$Nama."</td> <td>".$NoTelp." / ".$NoHP.".00</td> <td>";?>

<button class='btn btn-success btn-small'

data-toggle='modal' data-target='#frmDosen'

onclick='javascript:MyForm(<?=$IdDosen?>, "<?=$NIDN?>", "<?=$Nama?>", "<?=$Alamat?>", "<?=$TmpLahir?>", "<?=$TglLahir?>", "<?=$JenisKelamin?>", "<?=$Agama?>", "<?=$PendidikanTerakhir?>", "<?=$NoTelp?>", "<?=$NoHP?>", "<?=$Email?>", "<?=$Mengajar?>")'><i class='icon-edit icon-white'></i></button>

<a href='?page=dosen&id=<?=$IdDosen?>&act=del' OnClick="return confirm('Yakin Data akan dihapus')"><button class='btn btn-danger btn-small'><i class='icon-trash icon-white'></i></button></a> </td> </tr> <? } ?> </tbody> </table> <center><?php include_once "assets/class.pagging.php"; ?></center> </section>

<div class="modal fade" id="frmDosen" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

<div class="modal-dialog"> <div class="modal-content">

<form action="" method="POST" name="frmDosen" autocomplete="off">

<input type="hidden" name="IdDosen" id="IdDosen"/> <div class="modal-header">

<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>

<h4 class="modal-title" id="myModalLabel">Form Dosen</h4> </div>

<div class="modal-body"> <div class="form-horizontal"> <div class="control-group">

<label class="control-label" for="NIDN">Nomor Induk Dosen</label>

(21)

<input type="text" name="NIDN" id="NIDN" class="form-control" placeholder="Nomor Induk Dosen Negeri." size="30" required="">

</div> </div>

<div class="control-group">

<label class="control-label" for="Nama">Nama</label> <div class="controls">

<input type="text" class="form-control" name="Nama" id="Nama" placeholder="Nama Lengkap Dosen." size="50" required=""> </div>

</div>

<div class="control-group">

<label class="control-label" for="Alamat">Alamat</label> <div class="controls">

<textarea class="form-control" name="Alamat" id="Alamat" rows="4" cols="40" placeholder="Alamat Tempat Tinggal." required=""></textarea>

</div> </div>

<div class="control-group">

<label class="control-label" for="TempLahir">Tempat Lahir</label>

<div class="controls">

<input type="text" class="form-control" name="TempLahir" id="TempLahir" placeholder="Tempat Lahir." size="40" required=""> </div>

</div>

<div class="control-group">

<label class="control-label" for="TglLahir">Tanggal Lahir</label>

<div class="controls">

<div class="input-append date" id="dp3" data-date="<?=date("d-m-Y")?>" data-date-format="dd-mm-yyyy"><input class="form-control" name="TglLahir" id="TglLahir" placeholder="Tanggal Lahir." size="10" required="" type="text" readonly>

<span class="add-on"><i class="icon-calendar"></i></span>

</div> </div>

</div>

<div class="control-group">

<label class="control-label" for="Sex">Jenis Kelamin</label> <div class="controls">

<label class="radio">

<input type="radio" name="Sex" id="SexL" value="L"> Pria</label>

<label class="radio">

<input type="radio" name="Sex" id="SexP" value="P"> Wanita</label>

</div> </div>

<div class="control-group">

<label class="control-label" for="Agama">Agama</label> <div class="controls">

(22)

<option value=""></option> <?php

$qagama = mysql_query("select * from vz_agama order by Nama");

$Na = 0;

while($rowa=mysql_fetch_array($qagama)){ $Na++;

echo "<option value='".$rowa['Agama']."'> 0".$Na.".".$rowa['Nama']."</option>"; } ?> </select> </div> </div> <div class="control-group">

<label class="control-label" for="Pendidikan">Pendidikan Terakhir</label>

<div class="controls">

<input type="text" class="form-control" name="Pendidikan" id="Pendidikan" placeholder="Pendidikan Terakhir." size="40" required="">

</div> </div>

<div class="control-group">

<label class="control-label" for="Pendidikan">No. Telphone/HandPhone</label>

<div class="controls">

<input type="text" class="form-control" name="Telp" id="Telp" placeholder="No.Telp." size="15" required="">/

<input type="text" class="form-control" name="HandPhone" id="HandPhone" placeholder="HandPhone." size="15" required="">

</div> </div>

<div class="control-group">

<label class="control-label" for="Email">Email</label> <div class="controls">

<input type="email" class="form-control" name="Email" id="Email" placeholder="Alamat Email." size="40" required="">

</div> </div>

<div class="control-group">

<label class="control-label" for="Email">Mengajar Matakuliah</label>

<div class="controls"> <?php

$qMk = mysql_query("select * from vz_matakuliah ORDER BY MkKode");

while($rowMk=mysql_fetch_array($qMk)){ ?>

<label class="radio"><input type="checkbox" name="MK[]" id="MK<?=$rowMk['MkId'];?>" value="<?=$rowMk['MkId'];?>"> <?=$rowMk['MkKode']." - ".$rowMk['Nama'];?> <font color="#ff0000"><sup><?=$rowMk['SKS']?></sup></font></label> <? }?> </div> </div> </div> </div>

(23)

<div class="modal-footer">

<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

<button type="submit" class="btn btn-primary" name="Simpan">Save changes</button> </div> </form> </div> </div> </div> <?php

$qMkA = mysql_query("select * from vz_matakuliah ORDER BY MkKode"); $NoL=0; while($rowMkA=mysql_fetch_array($qMkA)){ if($NoL==0){ $MyArray = 'document.getElementById("MK'.$rowMkA['MkId'].'").checked = false;'; }else{ $MyArray = $MyArray.'document.getElementById("MK'.$rowMkA['MkId'].'").checked = false;'; } $NoL++; } ?> <script type="text/javascript">

function MyForm(Id, Induk, Nm, Almt, TmpLahir, Tgl, JK, Ag, Scool, Tel, HP, Ema, Mengajar){

document.getElementById("IdDosen").value = Id; document.getElementById("NIDN").value = Induk; document.getElementById("Nama").value = Nm; document.getElementById("Alamat").value = Almt; document.getElementById("TempLahir").value = TmpLahir; document.getElementById("TglLahir").value = Tgl;

if(JK=="L"){ document.getElementById("SexL").checked =true; }else if(JK=="P"){ document.getElementById("SexP").checked =true; } document.getElementById("Agama").value = Ag; document.getElementById("Pendidikan").value = Scool; document.getElementById("Telp").value = Tel; document.getElementById("HandPhone").value = HP; document.getElementById("Email").value = Ema;

String.prototype.replaceAll = function( token, newToken, ignoreCase ) {

var _token;

var str = this + ""; var i = -1;

if ( typeof token === "string" ) { if ( ignoreCase ) {

(24)

_token = token.toLowerCase(); while( ( i = str.toLowerCase().indexOf( token, i >= 0 ? i + newToken.length : 0 ) ) !== -1 ) { str = str.substring( 0, i ) + newToken + str.substring( i + token.length ); } } else {

return this.split( token ).join( newToken ); } } return str; }; var a = Mengajar.replaceAll('[', ''); var b = a.replaceAll(']', '');

var myarr = b.split(",");

for(var xy = 0; xy <myarr.length ; xy++){

document.getElementById("MK"+myarr[xy]+"").checked = true; } } function Add(){ document.getElementById("IdDosen").value = ""; document.getElementById("NIDN").value = ""; document.getElementById("Nama").value = ""; document.getElementById("Alamat").value = ""; document.getElementById("TempLahir").value = ""; document.getElementById("TglLahir").value = ""; document.getElementById("SexL").checked =true; document.getElementById("Agama").value = ""; document.getElementById("Pendidikan").value = ""; document.getElementById("Telp").value = ""; document.getElementById("HandPhone").value = ""; document.getElementById("Email").value = ""; <?php echo $MyArray;?> } </script>

jadwalmatakuliah.php

<?php if(isset($_POST['HariF'])){ $HariF = $_POST['HariF']; } ?> <section id="typography"> <div class="page-header">

<h3>Master Data Jadwal Matakuliah</h3>

(25)

<table width="100%" class="table table-bordered table-striped"> <thead> <tr> <td colspan="2">Hari</td> <td colspan="5"> <select name="HariF"> <option value=""></option> <?php

$qhari =mysql_query("select * from vz_hari ORDER BY HariID");

while($rowh=mysql_fetch_array($qhari)){ if($rowh['HariID']==$HariF)

echo "<option value='".$rowh['HariID']."' selected>".$rowh['Nama']."</option>"; else echo "<option value='".$rowh['HariID']."'>".$rowh['Nama']."</option>"; } ?> </select> </td> </tr> <tr> <td colspan="7">

<center><button type="submit" class="btn primary btn-lg">

<i class="icon-search icon-white"></i> Tampilkan</button>

<button class="btn btn-primary btn-lg" type="button" onclick="location='?page=frm.jadwal'">

<i class="icon-plus icon-white"></i> Tambah Jadwal</button> </center> </td> </tr> <tr> <th>#</th> <th>Kode Matakuliah</th>

<th>Nama Matakuliah <sup>SKS</sup></th> <th>Nama Dosen</th>

<th>Ruangan <sup>Kapasitas</sup></th>

<th><sup>Jam Mulai</sup>&rarr;<sub>Jam Selesai</sub></th> <th>&nbsp;</th>

</tr> </thead> <tbody> <?php

if(!empty($HariF)){ $WhereH = "Where HariID='$HariF'"; }else{ $WhereH = ""; }

$qhari = mysql_query("select * from vz_hari $WhereH order by HariID");

while($rowh=mysql_fetch_array($qhari)){ $query_table = mysql_query("select

vzj.JadwalId, vzj.JamMulai, vzj.JamSelesai, vzm.MkKode, vzm.Nama as NamaMK, vzm.SKS, vzd.Nama as NamaDosen, vzr.Nama as NamaRuangan, vzr.Kapasitas

(26)

vz_jadwal vzj, vz_matakuliah vzm, vz_dosen vzd, vz_ruangan vzr where

vzj.MkId = vzm.MkId and vzj.IdDosen=vzd.IdDosen

and vzj.RuanganId=vzr.RuanganId and vzj.HariID='$rowh[HariID]'"); $count = mysql_num_rows($query_table);

if($count>0){ echo "<tr>

<th colspan='7' style='background-color: #F0F6FD;'> &raquo; ".$rowh['Nama']."</th>

</tr>"; $No=0;

while($rowj=mysql_fetch_array($query_table)){ $No++;

$qjml = mysql_num_rows(mysql_query("select * from vz_krs where JadwalId='".$rowj['JadwalId']."'")); echo "<tr> <td>".$No."</td> <td>".$rowj['MkKode']."</td> <td>".$rowj['NamaMK']." <sup>".$rowj['SKS']."</sup></td> <td>".$rowj['NamaDosen']."</td> <td>".$rowj['NamaRuangan']." <sup>".$rowj['Kapasitas']."</sup></td> <td><sup>".$rowj['JamMulai']."</sup> &rarr; <sub>".$rowj['JamSelesai']."</sub></td> <td> <a href='?page=frm.jadwal&id=".$rowj['JadwalId']."'><button class='btn btn-success btn-small' type='button'><i class='icon-edit icon-white'></i></button></a>

<button class='btn btn-info

btn-small'><i>".$qjml."</i></button></td> </tr>"; } } } ?> </tbody> </table> </form> </section>

Frm.jadwal.php

<?php if(isset($_POST['simpan'])){ $JadwalId = $_POST['JadwalId']; $TglMulai = $_POST['TglMulai']; $TglSelesai = $_POST['TglSelesai']; $Hari = $_POST['Hari']; $JamMulai = $_POST['JamMulai']; $JamSelesai = $_POST['JamSelesai']; $Matakuliah = $_POST['Matakuliah']; $Dosen = $_POST['Dosen']; $Ruangan = $_POST['Ruangan']; $Note = $_POST['Note'];

$qhari = mysql_fetch_assoc(mysql_query("select * from vz_hari WHERE HariID='$Hari'"));

$qdosen = mysql_fetch_assoc(mysql_query("select * from vz_dosen WHERE IdDosen='$Dosen'"));

(27)

$qcekhari = mysql_num_rows(mysql_query("select * from vz_jadwal where RuanganId='$Ruangan' and HariID='$Hari' and ((JamMulai between '$JamMulai' and '$JamSelesai') or (JamSelesai between '$JamMulai' and '$JamSelesai')) and JadwalId!='$JadwalId'"));

$qcekdosen = mysql_num_rows(mysql_query("select * from vz_jadwal where HariID='$Hari' and ((JamMulai between '$JamMulai' and '$JamSelesai') or (JamSelesai between '$JamMulai' and '$JamSelesai')) and JadwalId!='$JadwalId' and IdDosen='$Dosen'"));

if($qcekhari>0){

$Alert = '<div class="alert alert-error">

<button type="button" class="close" data-dismiss="alert">&times;</button>

<strong>Warning!</strong> Maaf Ruangan sudah digunakan pada hari '.$qhari['Nama'].' dan Jam '.$JamMulai.' s/d '.$JamSelesai.'.

</div>'; }else if($qcekdosen>0){

$Alert = '<div class="alert alert-error">

<button type="button" class="close" data-dismiss="alert">&times;</button>

<strong>Warning!</strong> Maaf jadwal dosen '.$qdosen['Nama'].' bentrok pada hari '.$qhari['Nama'].' dan Jam '.$JamMulai.' s/d '.$JamSelesai.'.

</div>'; }else{

if(empty($JadwalId)){

$Tabel = "Insert into vz_jadwal set"; $Field = "MkId='$Matakuliah', IdDosen='$Dosen', RuanganId='$Ruangan', TglMulai='$TglMulai', TglSelesai='$TglSelesai', HariID='$Hari', JamMulai='$JamMulai', JamSelesai='$JamSelesai', Note='$Note'"; $Where = ""; $Alert = ""; }else{

$Tabel = "Update vz_jadwal set"; $Field = "MkId='$Matakuliah', IdDosen='$Dosen', RuanganId='$Ruangan', TglMulai='$TglMulai', TglSelesai='$TglSelesai', HariID='$Hari', JamMulai='$JamMulai', JamSelesai='$JamSelesai', Note='$Note'";

$Where = "Where JadwalId='$JadwalId'"; $Alert = "";

}

$Insert = mysql_query("$Tabel $Field $Where"); if($Insert){

(28)

echo "<script language='JavaScript'>window.location.href='?page=jadwalmatakuliah'; </script>"; } } } $Id = $_GET['id'];

$qjadwal = mysql_query("select * from vz_jadwal where JadwalId='$Id'"); $valuejadwal = mysql_fetch_assoc($qjadwal); $verivikasij = mysql_num_rows($qjadwal); if($verivikasij>0){ $JadwalId = $valuejadwal['JadwalId']; $TglMulai = $valuejadwal['TglMulai']; $TglSelesai = $valuejadwal['TglSelesai']; $Hari = $valuejadwal['HariID']; $JamMulai = $valuejadwal['JamMulai']; $JamSelesai = $valuejadwal['JamSelesai']; $Matakuliah = $valuejadwal['MkId']; $Dosen = $valuejadwal['IdDosen']; $Ruangan = $valuejadwal['RuanganId']; $Note = $valuejadwal['Note']; } ?>

<script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript">

$(document).ready(function(){

$("#Matakuliah").change(function(){

var Matakuliah = $("#Matakuliah").val(); $.ajax({ url: "assets/frm.jadwal.dosen.php", data: "Matakuliah="+Matakuliah, cache: false, success: function(msg){ $("#Dosen").html(msg); } }); }); }); </script> <section id="typography"> <div class="page-header">

<h3>Master Data Jadwal Matakuliah</h3> </div>

<div><?=$Alert?></div>

<form action="" method="post" name="frmjadwal">

<input type="hidden" id="JadwalId" name="JadwalId" value="<?=$JadwalId?>"/>

<table width="100%" class="table table-bordered"> <tr>

<td>Tanggal Mulai</td>

<td><div class="input-append date" id="dp3" data-date="<?=date("d-m-Y")?>" data-date-format="dd-mm-yyyy"><input class="form-control" name="TglMulai" id="TglMulai"

(29)

placeholder="Tanggal Mulai." size="10" required="" type="text" value="<?=$TglMulai?>" readonly>

<span class="add-on"><i class="icon-calendar"></i></span>

</div> </td>

<td>Tanggal Selesai</td>

<td><div class="input-append date" id="dp4" data-date="<?=date("d-m-Y")?>" data-date-format="dd-mm-yyyy"><input class="form-control" name="TglSelesai" id="TglSelesai" placeholder="Tanggal Selesai." size="10" required="" type="text" value="<?=$TglSelesai?>">

<span class="add-on"><i class="icon-calendar"></i></span>

</div></td> </tr>

<tr>

<td>Hari</td>

<td><select name="Hari" id="Hari"> <option value=""></option> <?php

$qhari =mysql_query("select * from vz_hari ORDER BY HariID");

while($rowh=mysql_fetch_array($qhari)){ if($rowh['HariID']==$Hari)

echo "<option value='".$rowh['HariID']."' selected>".$rowh['Nama']."</option>"; else echo "<option value='".$rowh['HariID']."'>".$rowh['Nama']."</option>"; } ?> </select></td> <td>Jam Kuliah</td> <td>

<div class="input-append clockpicker" data-placement="left" data-align="top" data-autoclose="true"><input class="form-control" name="JamMulai" id="JamMulai" placeholder="Jam Mulai." size="6" required="" type="text" value="<?=$JamMulai?>">

<span class="add-on input-group-addon"><i class="icon-screenshot"></i></span>

</div> s/d

<div class="input-append clockpicker" data-placement="left" data-align="top" data-autoclose="true"><input class="form-control" name="JamSelesai" id="JamSelesai" placeholder="Jam Selesai." size="6" required="" type="text" value="<?=$JamSelesai?>">

<span class="add-on input-group-addon"><i class="icon-screenshot"></i></span> </div> </td> </tr> <tr> <td>Matakuliah</td> <td>

<select name="Matakuliah" id="Matakuliah"> <option value=""></option>

(30)

<?php

$qmatakuliah =mysql_query("select * from vz_matakuliah ORDER BY MkKode");

while($rowm=mysql_fetch_array($qmatakuliah)){ if($rowm['MkId']==$Matakuliah)

echo "<option value='".$rowm['MkId']."' selected>".$rowm['MkKode']." - ".$rowm['Nama']."</option>"; else echo "<option value='".$rowm['MkId']."'>".$rowm['MkKode']." - ".$rowm['Nama']."</option>"; } ?> </select> </td> <td>Dosen</td> <td>

<select name="Dosen" id="Dosen">

<?php

$query_dosen=mysql_query("select * from vz_dosen where Mengajar like '%[$Matakuliah]%'");

echo "<option></option>";

while($rows_dosen=mysql_fetch_array($query_dosen)){ if($rows_dosen['IdDosen']==$Dosen)

echo "<option value='".$rows_dosen['IdDosen']."' selected>".$rows_dosen['Nama']."</option>"; else echo "<option value='".$rows_dosen['IdDosen']."'>".$rows_dosen['Nama']."</option>" ; } ?> </select> </td> </tr> <tr> <td>Ruangan</td> <td colspan="3">

<select name="Ruangan" id="Ruangan"> <option value=""></option>

<?php

$qruangan =mysql_query("select * from vz_ruangan ORDER BY Nama");

while($rowr=mysql_fetch_array($qruangan)){ if($rowr['RuanganId']==$Ruangan)

echo "<option value='".$rowr['RuanganId']."' selected>".$rowr['Nama']."</option>"; else echo "<option value='".$rowr['RuanganId']."'>".$rowr['Nama']."</option>"; } ?> </select> </td> </tr> <tr>

(31)

<td>Note</td>

<td colspan="3"><textarea name="Note" id="Note" cols="50" rows="3"><?=$Note?></textarea></td>

</tr> <tr>

<td colspan="4"> <center>

<button class="btn btn-primary btn-lg" type="submit" name="simpan"> <i class="icon-ok icon-white"></i> Simpan</button>

<button class="btn btn-danger btn-lg" type="reset"> <i class="icon-refresh icon-white"></i> Reset</button>

</center> </td> </tr> </table> </form> </section>

Frm.jadwal.dosen.php

<?php include_once "../assets/config-db.php"; $Matakuliah = $_GET['Matakuliah'];

$query_dosen=mysql_query("select * from vz_dosen where Mengajar like '%[$Matakuliah]%'"); echo "<option></option>"; while($rows_dosen=mysql_fetch_array($query_dosen)){ echo "<option value='".$rows_dosen['IdDosen']."'>".$rows_dosen['Nama']."</option>" ; } ?>

Krs.php

<?php if($_GET['act']=="del"){

mysql_query("DELETE FROM vz_krs WHERE KrsId= '".$_GET['id']."'");

echo "<script

language='JavaScript'>window.location.href='?page=krs';</script>"; }

if(isset($_POST['NIM'])){ $NIM = $_POST['NIM']; }else{ $NIM = $_SESSION['NIM']; } $_SESSION['NIM'] = $NIM;

$qmhs = mysql_fetch_assoc(mysql_query("select * from vz_mahasiswa where Nim='$NIM'"));

$qagama = mysql_fetch_assoc(mysql_query("select * from vz_agama where Agama='$qmhs[Agama]'"));

?>

<section id="typography">

<div class="page-header"> <h3>Kartu Rencana Studi</h3> </div>

<table width="100%"> <tr>

<td><form action="" method="post" name="frmmahasiswa"><table width="100%" class="table table-bordered">

<tr>

<td>NIM</td> <td>

(32)

<input type="text" class="input-medium search-query" size="30" name="NIM" value="<?=$NIM;?>" placeholder="NIM">

<button type="submit" class="btn primary btn-small"><i class="icon-search icon-white"></i></button>

</td>

<td>Tempat /Tanggal Lahir</td>

<td><?=$qmhs['TmpLahir']." / ".$qmhs['TglLahir']?></td> </tr> <tr> <td>Nama</td> <td><?=$qmhs['Nama']?></td> <td>Agama</td> <td><?=$qagama['Agama']." - ".$qagama['Nama']?></td> </tr> <tr> <td>Jenis Kelamin</td> <td><?php if($qmhs['JKelamin']=="L"){echo "Laki-Laki";}else if($qmhs['JKelamin']=="P"){ echo "Perempuan";}?></td> <td>Telephone/HandPhone</td> <td><?=$qmhs['Telephone']." / ".$qmhs['HandPhone']?></td> </tr> <tr> <td>Alamat</td> <td><?=$qmhs['Alamat']?></td> <td>Email</td> <td><?=$qmhs['Email']?></td> </tr> </table></form></td> </tr> <tr> <td><center>

<button class="btn btn-primary btn-lg" onclick="javascript:AddKRS();"><i class="icon-plus icon-white"></i> Tambah KRS</button></center></td>

</tr> <tr>

<td><table width="100%" class="table bordered table-striped">

<thead> <tr>

<th>#</th>

<th>Kode Matakuliah</th>

<th>Nama Matakuliah <sup>SKS</sup></th> <th>Nama Dosen</th>

<th>Ruangan</th>

<th><sup>Jam Mulai</sup> &rarr; <sub>Jam Selesai</sub></th> <th>&nbsp;</th> </tr> </thead> <tbody> <?php

$qhari = mysql_query("select * from vz_hari order by HariID");

while($rowh=mysql_fetch_array($qhari)){ $qKrs = mysql_query("select

(33)

vzk.KrsId, vzm.MkKode, vzm.Nama as NamaMK, vzm.SKS, vzd.Nama as NamaDosen, vzr.Nama as NamaRuangan, vzr.Kapasitas, vzja.HariID, vzja.JamMulai, vzja.JamSelesai from vz_krs vzk, vz_jadwal vzja, vz_matakuliah vzm, vz_dosen vzd, vz_ruangan vzr where vzk.JadwalId = vzja.JadwalId and vzk.Nim = '$NIM' and vzm.MkId=vzja.MkId

and vzd.IdDosen=vzja.IdDosen

and vzr.RuanganId=vzja.RuanganId and vzja.HariID='$rowh[HariID]'"); $jmlKrs = mysql_num_rows($qKrs);

if($jmlKrs>0){ echo "<tr>

<th colspan='7' style='background-color: #F0F6FD;'> &raquo; ".$rowh['Nama']."</th> </tr>"; $No=0; while($rowk=mysql_fetch_array($qKrs)){ $No++; echo "<tr> <td>".$No."</td> <td>".$rowk['MkKode']."</td> <td>".$rowk['NamaMK']." <sup>".$rowk['SKS']."</sup></td> <td>".$rowk['NamaDosen']."</td> <td>".$rowk['NamaRuangan']."</td> <td><sup>".$rowk['JamMulai']."</sup> &rarr; <sub>".$rowk['JamSelesai']."</sub></td> <td>";?> <a href='?page=krs&id=<?=$rowk['KrsId']?>&act=del' OnClick="return confirm('Yakin Data akan dihapus')"><button class='btn btn-danger btn-small'><i class='icon-trash icon-white'></i></button></a> <?php echo "</td> </tr>"; } } } ?> </tbody> </table></td> </tr> </table> </section> <script language="javascript"> function AddKRS(){ lnk = "pilih.php";

win2 = window.open(lnk, "", "width=1000, height=580, scrollbars, status");

}

(34)

Jika semua script sudah selesai di ketik dan disimpan didalam folder htdocs/krs.

Maka untuk menjalankan programnya ketik http://localhost/krs/index.php

5. Output Program

Gambar 5.0 Home/Profil

(35)

Gambar 5.2 Daftar Form Input Matakuliah

(36)

Gambar 5.1 Form Input Ruangan

(37)
(38)

Gambar 5.1 Daftar Jadwal Matakuliah

(39)

Gambar 5.1 Daftar Kartu Rencanan Studi Permahasiswa

Gambar 5.1 Form Input Kartu Rencanan Studi Permahasiswa

---= Selesai Alhamdulillah =---

Figur

Memperbarui...

Referensi

Memperbarui...

Related subjects :