| Server IP : 172.67.187.206 / Your IP : 172.71.28.156 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 : /Inetpub/www/news/elearning/ |
Upload File : |
<?php
require './configs/app_top.php';
include './configs/host.php';
$sql1 = "select count(*) as count FROM " . TBL_SUBJECTS . " s INNER JOIN " . TBL_CATEGORY . " c ON s.`sb_category_id` = c.`ct_id` WHERE s.`active`='yes'";
try {
$stmt = $DB->prepare($sql1);
$stmt->execute();
$results = $stmt->fetchAll();
$total = $results[0]["count"];
$pagination = new Pagination($total, $_GET["pagenum"], 10);
$total_pages = $pagination->total_pages();
if ($total_pages > 0) {
$sql2 = "select s.`sb_id`, s.`sb_name`, s.`sb_category_id`, s.`sb_teacher`,s.`start_date`,s.`end_date`,s.`active`, c.`ct_name`, `sb_duration` , `sb_index` "
. "FROM " . TBL_SUBJECTS . " s INNER JOIN " . TBL_CATEGORY . " c ON s.`sb_category_id` = c.`ct_id` "
. "WHERE s.`active`='yes' ORDER BY s.sb_name ASC "
. "LIMIT " . $pagination->get_lower_limit() . " , " . 10 . "";
$stmt = $DB->prepare($sql2);
$stmt->execute();
$results = $stmt->fetchAll();
}
} catch (Exception $ex) {
echo $ex->getMessage();
}
?>
<?php if ($ERROR_TYPE <> "") { ?>
<div class="col-20">
<div class="alert alert-<?php echo $ERROR_TYPE; ?>">
<button data-dismiss="alert" class="close" type="button">×</button>
<?php echo $ERROR_MSG; ?>
</div>
</div>
<?php } ?>
<div class="padding2 clearfix"></div>
<?php if ($total_pages > 0) { ?>
<div class="container">
<table class="table table-hover table-datatable table-striped table-bordered">
<thead>
<tr>
<th style="text-align: left; ">ชื่อวิชา</th>
<th style="text-align: center; ">ผลสอบ</th>
<th style="text-align: center; ">ระดับชั้น</th>
<th style="text-align: center; ">จำนวน</th>
<th style="text-align: center; ">เวลาสอบ</th>
<th style="text-align: center; ">เปิดสอบ</th>
<th style="text-align: center; ">ครูประจำวิชา</th>
</tr>
</thead>
<tbody>
<?php foreach ($results as $r) { ?>
<tr>
<?php if ($r["active"] == "yes") { ?>
<td style="text-align: left;">
<a href="<?php echo generate_site_link("exams_start", "s=".$r["sb_id"]."&stat=".$r["sb_index"]); ?>"> <?php echo safe_output($r["sb_name"]); ?></a></td>
<td style="text-align: center;">
<?php
$subjectid=$r["sb_id"];
$chk_stu="SELECT * FROM exp_test_results WHERE tr_subject_id ='$subjectid' ";
$result2=mysql_query($chk_stu);
$total2=mysql_num_rows($result2);
if ($total2 > 0) {
?>
<a href="score_subject.php?s=<?php echo $r["sb_id"]; ?>"><span class="glyphicon glyphicon-eye-open"></span></a>
<?php
} else { echo "<span class='glyphicon glyphicon-eye-close'></span> ";}
?>
</td>
<?php
$start_date=$r["start_date"];
$end_date=$r["end_date"];
$today = strtotime(date("Y-m-d H:i"));
$start = strtotime("$start_date");
$end = strtotime("$end_date");
?>
<td style="text-align: center;"><?php if ($today >= $start && $today <= $end) { echo "<font color='#248f24'>"; } else {echo "<font color=''>";}?><?php echo safe_output($r["ct_name"]) ?><?php echo "</font>"; ?></td>
<td style="text-align: center;"><?php echo safe_output($r["sb_index"]) ?>ข้อ</td>
<td style="text-align: center;"><?php echo safe_output($r["sb_duration"]) ?> นาที</td>
<td style="text-align: center;"><a href="<?php echo generate_site_link("exams_start", "s=".$r["sb_id"]."&stat=".$r["sb_index"]); ?>">
<?php if ($today >= $start && $today <= $end) { echo "<button type='button' class='btn btn-xs btn-warning'>"; } else {echo "<button type='button' class='btn btn-xs btn-default'>";}?>
<font color="#009900"><?php echo safe_output($r["start_date"]) ?></font><?php echo "</button></a>"; ?></td>
<td style="text-align: center;"><?php echo safe_output($r["sb_teacher"]) ?></td>
<?php } else { ?>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="col-12 center">
<ul class="pagination">
<?php $pagination->display_links($PAGE_NAME); ?>
</ul>
</div>
<?php } else { ?>
<h3>ไม่พบแบบทดสอบในฐานข้อมูล.</h3>
<?php } ?>
</div>
<script>
jQuery(function() {
jQuery('#confirm-delete').on('show.bs.modal', function(e) {
jQuery(this).find('.danger').attr('href', jQuery(e.relatedTarget).data('href'));
});
});
</script>
</div>
</div>