Skip to content

Instantly share code, notes, and snippets.

@mohamad-supangat
Last active July 26, 2024 06:42
Show Gist options
  • Save mohamad-supangat/ebdf5d750d4479db9c12d28916ebf7e0 to your computer and use it in GitHub Desktop.
Save mohamad-supangat/ebdf5d750d4479db9c12d28916ebf7e0 to your computer and use it in GitHub Desktop.
printjurnal MTS
<?php
ob_start();
require("../../config/database.php");
require("../../config/function.php");
require("../../config/functions.crud.php");
session_start();
// if (!isset($_SESSION['id_user'])) {
// die('Anda tidak diijinkan mengakses langsung');
// }
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="../../../assets/modules/bootstrap/css/bootstrap.min.css">
<title>JURNAL PEMBELAJARAN <?= $setting['tahun_jurnal'] ?></title>
<style>
body {
font-size: 12px;
}
table.table-color {
width: 100%;
border-collapse: collapse;
margin: 10px 0;
font-size: 0.9em;
font-family: sans-serif;
}
table.table-color thead tr th {
text-align: center;
font-weight: bold;
}
table.table-color th,
table.table-color td {
padding: 5px 10px;
vertical-align: top;
border: 1px solid #000;
}
</style>
</head>
<body>
<center>
<div class="text-center">
<div>
JURNAL PEMBELAJARAN KELAS
</div>
<strong>MTs UNGGULAN PP. AMANATUL UMMAH</strong>
<div>TAHUN PELAJARAN <?= $setting['tahun_jurnal'] ?></div>
</div>
</center>
<br />
<div>
Hari / Tanggal : ....................../.......................................
</div>
<table class="table-color">
<thead>
<tr style="background: #d9d9d9">
<th width="30px">JAM</th>
<th width="200px">PUKUL</th>
<th>MATA PELAJARAN</th>
<th>KODE GURU</th>
<th>MATERI</th>
<th>PARAF</th>
</tr>
</thead>
<tbody>
<tr style="background: #DBE7F1; font-weight: bold">
<td align="center">0</td>
<td align="center">06.45 - 07.30</td>
<td align="center" colspan="4">APEL PAGI DAN ISTIGHOSAH</td>
</tr>
<?php
$jam = 7;
$menit = 30;
$jamAkhir = 8;
$menitAkhir = 10;
for ($i = 1; $i <= 7; $i++) {
?>
<tr>
<td align="center"><?= $i ?></td>
<td align="center"><?= str_pad($jam, 2, 0, STR_PAD_LEFT) ?>.<?= $menit ?> - <?= str_pad($jamAkhir, 2, 0, STR_PAD_LEFT) ?>.<?= $menitAkhir ?></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<?php
$jam = $jamAkhir;
$menit = $menitAkhir;
if ($menitAkhir == 10) {
$menitAkhir = 50;
} elseif ($menitAkhir == 50) {
$menitAkhir = 30;
$jamAkhir++;
} elseif ($menitAkhir == 30) {
$menitAkhir = 10;
$jamAkhir++;
}
}
?>
<tr style="background: #DBE7F1;font-weight: bold">
<td align="center"></td>
<td align="center">12.10 - 13.00</td>
<td align="center" colspan="4">ISTIRAHAT, SHOLAT DHUHUR BERJAMAAH, MAKAN SIANG</td>
</tr>
<tr style="background: #DBE7F1;font-weight: bold">
<td align="center"></td>
<td align="center">13.00 - 13.30</td>
<td align="center" colspan="4">APEL SIANG DAN ISTIGHOSAH</td>
</tr>
<?php
$jam = 13;
$menit = 30;
$jamAkhir = 14;
$menitAkhir = 10;
for ($i = 8; $i <= 11; $i++) {
?>
<tr>
<td align="center"><?= $i ?></td>
<td align="center"><?= str_pad($jam, 2, 0, STR_PAD_LEFT) ?>.<?= $menit ?> - <?= str_pad($jamAkhir, 2, 0, STR_PAD_LEFT) ?>.<?= $menitAkhir ?></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<?php
$jam = $jamAkhir;
$menit = $menitAkhir;
if ($menitAkhir == 10) {
$menitAkhir = 50;
} elseif ($menitAkhir == 50) {
$menitAkhir = 30;
$jamAkhir++;
} elseif ($menitAkhir == 30) {
$menitAkhir = 10;
$jamAkhir++;
}
}
?>
<tr style="background: #DBE7F1; font-weight: bold">
<td colspan="6">GURU PENGGANTI JAM KOSONG</td>
</tr>
<?php
for ($i = 1; $i <= 5; $i++) {
?>
<tr>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<?php
}
?>
</tbody>
</table>
<div>*) Jika Nama Tidak Terdapat Di Absen, Mohon TUlis Di Absen / Konfirmasi ke Kantor Bagian TU</div>
<table class="table-color">
<thead>
<tr style="background: #d9d9d9">
<th rowspan="2" width="30px">No</th>
<th rowspan="2">Nama</th>
<th rowspan="2">Program</th>
<th colspan="11">Jam Ke -</th>
</tr>
<tr style="background: #d9d9d9">
<?php
for ($i = 1; $i <= 11; $i++) {
echo "<th width='10px'>{$i}</th>";
} ?>
</tr>
</thead>
<tbody>
<?php
$asrama = $_GET['asrama'] ?? '8A-(siswa lama)';
$query = mysqli_query($koneksi, "select * from daftar WHERE `status` = '1' AND `asrama` = '{$asrama}' order by nama asc");
$no = 0;
while ($daftar = mysqli_fetch_array($query)) {
$no++;
echo "<tr>";
echo "<td align='center'>{$no}</td>";
$nama = strtoupper($daftar['nama']);
echo "<td>{$nama}</td>";
$jurusan = strtoupper($daftar['jurusan']);
echo "<td align='center'>{$jurusan}</td>";
for ($i = 1; $i <= 11; $i++) {
echo "<td>&nbsp;</td>";
}
echo "</tr>";
}
?>
</tbody>
</table>
</body>
</html>
<?php
$html = ob_get_clean();
require_once '../../vendor/autoload.php';
use Dompdf\Dompdf;
$dompdf = new Dompdf();
$dompdf->loadHtml($html);
$dompdf->setPaper('F4', 'portrait');
$dompdf->render();
$dompdf->stream("JURNAL PEMBELAJARAN KELAS.pdf", array("Attachment" => false));
exit(0);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment