Mini Shell
<?php
include '../db/database.php';
include '../mpdf/mpdf.php';
include 'function_show.php';
ob_start();
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="text-center">
<img src="dist/img/logoccp.gif" width="92px">
</div>
<?php
$class = $_GET['itemname'];
if(empty($class)){
$sql = "SELECT * FROM teacher AS t1 INNER JOIN title_name AS t2 ON (t1.titleID = t2.titleID) where (status_user = 1 or status_user = 2 or status_user = 3) and class LIKE '%{$class}%'AND class > '0' order By teacherID DESC";
}else{
$sql = "SELECT * FROM teacher AS t1 INNER JOIN title_name AS t2 ON (t1.titleID = t2.titleID) where (status_user = 1 or status_user = 2 or status_user = 3) and class = '$class' order By teacherID DESC ";
}
$query = mysqli_query($link,$sql);
$row = mysqli_num_rows($query);
if(empty($class)){
$academic_name = "แสดงทั้งหมด";
}else{
$academic_name = $class;
}
?>
<h3 class="text-center"><strong>โรงเรียนเทศบาลวัดชัยชุมพล เทศบาลเมืองทุ่งสง<strong></h3><strong>
<h4 class="text-center"><strong>รายงานข้อมูลบุคลากรตามสายชั้นปีที่ <?php echo $academic_name; ?><strong></h4><strong>
<h4 class="text-center"><strong>ทั้งหมด <?php echo $row ?> คน<strong></h4><strong>
<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 TelFormat($result['telephone']);?></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 -->
</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','D');
exit;
?>
</body>
</html>
Zerion Mini Shell 1.0