Skip to content

Commit

Permalink
Version 3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jgogo01 committed Aug 22, 2022
1 parent 55f5d88 commit 0985189
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
13 changes: 9 additions & 4 deletions admin_pj.php
Original file line number Diff line number Diff line change
Expand Up @@ -909,11 +909,11 @@ className : 'btn btn-warning'}
<!-- Lock Type/Size Upload - Excel-->
<script>
$("#file").change(function () {
var extall="csv,xlxs";
var extall="csv,xlsx";
file = document.import.file.value;
ext = file.split('.').pop().toLowerCase();
if(parseInt(extall.indexOf(ext)) < 0){
swal("พบข้อผิดพลาด!", "กรุณาอัปโหลดไฟล์ xlxs, csv เท่านั้น", {
swal("พบข้อผิดพลาด!", "กรุณาอัปโหลดไฟล์ xlsx, csv เท่านั้น", {
icon : "warning",
buttons: {
confirm: {
Expand All @@ -930,8 +930,13 @@ className : 'btn btn-warning'}
</script>




<!-- Srcript Print Cer -->
<script>
function PrintCer(id) {
var idpj = <?= $_GET['id'] ?> ;
window.open('print.php?id=' + idpj +'&'+ 'learn=' + id, '_blank')
}
</script>


<script>
Expand Down
21 changes: 20 additions & 1 deletion print.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
session_start();
require('connect.php');
require('structure/numthai.php');
require_once __DIR__ . '/vendor/autoload.php';
Expand All @@ -16,12 +17,16 @@
$num_ck_id = mysqli_num_rows($result_ck_id);

if($num_ck_id == 0){
$msg = "ไม่พบเกียรติบัตรของท่าน [ERR-CER]";
$_SESSION['msg_a'] = $msg;
header("location:index.php");
}


}
else{
$msg = "ไม่พบเกียรติบัตรของท่าน [ERR-CER]";
$_SESSION['msg_a'] = $msg;
header("location:index.php");
}

Expand All @@ -39,12 +44,16 @@
$num_ck_learn = mysqli_num_rows($result_ck_learn);

if($num_ck_learn == 0){
$msg = "ไม่พบเกียรติบัตรของท่าน [ERR-CER]";
$_SESSION['msg_a'] = $msg;
header("location:index.php");
}


}
else{
$msg = "ไม่พบเกียรติบัตรของท่าน [ERR-CER]";
$_SESSION['msg_a'] = $msg;
header("location:index.php");
}

Expand All @@ -64,7 +73,17 @@
$img_data = $row_img['tempate'];
break;
}

if(empty($img_data)){
if(isset($_SESSION['username'])){
$msg = "กรุณาอัปโหลดเทมเพลต [ERR-TP-CER]";
$_SESSION['msg_w'] = $msg;
header("location:admin_pj.php?id=$idpj");
}else{
$msg = "เกียรติบัตรยังไม่เผยแพร่ [ERR-CER-PC]";
$_SESSION['msg_a'] = $msg;
header("location:index.php");
}
}
}


Expand Down
10 changes: 5 additions & 5 deletions sql/admin/loadlearn.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
$table = 'user';
$primaryKey = 'id';


// รับค่า ID จาก index.php
if(isset($_GET['id'])){
$id = mysqli_real_escape_string($con, $_GET['id']);
} else {
$id = '';
}

$columns = array(
array( 'db' => 'id', 'dt' => 0 ),
array( 'db' => 'name', 'dt' => 1 ),
Expand All @@ -20,7 +19,9 @@
'db' => 'id',
'dt' => 3,
'formatter' => function( $d, $row ) {
return '<button type="button" class="btn btn-sm btn-warning" data-toggle="modal" data-target="#EditLearn" data-whatever="'.$d.'"><i class="far fa-edit"></i></button>
return '
<button type="button" onclick="PrintCer('.$d.')" class="btn btn-sm btn-primary"><i class="fas fa-print"></i></button>
<button type="button" class="btn btn-sm btn-warning" data-toggle="modal" data-target="#EditLearn" data-whatever="'.$d.'"><i class="far fa-edit"></i></button>
<button type="button" data-toggle="modal" data-target="#DeleteLearn" data-whatever="'.$d.'" class="btn btn-sm btn-danger"> <i class="fas fa-trash"></i></button>';
})
);
Expand All @@ -31,8 +32,7 @@
'db' => $db,
'host' => $host
);



require( '../../datatable/ssp.class.php' );

echo json_encode(
Expand Down

0 comments on commit 0985189

Please sign in to comment.