| Server IP : 104.21.80.248 / Your IP : 162.159.115.41 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/www/news/datacenter/admin/report/ |
Upload File : |
<?php
require_once("setPDF.php"); // ไฟล์สำหรับกำหนดรายละเอียด pdf
require_once('../config.php');
// เพิ่มหน้าใน PDF
$class = $mysqli->escape_string($_GET['class']);
$room = $mysqli->escape_string($_GET['room']);
$SQLx = $mysqli->query("SELECT * FROM setting_term WHERE sactive='yes'");
$Rowx = mysqli_fetch_array($SQLx);
$term = $Rowx['term'];
$year = $Rowx['syear'];
$pdf->SetTitle('รายงาน PDF'); //Titlo del pdf
$pdf->setPrintHeader(false); //หัวกระดาษ
$pdf->setPrintFooter(true); //No se imprime pie de pagina
$pdf->SetMargins(15, 12, 15, false); //ตั้งค่าระยะห่างจากหัวกระดาษ
$pdf->SetAutoPageBreak(true, 12); //Se define un salto de pagina con un limite de pie de pagina
$pdf->AddPage();
// กำหนด HTML code หรือรับค่าจากตัวแปรที่ส่งมา
// กรณีกำหนดโดยตรง
// ตัวอย่าง กรณีรับจากตัวแปร
// $htmlcontent =$_POST['HTMLcode'];
//$htmlcontent='<p>ทดสอบการแปลงไฟล์</p>';
$htmlcontent=stripslashes($htmlcontent);
$htmlcontent=AdjustHTML($htmlcontent);
// สร้างเนื้อหาจาก HTML code
$tbl1 = <<<EOD
รายงานลักษณะการเรียนรู้ของนักเรียน
EOD;
$user1 = <<<EOD
ระดับชั้น$class/$room ปีการศึกษา $term/$year
EOD;
$html = '<table width="560" style="border:1px solid;">
<thead>
<tr>
<th style=" width:50px;" align="center"><b>ลำดับที่</b></th>
<th style=" width:80px;" align="center"><b>เลขประจำตัว</b></th>
<th style=" width:230px;" align="center"><b>ชื่อ-สกุล</b></th>
<th style=" width:150px;" align="center"><b>วิธีการเรียนรู้</b></th>
</tr></thead><tbody>';
$sql2m = "SELECT * FROM history where class='$class' AND room='$room' AND sta='yes' ORDER BY no ASC";
$dbquery2m = $mysqli->query($sql2m);
$i = 0;
while($row2=mysqli_fetch_array($dbquery2m)) {
$stucode=$row2['stucode'];
$prefix=$row2['prefix'];
$name=$row2['name'];
$sname=$row2['sname'];
$no=$row2['no'];
$i++;
//visual การมองเห็นหรือดูด้วยตา
$sql2= $mysqli->query("SELECT * FROM yark_ans where stucode='$stucode' AND ans='V' AND term='$term' AND year='$year' ");
$total_V=mysqli_num_rows($sql2);
//Aural การได้ยินได้ฟัง
$sql3= $mysqli->query("SELECT * FROM yark_ans where stucode='$stucode' AND ans='A' AND term='$term' AND year='$year' ");
$total_A=mysqli_num_rows($sql3);
//Read/write การอ่านการจดบันทึก
$sql4= $mysqli->query("SELECT * FROM yark_ans where stucode='$stucode' AND ans='R' AND term='$term' AND year='$year' ");
$total_R=mysqli_num_rows($sql4);
//Kinesthetic การลงมือปฏิบัติ
$sql5= $mysqli->query("SELECT * FROM yark_ans where stucode='$stucode' AND ans='K' AND term='$term' AND year='$year' ");
$total_K=mysqli_num_rows($sql5);
$html .= '<tr>
<td style="width:50px;" align="center">'.$i.'</td>
<td style="width:80px;" align="center"> <center>'.$stucode.'</center> </td>';
$html .= '<td style="width:230px;"> '.$prefix.''.$name.' '.$sname.'</td>';
$html .= '<td style="width:150px;"> ';
if($total_V > $total_A && $total_V > $total_R && $total_V > $total_K) {
$html .= 'การมองเห็นหรือดูด้วยตา';
}else if($total_A > $total_V && $total_A > $total_R && $total_A > $total_K){
$html .= 'การได้ยินได้ฟัง';
}else if($total_R > $total_A && $total_R > $total_V && $total_R > $total_K){
$html .= 'การอ่านการจดบันทึก';
}else if($total_K > $total_V && $total_K > $total_A && $total_K > $total_R){
$html .= 'การลงมือปฏิบัติ';
}
$html .= '</td>';
$html .= '</tr>';
}
$html .= '</tbody></table>';
// เลื่อน pointer ไปหน้าสุดท้าย
$pdf->Ln(-3);
$pdf->SetFont('th-sarabun','b',24);
$pdf->Cell(0, 0, $tbl1, 0, 0, 'C');
$pdf->Ln(10);
$pdf->SetFont('th-sarabun','b',16);
$pdf->Cell(0, 0, $user1, 0, 0, 'C');
$pdf->Ln(12);
$pdf->SetFont('','',14.6,'','','L');
$pdf->writeHTML($html, true, 0, true, 0);
$pdf->lastPage();
// ปิดและสร้างเอกสาร PDF
ob_end_clean();
$today = date("dmY");
$pdf->Output('Yark-Report'.$today.'.pdf', 'I');
?>