| Server IP : 104.21.80.248 / Your IP : 172.71.28.155 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/admin/ |
Upload File : |
<?php
require '../configs/app_top.php';
if(!is_admin_logged_in()) { redirect(generate_admin_link("login")); exit;}
if ($_GET["mode"] == "add") {
$title = "เพิ่มรายวิชา";
} else {
$title = "แก้ไขรายวิชา";
try {
$sql2 = "select `sb_id`, `sb_name`, `sb_category_id`, `sb_duration`,`sb_index`,`sb_count`,`sb_teacher`,`start_date`,`end_date`, `active`, `idam` "
. "FROM " . TBL_SUBJECTS. " WHERE 1 AND sb_id = :id LIMIT 1";
$stmt = $DB->prepare($sql2);
$stmt->bindValue(":id", safe_input($_GET["id"]));
$stmt->execute();
$results = $stmt->fetchAll();
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
try {
$sql2 = "select `ct_id`, `ct_name` "
. "FROM " . TBL_CATEGORY . " WHERE 1 ORDER BY ct_name ASC ";
$stmt = $DB->prepare($sql2);
$stmt->execute();
$cresults = $stmt->fetchAll();
} catch (Exception $ex) {
echo $ex->getMessage();
}
include './includes/header.php';
?>
<link href="date/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="date/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
<!-- GLOBAL STYLES -->
<link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="assets/css/main.css" />
<link rel="stylesheet" href="assets/css/theme.css" />
<link rel="stylesheet" href="assets/css/MoneAdmin.css" />
<link rel="stylesheet" href="assets/plugins/Font-Awesome/css/font-awesome.css" />
<!--END GLOBAL STYLES -->
<?php if ($ERROR_TYPE <> "") { ?>
<div class="col-12">
<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="clearfix"></div>
<div class="row">
<div class="col-12">
<div class="panel panel-info">
<div class="panel-heading"><span class="glyphicon glyphicon-edit"></span> <?php echo $title; ?></div>
<div class="panel-body">
<div class="margin10">
<form class="form-horizontal" name="form1" id="form1" action="<?php echo generate_admin_link("subjects_auth"); ?>" method="post">
<input type="hidden" name="mode" value="<?php echo ($_GET["mode"] == "add") ? "add_new" : "update"; ?>">
<input type="hidden" name="id" value="<?php echo safe_input($_GET["id"]); ?>">
<input type="hidden" name="pagenum" value="<?php echo safe_input($_GET["pagenum"]); ?>">
<fieldset>
<div class="form-group">
<label class="col-2 control-label" for="sb_name"><span class="required">*</span>ชื่อวิชา : </label>
<div class="col-6">
<input type="text" placeholder="ง20204 เทคโนโลยีสารสนเทศ" id="sb_name" autocomplete="off" name="sb_name" class="form-control" value="<?php echo $results[0]["sb_name"]; ?>">
</div>
</div>
<div class="form-group">
<label class="col-2 control-label" for="category"><span class="required">*</span>ระดับชั้น : </label>
<div class="col-4">
<select class="form-control" name="category" id="category">
<option value="">เลือก</option>
<?php
foreach ($cresults as $cr) {
$s = ( $results[0]["sb_category_id"] == $cr["ct_id"] ) ? 'selected="selected"' : "";
echo '<option value="' . safe_output($cr["ct_id"]) . '" ' . $s . ' >' . safe_output($cr["ct_name"]) . '</option>';
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-2 control-label" for="sb_duration"><span class="required">*</span>เวลาสอบ : </label>
<div class="col-2">
<div class="input-group">
<input type="text" placeholder="15" id="sb_duration" autocomplete="off" name="sb_duration" class="form-control" value="<?php echo $results[0]["sb_duration"]; ?>">
<span class="input-group-addon">
นาที
</span>
</div>
<span for="sb_duration" generated="true" class="help-inline" style="display: none;">ห้ามว่าง</span>
</div>
</div>
<div class="form-group">
<label class="col-2 control-label" for="sb_duration"><span class="required">*</span>จำนวนข้อสอบ : </label>
<div class="col-2">
<div class="input-group">
<input type="text" placeholder="10" id="sb_index" autocomplete="off" name="sb_index" class="form-control" value="<?php echo $results[0]["sb_index"]; ?>">
<span class="input-group-addon">
ข้อ
</span>
</div>
<span for="sb_index" generated="true" class="help-inline" style="display: none;">ห้ามว่าง</span>
</div>
</div>
<div class="form-group">
<label class="col-2 control-label" for="sb_count"><span class="required">*</span>นักเรียนสอบได้ : </label>
<div class="col-2">
<div class="input-group">
<input type="text" placeholder="3" id="sb_count" autocomplete="off" name="sb_count" class="form-control" value="<?php echo $results[0]["sb_count"]; ?>">
<span class="input-group-addon">
ครั้ง
</span>
</div>
<span for="sb_count" generated="true" class="help-inline" style="display: none;">ห้ามว่าง</span>
</div>
</div>
<div class="form-group">
<label class="col-2 control-label" for="sb_teacher"><span class="required">*</span>ครูประจำวิชา : </label>
<div class="col-4">
<input type="text" placeholder="เสรี โพธิ์นิล" id="sb_teacher" autocomplete="off" name="sb_teacher" class="form-control" value="<?php echo $results[0]["sb_teacher"]; ?>">
</div>
</div>
<?php
$settime=date("Y/m/d H:i");
?>
<div class="form-group">
<label class="col-2 control-label" for="start_date"><span class="required">*</span>เริ่มสอบ : </label>
<div class="input-group date form_datetime col-md-3" data-link-field="start_date">
<input class="form-control" placeholder="<?php echo "$settime"; ?>" value="<?php echo $results[0]["start_date"]; ?>" size="16" type="text" value="" name="start_date" >
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
</div>
<input type="hidden" id="start_date" value="" />
</div>
<div class="form-group">
<label class="col-2 control-label" for="start_date"><span class="required">*</span>สิ้นสุด : </label>
<div class="input-group date form_datetime col-md-3" data-link-field="end_date">
<input class="form-control" placeholder="<?php echo "$settime"; ?>" value="<?php echo $results[0]["end_date"]; ?>" size="16" type="text" value="" name="end_date">
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
</div>
<input type="hidden" id="end_date" value="" />
</div>
<div class="form-group">
<label class="col-2 control-label" for="is_active"><span class="required">*</span>สถานะ : </label>
<div class="col-6">
<label style="margin-top: 5px;">
<input type="checkbox" value="yes" id="is_active" name="is_active" <?php echo ($_GET["mode"] == "add") ? "checked" : ""; ?> <?php echo ($_GET["mode"] == "edit" && $results[0]["active"] == "yes") ? "checked" : ""; ?> > เปิดสอบ
</label>
</div>
</div>
<div class="form-group">
<div class="col-10 col-offset-2">
<button class="btn btn-primary" type="submit">บันทึก</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="<?php echo get_admin_url(); ?>js/jquery.validate.js"></script>
<script type="text/javascript">
jQuery().ready(function() {
// validate signup form on keyup and submit
jQuery("#form1").validate({
rules: {
sb_name: {
required: true,
minlength: 1
},
category: {
required: true,
},
sb_duration: {
required: true,
number: true,
},
},
errorElement: "span",
errorClass: "help-inline",
onkeyup: false,
onfocusout: true,
onclick: false,
onfocusin: false,
highlight: function(element) {
jQuery(element).parent().parent().removeClass("has-success");
jQuery(element).closest('div').parent().addClass("has-error");
},
unhighlight: function(element) {
jQuery(element).parent().parent().removeClass("has-error");
jQuery(element).closest('div').parent().addClass("has-success");
}
});
});
</script>
<script type="text/javascript" src="date/jquery/jquery-1.8.3.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="date/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="date/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="date/js/locales/bootstrap-datetimepicker.fr.js" charset="UTF-8"></script>
<script type="text/javascript">
$('.form_datetime').datetimepicker({
//language: 'fr',
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
forceParse: 0,
showMeridian: 1
});
$('.form_date').datetimepicker({
language: 'fr',
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
minView: 2,
forceParse: 0
});
$('.form_time').datetimepicker({
language: 'fr',
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 1,
minView: 0,
maxView: 1,
forceParse: 0
});
</script>
<?php
include './includes/footer.php';
require '../configs/app_bottom.php';
?>