Mini Shell
<?php
include '../db/database.php';
include '../mpdf/mpdf.php';
ob_start();
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="text-center">
<img src="dist/img/logoccp.gif" width="92px">
</div>
<?php
$education = $_GET['itemname'];
if(empty($education)){
}else{
$sql = "SELECT * FROM teacher
INNER JOIN title_name AS t1 ON t1.titleID = teacher.titleID AND teacher.titleID = t1.titleID
INNER JOIN education AS t2 ON t2.teacheredID = teacher.teacherID
INNER JOIN level_education AS t3 ON t2.levelID = t3.levelID
where (status_user = 1 or status_user = 2 or status_user = 3) and t2.levelID = $education ";
$query = mysqli_query($link,$sql);
$row = mysqli_num_rows($query);
if($education == '1'){
$education_name = "ต่ำกว่าปริญญาตรี";
}else if($education == '2') {
$education_name = "ปริญญาตรี";
}else if($education == '3') {
$education_name = "ปริญญาโท";
}else if($education == '4') {
$education_name = "ปริญญาเอก";
}else if($education == '5') {
$education_name = "อื่นๆ";
}
?>
<h3 class="text-center"><strong>โรงเรียนเทศบาลวัดชัยชุมพล เทศบาลเมืองทุ่งสง</strong></h3>
<h4 class="text-center"><strong>รายงานข้อมูลบุคลากรตามวุฒิการศึกษา <?php echo $education_name; ?></strong></h4>
<h4 class="text-center"><strong>ทั้งหมด <?php echo $row ?> คน</strong></h4>
<section class="content">
<div class="col-md-8 col-md-offset-2">
<div class="table-responsive">
<table align="center"id="mytable" class="table table-bordered">
<thead >
<tr class="active">
<th class="text-center">ลำดับ</th>
<th>ชื่อ-นามสกุล</th>
<th>วิชาเอก</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
if(!empty($row)){
while ($result = mysqli_fetch_assoc($query)) { ?>
<tr>
<td class="text-center"><?php echo $i;?></td>
<td><?php echo $result['titleName']. $result['name'];?> <?php echo $result['lastName'];?></td>
<td><?php echo $result['degreeSubject'];?></td>
</tr>
<?php $i++; } ?>
<?php
}else if(empty($row)){
?>
<tr>
<th colspan="3" align="center"><i class="fa fa-folder-open"></i> ไม่พบข้อมูล</th>
</tr>
<?php } ?>
</tbody>
</table>
</div><!-- /.box-body -->
<div class="box-footer">
</div><!-- box-footer -->
</div><!-- /.box -->
<?php
}
?>
</section><!-- /.content -->
<?php
include 'function_datethai.php';
date_default_timezone_set("Asia/Bangkok");
$eng_date=time();
?>
<?php
$html = ob_get_contents();
ob_end_clean();
$mpdf=new mPDF('utf-8');
$mpdf->margin_header = 9;
$mpdf->SetHeader('รายงานโดย โรงเรียนเทศบาลวัดชัยชุมพล | รายงานข้อมูลบุคลากรตามวุฒิการศึกษา | ออกรายงานเมื่อ: '.thai_date($eng_date));
$mpdf->margin_footer = 9;
$mpdf->SetFooter('หน้าที่ {PAGENO}');
// Define a Landscape page size/format by name
//$mpdf=new mPDF('utf-8', 'A4-L');
// Define a page size/format by array - page will be 190mm wide x 236mm height
//$mpdf=new mPDF('utf-8', array(190,236));
$stylesheet = file_get_contents('./bootstrap/css/printpdf.css');
//$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($html,2);
//$mpdf->Output();
$mpdf->Output(time().'.pdf','I');
exit;
?>
</body>
</html>
Zerion Mini Shell 1.0