| Server IP : 216.106.184.20 / Your IP : 216.73.216.234 Web Server : LiteSpeed System : Linux asmodeus.in-hell.com 5.14.0-570.58.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 29 06:24:11 EDT 2025 x86_64 User : sekoaid1 ( 1891) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/sekoaid1/spp.raudhatulfalah.sch.id/admin/ |
Upload File : |
<?php if ($_GET[act] == '') { ?>
<div class="col-xs-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title"> Data Tahun Pelajaran </h3>
<a class='pull-right btn btn-primary btn-sm' href='index.php?view=tahun&act=tambah'>Tambahkan Data Tahun Pelajaran</a>
</div><!-- /.box-header -->
<div class="box-body">
<?php
if (isset($_GET['sukses'])) {
echo "<div class='alert alert-success alert-dismissible fade in' role='alert'>
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>×</span></button> <strong>Sukses!</strong> - Data telah Berhasil Di Proses,..
</div>";
} elseif (isset($_GET['gagal'])) {
echo "<div class='alert alert-danger alert-dismissible fade in' role='alert'>
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>×</span></button> <strong>Gagal!</strong> - Data tidak Di Proses, terjadi kesalahan dengan data..
</div>";
}
?>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>No</th>
<th>Tahun Ajaran</th>
<th>Aktif</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php
$tampil = mysql_query("SELECT * FROM tahun_ajaran ORDER BY idTahunAjaran DESC");
$no = 1;
while ($r = mysql_fetch_array($tampil)) {
if ($r['aktif'] == 'T') {
$a = 'Y';
$icon = "fa-close";
$btn = "btn-danger";
$alt = "Aktifkan";
$onoff = "<a class='btn $btn btn-xs' title='$alt' href='?view=tahun&act=onoff&id=$r[idTahunAjaran]&a=$a'><span class='fa $icon'></span></a>";
} else {
$icon = "fa-check";
$btn = "btn-success";
$onoff = "<a class='btn $btn btn-xs' href='#'><span class='fa $icon'></span></a>";
}
echo "<tr><td>$no</td>
<td>$r[nmTahunAjaran]</td>
<td>$onoff</td>
<td><center>
<a class='btn btn-success btn-xs' title='Edit Data' href='?view=tahun&act=edit&id=$r[idTahunAjaran]'><span class='glyphicon glyphicon-edit'></span></a>
<a class='btn btn-danger btn-xs' title='Delete Data' href='?view=tahun&hapus&id=$r[idTahunAjaran]' onclick=\"return confirm('Apa anda yakin untuk hapus Data ini?')\"><span class='glyphicon glyphicon-remove'></span></a>
</center></td>";
echo "</tr>";
$no++;
}
if (isset($_GET[hapus])) {
mysql_query("DELETE FROM tahun_ajaran where idTahunAjaran='$_GET[id]'");
echo "<script>document.location='index.php?view=tahun';</script>";
}
?>
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
<?php
} elseif ($_GET[act] == 'onoff') {
$query = mysql_query("UPDATE tahun_ajaran SET aktif='Y' where idTahunAjaran = '$_GET[id]'");
mysql_query("UPDATE tahun_ajaran SET aktif='T' where idTahunAjaran != '$_GET[id]'");
if ($query) {
echo "<script>document.location='index.php?view=tahun';</script>";
} else {
echo "<script>document.location='index.php?view=tahun';</script>";
}
} elseif ($_GET[act] == 'edit') {
if (isset($_POST[update])) {
$query = mysql_query("UPDATE tahun_ajaran SET nmTahunAjaran='$_POST[nmTahun]' where idTahunAjaran = '$_POST[id]'");
//, aktif='$_POST[aktif]'
if ($query) {
echo "<script>document.location='index.php?view=tahun&sukses';</script>";
} else {
echo "<script>document.location='index.php?view=tahun&gagal';</script>";
}
}
$edit = mysql_query("SELECT * FROM tahun_ajaran where idTahunAjaran='$_GET[id]'");
$record = mysql_fetch_array($edit);
?>
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title"> Edit Data Tahun Pelajaran </h3>
</div><!-- /.box-header -->
<div class="box-body">
<form method="post" action="" class="form-horizontal">
<input type="hidden" name="id" value="<?php echo $record['idTahunAjaran']; ?>">
<div class="form-group">
<label for="" class="col-sm-2 control-label">Tahun Ajaran</label>
<div class="col-sm-6">
<input type="text" name="nmTahun" maxlength="9" class="form-control" value="<?php echo $record['nmTahunAjaran']; ?>" required>
</div>
</div>
<!--<div class="form-group">
<label for="" class="col-sm-2 control-label">Aktif</label>
<div class="col-sm-4">
<select name="aktif" class="form-control">
<option value="<?php echo $record['aktif']; ?>"><?php echo $record['aktif']; ?></option>
<option value="Y">Y</option>
<option value="T">T</option>
</select>
</div>
</div>-->
<div class="form-group">
<label for="" class="col-sm-2 control-label"></label>
<div class="col-sm-10">
<input type="submit" name="update" value="Update" class="btn btn-success">
<a href="index.php?view=tahun" class="btn btn-default">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</div>
<?php
} elseif ($_GET[act] == 'tambah') {
if (isset($_POST[tambah])) {
$query = mysql_query("INSERT INTO tahun_ajaran(nmTahunAjaran) VALUES('$_POST[nmTahun]')");
if ($query) {
echo "<script>document.location='index.php?view=tahun&sukses';</script>";
} else {
echo "<script>document.location='index.php?view=tahun&gagal';</script>";
}
}
?>
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title"> Tambah Data Tahun Ajaran </h3>
</div><!-- /.box-header -->
<div class="box-body">
<form method="POST" action="" class="form-horizontal">
<div class="form-group">
<label for="" class="col-sm-2 control-label">Tahun Anggaran</label>
<div class="col-sm-6">
<input type="text" name="nmTahun" maxlength="9" class="form-control" id="" placeholder="0000/9999" required>
</div>
</div>
<!--<div class="form-group">
<label for="" class="col-sm-2 control-label">Aktif</label>
<div class="col-sm-4">
<select name="aktif" class="form-control">
<option value="Y">Y</option>
<option value="T">T</option>
</select>
</div>
</div>-->
<div class="form-group">
<label for="" class="col-sm-2 control-label"></label>
<div class="col-sm-10">
<input type="submit" name="tambah" value="Simpan" class="btn btn-success">
<a href="index.php?view=tahun" class="btn btn-default">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</div>
<?php
}
?>