2 Star 0 Fork 1

XiaoSK/DB2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
admincp.php 8.64 KB
一键复制 编辑 原始数据 按行查看 历史
XiaoSK 提交于 2014-05-28 14:53 . Release
<?
require 'ctrl/conn.php';
if($_SESSION['class'] != '3') {
require 'logout.php';
exit();
}
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>管理面板 - 上海大学选课系统</title>
<script type="text/javascript" src="static/jquery.min.js"></script>
<script type="text/javascript">
function msg(w, m){
var notify = window.webkitNotifications.createNotification('static/' + w + '.png', '提示信息', m);
//设置定时撤销机制,防止通知长时间显示不被关闭
notify.ondisplay = function(event) {
setTimeout(function() {
event.currentTarget.cancel();
}, 4444);
};
//下面是定义点击事件,类似地还可定义其它事件
notify.onclick = function() {
window.focus();
this.cancel();
};
//弹出
notify.show();
}
</script>
<link rel="stylesheet" href="static/pure-min.css" />
<link rel="stylesheet" href="static/mainframe.css" />
<style type="text/css">
#setting button {
vertical-align: middle!important;
}
#setting label{
width: 300px!important;
}
#editdom {
margin-top:5px auto;
visibility: hidden;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
管理员 | <a href="logout.php">安全退出</a>
</div>
<div class="func">
<a href="?func=setting">系统参数设置</a>
<a href="<? if(getenv("VCAP_SERVICES")) echo 'http://jzdb.eu01.aws.af.cm/'; else echo '/phpmyadmin/'; ?>" target="_blank">数据库高级管理</a>
<a href="?func=editcourse">课程信息维护</a>
<a href="?func=chknum">选课学生筛选</a>
</div>
<div class="main">
<!-- 表单区域 开始 -->
<?
if(isset($_GET['func'])) {
if($_GET['func'] == 'setting') { // 系统参数设置
$st = $dbc->prepare("SELECT v FROM admin WHERE k=? LIMIT 1");
$st->bindValue(1, 'term');
$st->execute();
$term = $st->fetchAll();
$st->bindValue(1, 'xk1');
$st->execute();
$xk_1 = $st->fetchAll();
$xk1 = explode('|', $xk_1[0][0]);
$st->bindValue(1, 'xk2');
$st->execute();
$xk_2 = $st->fetchAll();
$xk2 = explode('|', $xk_2[0][0]);
$st->bindValue(1, 'markin');
$st->execute();
$markin = $st->fetchAll();
$st->bindValue(1, 'maxxf');
$st->execute();
$maxxf = $st->fetchAll();
$st->bindValue(1, 'cf');
$st->execute();
$cf = $st->fetchAll();
?>
<script type="text/javascript">
function c(key) {
var v;
if(key == "term") {
v = $("#term").val();
}
if (key == "xk1") {
if(/^([0-9]{12})$/.test($("#xk1s").val()) && /^([0-9]{12})$/.test($("#xk1f").val()))
v = $("#xk1s").val() + "|" + $("#xk1f").val();
else {
msg("e", "时间格式不合法!");
return;
}
}
if(key == "xk2") {
if(/^([0-9]{12})$/.test($("#xk2s").val()) && /^([0-9]{12})$/.test($("#xk2f").val()))
v = $("#xk2s").val() + "|" + $("#xk2f").val();
else {
msg("e", "时间格式不合法!");
return;
}
}
if (key == "markin") {
if(/^([0-9]{12})$/.test($("#markin").val()))
v = $("#markin").val();
else {
msg("e", "时间格式不合法!");
return;
}
}
if (key == "cf") {
if(/^([0-9]{12})$/.test($("#cf").val()))
v = $("#cf").val();
else {
msg("e", "时间格式不合法!");
return;
}
}
if (key == "maxxf") {
if(/^([0-9]{1,})$/.test($("#maxxf").val()))
v = $("#maxxf").val();
else {
msg("e", "学分格式不合法!");
return;
}
}
$.ajax({
type : "post",
url : "ctrl/adminSetting.php",
data : {
"k": key,
"v": v
},
async : false,
success : function(data){
if(data == '1') {
msg("i", "修改成功!");
} else {
msg("e", data);
}
}
});
}
</script>
<form class="pure-form pure-form-aligned" id="setting">
<fieldset>
<div class="pure-control-group">
<label for="term">当前学期(关联首页显示)</label>
<input id="term" type="text" value="<?=$term[0][0]?>">&nbsp;&nbsp;
<button type="button" class="pure-button pure-button-primary" onclick="c('term');">更改</button>
</div>
<div class="pure-control-group">
<label for="xk1s">一轮选课时间(yyyyMMddHHmm)</label>
<input id="xk1s" type="text" value="<?=$xk1[0]?>"> -
<input id="xk1f" type="text" value="<?=$xk1[1]?>">&nbsp;
<button type="button" class="pure-button pure-button-primary" onclick="c('xk1');">更改</button>
</div>
<div class="pure-control-group">
<label for="xk2s">二轮选课时间(yyyyMMddHHmm)</label>
<input id="xk2s" type="text" value="<?=$xk2[0]?>"> -
<input id="xk2f" type="text" value="<?=$xk2[1]?>">&nbsp;
<button type="button" class="pure-button pure-button-primary" onclick="c('xk2');">更改</button>
</div>
<div class="pure-control-group">
<label for="markin">成绩登录截止时间(yyyyMMddHHmm)</label>
<input id="markin" type="text" value="<?=$markin[0][0]?>">&nbsp;&nbsp;
<button type="button" class="pure-button pure-button-primary" onclick="c('markin');">更改</button>
</div>
<!-- <div class="pure-control-group">
<label for="cf">成绩开放查询时间(yyyyMMddHHmm)</label>
<input id="cf" type="text" value="<?=$cf[0][0]?>">&nbsp;&nbsp;
<button type="button" class="pure-button pure-button-primary" onclick="c('cf');">更改</button>
</div> -->
<div class="pure-control-group">
<label for="maxxf">可选的最高总学分</label>
<input id="maxxf" type="text" value="<?=$maxxf[0][0]?>">&nbsp;&nbsp;
<button type="button" class="pure-button pure-button-primary" onclick="c('maxxf');">更改</button>
</div>
</fieldset>
</form>
<?
} else if($_GET['func'] == 'editcourse') { // 课程信息维护
?>
<script type="text/javascript">
function cs() { // 查询课程[、工号]
var kh,gh;
if( /^([0-9A-Z]{8})$/.test($("#kh").val()) ) {
kh = $("#kh").val()
} else {
msg('e', "课程号不合法!");
return;
}
if( /^([0-9]{8})$/.test($("#gh").val()) ){
gh = $("#gh").val();
} else {
msg("e", "工号不合法!");
return;
}
var xf, km, room, bittime, time, reply;
$.ajax({
type : "post",
url : "ctrl/adminCourse.php",
data : {
"kh": kh,
"gh": gh,
"intent": "query"
},
async : false,
success : function(data){
reply = eval('(' + data + ')');
$("#xf").val(reply.xf);
$("#km").val(reply.km);
$("#room").val(reply.room);
$("#bittime").val(reply.bittime);
$("#time").val(reply.time);
$('.qf').attr('disabled',true);
$('#editdom').css('visibility','visible');
}
});
}
function csc() { // 更新开课班的属性
if(/^([0-9]{1,2})$/.test($("#xf").val()) && /^([0-1]{65})$/.test($("#bittime").val())) {
$.ajax({
type : "post",
url : "ctrl/adminCourse.php",
data : {
"kh": kh,
"gh": gh,
"intent": "up2",
"xf": $("#xf").val(),
"km": $("#km").val(),
"room": $("#room").val(),
"bittime": $("#bittime").val(),
"time": $("#time").val()
},
async : false,
success : function(data){
if(data == 'up2') {
msg('i', "修改成功!");
}
}
});
}
}
</script>
<form class="pure-form" id="edit">
<fieldset>
<input type="text" maxlength="8" id="kh" value class="qf" placeholder="8位课程号" required> 
<input type="text" maxlength="8" id="gh" value class="qf" placeholder="8位教师工号" required> 
<button type="button" class="pure-button pure-button-primary" onclick="cs();">查询</button>
</fieldset>
</form>
<div id="editdom">
<form class="pure-form">
<fieldset>
学分:<input type="text" id="xf" required>  
课程名称:<input type="text" id="km" required>  
时间:<input type="text" id="time" required value=""><br><br>
上课时间:<input type="text" id="bittime" required value="" style="width:478px;">  
教室:<input type="text" id="room" required value="">
</fieldset>
<center>
<button type="button" class="pure-button pure-button-primary" onclick="csc();">更改</button>&nbsp;
<button type="button" class="pure-button" onclick="$('input').val();$('#editdom').css('visibility','hidden');$('.qf').attr('disabled',false);">放弃</button>
</center>
</form>
</div>
<?
} else if($_GET['func'] == 'chknum') { // 选课学生筛选,可加人数限制,筛选规则
?>
<script type="text/javascript">
function fire() {
$.ajax({
type : "post",
url : "ctrl/procedure.php",
data : {
"operate": "ShaiXuan"
},
async : false,
success : function(data){
if(data == 'ok') {
msg('i', "筛选完毕!");
} else {
msg('e', data);
}
}
});
}
</script>
<form class="pure-form">
<fieldset>
<center>筛选规则:年级优势 > 绩点排名;对于已满或超员的教学班加限制人数标记。筛选可能需要较长时间。
<button type="button" class="pure-button pure-button-primary" onclick="fire();">执行筛选</button></center>
</fieldset>
</form>
<?
}
} else {
?>
<div class="terminfo">
<h1>上海大学选课系统管理控制面板</h1>
<h3>数据宝贵,谨慎操作!</h3>
</div>
<?
}
?>
</div>
</div>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/xskonline/DB2.git
git@gitee.com:xskonline/DB2.git
xskonline
DB2
DB2
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385