作业提交组件添加
This commit is contained in:
parent
1d9b026e49
commit
4b8dee3ba0
231
admin/class_book.php
Normal file
231
admin/class_book.php
Normal file
@ -0,0 +1,231 @@
|
||||
<?php
|
||||
// 页面ID
|
||||
$menu_page = 3;
|
||||
// 载入组件
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/admin/module/head-check.php');
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/plugins/Parsedown.php');
|
||||
// 获取参数
|
||||
$task_id = htmlspecialchars($_GET['task_id']);
|
||||
|
||||
// 载入用户个人信息
|
||||
$task_url = $setting['API']['Domain'].'/class/task.php?key='.$setting['Key'].'&type=all';
|
||||
$task_ch = curl_init($task_url);
|
||||
curl_setopt($task_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($task_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$task = curl_exec($task_ch);
|
||||
$task = json_decode($task,true);
|
||||
|
||||
// 使用MarkDown转HTML编译
|
||||
$Parsedown = new Parsedown();
|
||||
?>
|
||||
<!doctype html>
|
||||
<!--
|
||||
哎呀,原来你看到了呀。
|
||||
欢迎你~
|
||||
如果你想看完整的代码你可以去我的GITHUB看代码,代码地址如下哦:
|
||||
https://github.com/XiaoLFeng/wxxy_class
|
||||
欢迎来201宿舍玩啊~
|
||||
-->
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?PHP echo $normal['data']['web_title']['text']?> - <?PHP echo $normal['data']['web_subtitle']['text']?></title>
|
||||
<link rel="shortcut icon" href="<?PHP echo $normal['data']['web_icon']['text']?>" type="image/x-icon">
|
||||
<meta name="description" content="<?PHP echo $normal['data']['web_desc']['text']?>">
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="<?PHP echo $mirror['data']['info']['bootstrap_css'] ?>">
|
||||
<link rel="stylesheet" href="<?PHP echo $mirror['data']['info']['bootstrap_icon'] ?>">
|
||||
<link rel="stylesheet" href="<?PHP echo $mirror['data']['info']['qweather'] ?>">
|
||||
</head>
|
||||
<body style="background-color:#e3f2fd;">
|
||||
<!-- 菜单 -->
|
||||
<header>
|
||||
<?PHP include($_SERVER['DOCUMENT_ROOT'].'/admin/module/header.php') ?>
|
||||
</header>
|
||||
<!-- 内容 -->
|
||||
<div id="loader" class="container placeholder-glow text-center py-4">
|
||||
<div class="spinner-grow text-primary" role="status"><span class="visually-hidden">Loading...</span></div>
|
||||
<div class="spinner-grow text-primary" role="status"><span class="visually-hidden">Loading...</span></div>
|
||||
<div class="spinner-grow text-primary" role="status"><span class="visually-hidden">Loading...</span></div>
|
||||
</div>
|
||||
<?PHP
|
||||
if (empty($task_id)) {
|
||||
?>
|
||||
<div id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 col-bg-4 col-lg-3 mb-3">
|
||||
<?PHP include('./module/menu.php'); ?>
|
||||
</div>
|
||||
<div class="col-12 col-bg-8 col-lg-9 mt-3 mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card shadow rounded-3">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12 fs-5 fw-bold mb-3"><i class="bi bi-journal-bookmark"></i> 作业管理</div>
|
||||
<div class="col-12 px-5 mb-3">
|
||||
<a class="btn btn-primary" href="./class_book_create.php" role="button"><i class="bi bi-plus-circle"></i> 添加作业</a>
|
||||
</div>
|
||||
<div class="col-12 fs-5 fw-bold mb-3"><i class="bi bi-journal-bookmark"></i> 作业清单</div>
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">ID号</th>
|
||||
<th scope="col">作业标题</th>
|
||||
<th scope="col">截止时间</th>
|
||||
<th scope="col">创建人</th>
|
||||
<th scope="col">管理</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?PHP
|
||||
$num = 1;
|
||||
while ($task['data'][$num]['id']) {
|
||||
// 载入用户个人信息
|
||||
$member_creator_url = $setting['API']['Domain'].'/class/person.php?key='.$setting['Key'].'&type=normal&studentID='.$task['data'][$num]['creator'];
|
||||
$member_creator_ch = curl_init($member_creator_url);
|
||||
curl_setopt($member_creator_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($member_creator_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$member_creator = curl_exec($member_creator_ch);
|
||||
$member_creator = json_decode($member_creator,true);
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?PHP echo $task['data'][$num]['task_id'] ?></th>
|
||||
<td><?PHP echo stripslashes($task['data'][$num]['title']) ?></td>
|
||||
<td><?PHP echo stripslashes($task['data'][$num]['closetime']) ?></td>
|
||||
<td><?PHP echo $member_creator['data']['name'] ?></td>
|
||||
<td><a class="btn btn-outline-primary btn-sm" href="?task_id=<?PHP echo $task['data'][$num]['task_id'] ?>" role="button"><i class="bi bi-dpad"></i> 管理</a></td>
|
||||
</tr>
|
||||
<?PHP
|
||||
$num ++;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?PHP
|
||||
} else {
|
||||
// 载入用户个人信息
|
||||
$task_url = $setting['API']['Domain'].'/class/task.php?key='.$setting['Key'].'&type=check&task_id='.$task_id;
|
||||
$task_ch = curl_init($task_url);
|
||||
curl_setopt($task_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($task_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$task = curl_exec($task_ch);
|
||||
$task = json_decode($task,true);
|
||||
?>
|
||||
<div id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 col-bg-4 col-lg-3 mb-3">
|
||||
<?PHP include('./module/menu.php'); ?>
|
||||
</div>
|
||||
<div class="col-12 col-bg-8 col-lg-9 mt-3 mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card shadow rounded-3">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12 fs-5 fw-bold mb-3"><i class="bi bi-journal-bookmark"></i> 作业管理</div>
|
||||
<div class="col-12 mb-3"><a class="btn btn-outline-primary" href="/admin/class_book.php" role="button"><i class="bi bi-arrow-90deg-left"></i> 返回作业管理</a></div>
|
||||
<div class="col-12 fs-5 fw-bold mb-3 text-center"><?PHP echo stripslashes($task['data']['title']) ?></div>
|
||||
<div class="col-12 mb-3 px-4"><?PHP echo $Parsedown->text(stripslashes($task['data']['text'])); ?></div>
|
||||
<div class="col-12 fs-5 fw-bold mb-1"><i class="bi bi-journal-bookmark"></i> 本班情况</div>
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">学号</th>
|
||||
<th scope="col">姓名</th>
|
||||
<th scope="col">交作业</th>
|
||||
<th scope="col">时间</th>
|
||||
<th scope="col">处理人</th>
|
||||
<th scope="col">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?PHP
|
||||
$num = 22344201;
|
||||
while ($task['data']['person'][$num]['studentID']) {
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?PHP echo stripslashes($task['data']['person'][$num]['studentID']) ?></th>
|
||||
<td><?PHP echo stripslashes($task['data']['person'][$num]['name']) ?></td>
|
||||
<td>
|
||||
<?PHP
|
||||
if (empty($task['data']['person'][$num]['finish']) or $task['data']['person'][$num]['finish'] == "FALSE") {
|
||||
echo '<font color="red">未提交</font>';
|
||||
} else {
|
||||
if ($task['data']['person'][$num]['finish'] == "TRUE") {
|
||||
echo '<font color="green">已提交</font>';
|
||||
} else {
|
||||
echo '<font color="grey">未知</font>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?PHP echo stripslashes($task['data']['person'][$num]['time']) ?></td>
|
||||
<td><?PHP echo stripslashes($task['data']['person'][$num]['creator']) ?></td>
|
||||
<td>
|
||||
<?PHP
|
||||
if (empty($task['data']['person'][$num]['finish']) or $task['data']['person'][$num]['finish'] == "FALSE") {
|
||||
?>
|
||||
<a class="btn btn-outline-success btn-sm" href="./plugins/class_book_change.php?task_id=<?PHP echo $task_id ?>&studentID=<?PHP echo stripslashes($task['data']['person'][$num]['studentID'])?>&finish=TRUE" role="button"><i class="bi bi-check"></i> 确认提交</a>
|
||||
<?PHP
|
||||
} else {
|
||||
if ($task['data']['person'][$num]['finish'] == "TRUE") {
|
||||
?>
|
||||
<a class="btn btn-outline-danger btn-sm" href="./plugins/class_book_change.php?task_id=<?PHP echo $task_id ?>&studentID=<?PHP echo stripslashes($task['data']['person'][$num]['studentID'])?>&finish=FALSE" role="button"><i class="bi bi-x"></i> 取消提交</a>
|
||||
<?PHP
|
||||
} else {
|
||||
?>
|
||||
<a class="btn btn-outline-success btn-sm" href="./plugins/class_book_change.php?task_id=<?PHP echo $task_id ?>&studentID=<?PHP echo stripslashes($task['data']['person'][$num]['studentID'])?>&finish=TRUE" role="button"><i class="bi bi-check"></i> 确认提交</a>
|
||||
<?PHP
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?PHP
|
||||
$num ++;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?PHP
|
||||
}
|
||||
?>
|
||||
<!-- 页尾 -->
|
||||
<?PHP include($_SERVER['DOCUMENT_ROOT'].'/module/footer.php') ?>
|
||||
</body>
|
||||
<!-- JavaScript -->
|
||||
<script src="<?PHP echo $mirror['data']['info']['qweather'] ?>"></script>
|
||||
<script src="<?PHP echo $mirror['data']['info']['bootstrap_bundle_js'] ?>"></script>
|
||||
<script src="<?PHP echo $mirror['data']['info']['jquery'] ?>"></script>
|
||||
<script>
|
||||
// 加载内容
|
||||
$("#main").hide();
|
||||
window.onload=function(){
|
||||
$("#loader").fadeOut(200);
|
||||
$("#main").show(500);
|
||||
}
|
||||
</script>
|
||||
</html>
|
120
admin/class_book_create.php
Normal file
120
admin/class_book_create.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
// 页面ID
|
||||
$menu_page = 3;
|
||||
// 载入组件
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/admin/module/head-check.php');
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/plugins/Parsedown.php');
|
||||
// 获取参数
|
||||
$task_id = htmlspecialchars($_GET['task_id']);
|
||||
|
||||
// 载入用户个人信息
|
||||
$task_url = $setting['API']['Domain'].'/class/task.php?key='.$setting['Key'].'&type=all';
|
||||
$task_ch = curl_init($task_url);
|
||||
curl_setopt($task_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($task_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$task = curl_exec($task_ch);
|
||||
$task = json_decode($task,true);
|
||||
|
||||
// 使用MarkDown转HTML编译
|
||||
$Parsedown = new Parsedown();
|
||||
?>
|
||||
<!doctype html>
|
||||
<!--
|
||||
哎呀,原来你看到了呀。
|
||||
欢迎你~
|
||||
如果你想看完整的代码你可以去我的GITHUB看代码,代码地址如下哦:
|
||||
https://github.com/XiaoLFeng/wxxy_class
|
||||
欢迎来201宿舍玩啊~
|
||||
-->
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?PHP echo $normal['data']['web_title']['text']?> - <?PHP echo $normal['data']['web_subtitle']['text']?></title>
|
||||
<link rel="shortcut icon" href="<?PHP echo $normal['data']['web_icon']['text']?>" type="image/x-icon">
|
||||
<meta name="description" content="<?PHP echo $normal['data']['web_desc']['text']?>">
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="<?PHP echo $mirror['data']['info']['bootstrap_css'] ?>">
|
||||
<link rel="stylesheet" href="<?PHP echo $mirror['data']['info']['bootstrap_icon'] ?>">
|
||||
<link rel="stylesheet" href="<?PHP echo $mirror['data']['info']['qweather'] ?>">
|
||||
</head>
|
||||
<body style="background-color:#e3f2fd;">
|
||||
<!-- 菜单 -->
|
||||
<header>
|
||||
<?PHP include($_SERVER['DOCUMENT_ROOT'].'/admin/module/header.php') ?>
|
||||
</header>
|
||||
<!-- 内容 -->
|
||||
<div id="loader" class="container placeholder-glow text-center py-4">
|
||||
<div class="spinner-grow text-primary" role="status"><span class="visually-hidden">Loading...</span></div>
|
||||
<div class="spinner-grow text-primary" role="status"><span class="visually-hidden">Loading...</span></div>
|
||||
<div class="spinner-grow text-primary" role="status"><span class="visually-hidden">Loading...</span></div>
|
||||
</div>
|
||||
<div id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 col-bg-4 col-lg-3 mb-3">
|
||||
<?PHP include('./module/menu.php'); ?>
|
||||
</div>
|
||||
<div class="col-12 col-bg-8 col-lg-9 mt-3 mb-3">
|
||||
<div class="row">
|
||||
<form action="./plugins/class_book_create.php" method="post">
|
||||
<div class="col-12">
|
||||
<div class="card shadow rounded-3">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12 fs-5 fw-bold mb-3"><i class="bi bi-journal-bookmark"></i> 作业创建</div>
|
||||
<div class="col-12 mb-3 text-end">
|
||||
<a class="btn btn-danger" href="./class_book.php" role="button"><i class="bi bi-x-circle"></i> 放弃创建</a>
|
||||
<button class="btn btn-success" type="submit"><i class="bi bi-check2-circle"></i> 确认创建</button>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 mb-3">
|
||||
<label class="form-label"><i class="bi bi-blockquote-left"></i> 标题<font color="red">*</font></label>
|
||||
<input type="text" class="form-control" placeholder="最大限制20个字" maxlength="20" aria-describedby="emailHelp" id="task_title" name="task_title" required>
|
||||
<div id="emailHelp" class="form-text px-2">例如:高等数学-函数</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 mb-3">
|
||||
<label class="form-label"><i class="bi bi-person"></i> 创建人</label>
|
||||
<input type="text" class="form-control" value="<?PHP echo $member['data']['name'] ?>" readonly>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 mb-3">
|
||||
<label class="form-label"><i class="bi bi-calendar"></i> 开始时间 <font color="red">*</font></label>
|
||||
<input type="datetime-local" class="form-control" value="<?PHP echo date("Y-m-d H:i") ?>" min="<?PHP echo date("Y-m-d H:i") ?>" id="task_opentime" name="task_opentime" required>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 mb-3">
|
||||
<label class="form-label"><i class="bi bi-calendar"></i> 结束时间 <font color="red">*</font></label>
|
||||
<input type="datetime-local" class="form-control" value="<?PHP echo date("Y-m-d H:i") ?>" min="<?PHP echo date("Y-m-d H:i") ?>" id="task_closetime" name="task_closetime" required>
|
||||
</div>
|
||||
<div class="col-12 mb-3">
|
||||
<label class="form-label"><i class="bi bi-chat-right-text"></i> 作业内容 <font color="red">*</font></label>
|
||||
<textarea class="form-control" rows="5" id="task_text" name="task_text" required></textarea>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-12 text-end">备注:暂时无法删除已创建的作业,如需删除请联系曾昶雯。</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 页尾 -->
|
||||
<?PHP include($_SERVER['DOCUMENT_ROOT'].'/module/footer.php') ?>
|
||||
</body>
|
||||
<!-- JavaScript -->
|
||||
<script src="<?PHP echo $mirror['data']['info']['qweather'] ?>"></script>
|
||||
<script src="<?PHP echo $mirror['data']['info']['bootstrap_bundle_js'] ?>"></script>
|
||||
<script src="<?PHP echo $mirror['data']['info']['jquery'] ?>"></script>
|
||||
<script>
|
||||
// 加载内容
|
||||
$("#main").hide();
|
||||
window.onload=function(){
|
||||
$("#loader").fadeOut(200);
|
||||
$("#main").show(500);
|
||||
}
|
||||
</script>
|
||||
</html>
|
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
// 页面ID
|
||||
$menu_page = 1;
|
||||
$header_num = 1;
|
||||
// 载入组件
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/admin/module/head-check.php');
|
||||
// 载入全部人用户个人信息
|
||||
$member_all_url = $setting['API']['Domain'].'/class/person.php?key='.$setting['Key'].'&type=all';
|
||||
$member_all_ch = curl_init($member_all_url);
|
||||
curl_setopt($member_all_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($member_all_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$member_all = curl_exec($member_all_ch);
|
||||
$member_all = json_decode($member_all,true);
|
||||
?>
|
||||
<!doctype html>
|
||||
<!--
|
||||
哎呀,原来你看到了呀。
|
||||
欢迎你~
|
||||
如果你想看完整的代码你可以去我的GITHUB看代码,代码地址如下哦:
|
||||
https://github.com/XiaoLFeng/wxxy_class
|
||||
欢迎来201宿舍玩啊~
|
||||
-->
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?PHP echo $normal['data']['web_title']['text']?> - <?PHP echo $normal['data']['web_subtitle']['text']?></title>
|
||||
<link rel="shortcut icon" href="<?PHP echo $normal['data']['web_icon']['text']?>" type="image/x-icon">
|
||||
<meta name="description" content="<?PHP echo $normal['data']['web_desc']['text']?>">
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="<?PHP echo $mirror['data']['info']['bootstrap_css'] ?>">
|
||||
<link rel="stylesheet" href="<?PHP echo $mirror['data']['info']['bootstrap_icon'] ?>">
|
||||
<link rel="stylesheet" href="<?PHP echo $mirror['data']['info']['qweather'] ?>">
|
||||
</head>
|
||||
<body style="background-color:#e3f2fd;">
|
||||
<!-- 菜单 -->
|
||||
<header>
|
||||
<?PHP include($_SERVER['DOCUMENT_ROOT'].'/admin/module/header.php') ?>
|
||||
</header>
|
||||
<!-- 内容 -->
|
||||
<div id="loader" class="container placeholder-glow text-center py-4">
|
||||
<div class="spinner-grow text-primary" role="status"><span class="visually-hidden">Loading...</span></div>
|
||||
<div class="spinner-grow text-primary" role="status"><span class="visually-hidden">Loading...</span></div>
|
||||
<div class="spinner-grow text-primary" role="status"><span class="visually-hidden">Loading...</span></div>
|
||||
</div>
|
||||
<div id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 col-bg-4 col-lg-3 mb-3">
|
||||
<?PHP include('./module/menu.php'); ?>
|
||||
</div>
|
||||
<div class="col-12 col-bg-8 col-lg-9 mt-3 mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-8 mb-4">
|
||||
<div class="card shadow rounded-3 flex-grow-1">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12 fs-5 mb-3"><i class="bi bi-emoji-smile"></i> 欢迎</div>
|
||||
<div class="col-12 px-5 mb-3">不知道写啥,放着吧。这个网站就服务我们二班的东西,顺便也是自己PHP练手的</div>
|
||||
<div class="col-12 text-center">
|
||||
<a class="btn btn-primary" href="/setting.php" role="button">个人设置</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 页尾 -->
|
||||
<?PHP include($_SERVER['DOCUMENT_ROOT'].'/module/footer.php') ?>
|
||||
</body>
|
||||
<!-- JavaScript -->
|
||||
<script src="<?PHP echo $mirror['data']['info']['qweather'] ?>"></script>
|
||||
<script src="<?PHP echo $mirror['data']['info']['bootstrap_bundle_js'] ?>"></script>
|
||||
<script src="<?PHP echo $mirror['data']['info']['jquery'] ?>"></script>
|
||||
<script>
|
||||
// 加载内容
|
||||
$("#main").hide();
|
||||
window.onload=function(){
|
||||
$("#loader").fadeOut(200);
|
||||
$("#main").show(500);
|
||||
}
|
||||
</script>
|
||||
</html>
|
49
admin/module/head-check.php
Normal file
49
admin/module/head-check.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?PHP
|
||||
// 检查是否正常登录
|
||||
$callback = htmlspecialchars($_GET['callback']);
|
||||
if ($menu_id == 2) {
|
||||
if (!empty($_COOKIE['studentID'])) {
|
||||
if (empty($callback)) {
|
||||
header('location: /index.php');
|
||||
} else {
|
||||
header('location:'.$callback);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (empty($_COOKIE['studentID'])) {
|
||||
$get_ip = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||
header('location: https://ourwxxy.x-lf.com/auth.php?callback='.$get_ip);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取数据(获取数据库信息)
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/setting.inc.php');
|
||||
|
||||
// 载入网站基本信息
|
||||
$normal_url = $setting['API']['Domain'].'/main/?key='.$setting['Key'];
|
||||
$normal_ch = curl_init($normal_url);
|
||||
curl_setopt($normal_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($normal_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$normal = curl_exec($normal_ch);
|
||||
$normal = json_decode($normal,true);
|
||||
|
||||
// 载入镜像基本信息
|
||||
$mirror_url = $setting['API']['Domain'].'/main/mirrors.php?key='.$setting['Key'];
|
||||
$mirror_ch = curl_init($mirror_url);
|
||||
curl_setopt($mirror_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($mirror_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$mirror = curl_exec($mirror_ch);
|
||||
$mirror = json_decode($mirror,true);
|
||||
|
||||
// 载入用户个人信息
|
||||
$member_url = $setting['API']['Domain'].'/class/person.php?key='.$setting['Key'].'&type=normal&studentID='.$_COOKIE['studentID'];
|
||||
$member_ch = curl_init($member_url);
|
||||
curl_setopt($member_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($member_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$member = curl_exec($member_ch);
|
||||
$member = json_decode($member,true);
|
||||
|
||||
// 判断用户是否有权限进入
|
||||
if ($member['data']['op'] !== '1') {
|
||||
header('location: /index.php');
|
||||
}
|
26
admin/module/header.php
Normal file
26
admin/module/header.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?PHP
|
||||
function menu_info($num) {
|
||||
global $header_num;
|
||||
if ($num == $header_num) {
|
||||
echo 'active';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<nav class="navbar navbar-expand-lg navbar-light ticky-top" style="background-color:#e3f2fd;">
|
||||
<div class="container py-1">
|
||||
<a class="navbar-brand" href="https://ourwxxy.x-lf.com/"><i class="bi bi-caret-right-fill"></i> 软件工程 - 二班 <i class="bi bi-caret-left-fill"></i></a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" aria-current="page" href="/index.php"><i class="bi bi-house"></i> 返回主页</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?PHP echo menu_info(1); ?>" aria-current="page" href="/admin/"><i class="bi bi-person-rolodex"></i> 管理首页</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
27
admin/module/menu.php
Normal file
27
admin/module/menu.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?PHP
|
||||
function menu_color($menu_num) {
|
||||
global $menu_page;
|
||||
if ($menu_page == $menu_num) {
|
||||
echo 'text-primary';
|
||||
} else {
|
||||
echo 'text-black';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="sticky-top py-3">
|
||||
<div class="card shadow rounded-3">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12 my-2 px-4">
|
||||
<a href="/admin/" class="text-decoration-none d-flex <?PHP menu_color(1) ?>"><i class="bi bi-house-door"></i> 管理首页</a>
|
||||
</div>
|
||||
<div class="col-12 my-2 px-4">
|
||||
<a href="/admin/" class="text-decoration-none d-flex <?PHP menu_color(2) ?>"><i class="bi bi-person"></i> 用户管理</a>
|
||||
</div>
|
||||
<div class="col-12 my-2 px-4">
|
||||
<a href="/admin/class_book.php" class="text-decoration-none d-flex <?PHP menu_color(3) ?>"><i class="bi bi-book"></i> 作业管理</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
97
admin/plugins/class_book_change.php
Normal file
97
admin/plugins/class_book_change.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?PHP
|
||||
/*
|
||||
* 筱锋xiao_lfeng 分享系统(插件)
|
||||
* 登录组件
|
||||
*/
|
||||
|
||||
// 定义请求头
|
||||
header("Content-type:text/html;charset=utf-8");
|
||||
// 获取组件
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/setting.inc.php');
|
||||
|
||||
// 注册函数
|
||||
// 发送POST
|
||||
function http_post_json($url, $jsonStr) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonStr);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
'Content-Type: application/json; charset=utf-8',
|
||||
'Content-Length: ' . strlen($jsonStr)
|
||||
)
|
||||
);
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $response;
|
||||
}
|
||||
|
||||
// 函数构建
|
||||
// 检查数据是否为空
|
||||
|
||||
// 载入用户个人信息
|
||||
$member_url = $setting['API']['Domain'].'/class/person.php?key='.$setting['Key'].'&type=normal&studentID='.$_COOKIE['studentID'];
|
||||
$member_ch = curl_init($member_url);
|
||||
curl_setopt($member_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($member_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$member = curl_exec($member_ch);
|
||||
$member = json_decode($member,true);
|
||||
|
||||
if ($member['data']['op'] == "1") {
|
||||
// 发送用户信息
|
||||
$url = $setting['API']['Domain']."/class/task_change.php"; //请求地址
|
||||
$arr = array(
|
||||
'output'=>'SUCCESS',
|
||||
'code'=>200,
|
||||
'info'=>'数据上传完毕',
|
||||
'key'=>$setting['Key'],
|
||||
'data'=>array(
|
||||
'task_id'=>$_GET['task_id'],
|
||||
'studentID'=>$_GET['studentID'],
|
||||
'creator'=>$_COOKIE['studentID'],
|
||||
'finish'=>$_GET['finish'],
|
||||
)
|
||||
); //请求参数(数组)
|
||||
$jsonStr = json_encode($arr); //转换为json格式
|
||||
$result = http_post_json($url, $jsonStr);
|
||||
$result = json_decode($result,true);
|
||||
|
||||
// 返回结果
|
||||
if ($result['output'] == "SUCCESS" or $result['output'] == "SUCCESS_CHANGE") {
|
||||
// 返回
|
||||
if (empty($callback)) {
|
||||
header('location: /admin/class_book.php?task_id='.$_GET['task_id']);
|
||||
} else {
|
||||
header('location: '.$callback);
|
||||
}
|
||||
} elseif ($result['output'] == "USER_NO_CREATE") {
|
||||
echo <<<EOF
|
||||
<script language="javascript">
|
||||
alert( "没有此用户" )
|
||||
window.history.go(-1);
|
||||
</script>
|
||||
EOF;
|
||||
} elseif ($result['output'] == "TASK_ID_NO_CREATE") {
|
||||
echo <<<EOF
|
||||
<script language="javascript">
|
||||
alert( "没有创建此作业" )
|
||||
window.history.go(-1);
|
||||
</script>
|
||||
EOF;
|
||||
} else {
|
||||
echo <<<EOF
|
||||
<script language="javascript">
|
||||
alert( "密钥错误" )
|
||||
window.history.go(-1);
|
||||
</script>
|
||||
EOF;
|
||||
}
|
||||
} else {
|
||||
echo <<<EOF
|
||||
<script language="javascript">
|
||||
alert( "你没有权限" )
|
||||
window.history.go(-1);
|
||||
</script>
|
||||
EOF;
|
||||
}
|
87
admin/plugins/class_book_create.php
Normal file
87
admin/plugins/class_book_create.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?PHP
|
||||
/*
|
||||
* 筱锋xiao_lfeng 分享系统(插件)
|
||||
* 登录组件
|
||||
*/
|
||||
|
||||
// 定义请求头
|
||||
header("Content-type:text/html;charset=utf-8");
|
||||
// 获取组件
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/setting.inc.php');
|
||||
|
||||
// 注册函数
|
||||
// 发送POST
|
||||
function http_post_json($url, $jsonStr) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonStr);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
'Content-Type: application/json; charset=utf-8',
|
||||
'Content-Length: ' . strlen($jsonStr)
|
||||
)
|
||||
);
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $response;
|
||||
}
|
||||
|
||||
// 函数构建
|
||||
// 检查数据是否为空
|
||||
|
||||
// 载入用户个人信息
|
||||
$member_url = $setting['API']['Domain'].'/class/person.php?key='.$setting['Key'].'&type=normal&studentID='.$_COOKIE['studentID'];
|
||||
$member_ch = curl_init($member_url);
|
||||
curl_setopt($member_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($member_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$member = curl_exec($member_ch);
|
||||
$member = json_decode($member,true);
|
||||
|
||||
if ($member['data']['op'] == "1") {
|
||||
// 发送用户信息
|
||||
$url = $setting['API']['Domain']."/class/task_create.php"; //请求地址
|
||||
$arr = array(
|
||||
'output'=>'SUCCESS',
|
||||
'code'=>200,
|
||||
'info'=>'数据上传完毕',
|
||||
'key'=>$setting['Key'],
|
||||
'data'=>array(
|
||||
'title'=>$_POST['task_title'],
|
||||
'text'=>$_POST['task_text'],
|
||||
'creator'=>$_COOKIE['studentID'],
|
||||
'opentime'=>$_POST['task_opentime'],
|
||||
'closetime'=>$_POST['task_closetime'],
|
||||
'open'=>'TRUE',
|
||||
)
|
||||
); //请求参数(数组)
|
||||
$jsonStr = json_encode($arr); //转换为json格式
|
||||
$result = http_post_json($url, $jsonStr);
|
||||
$result = json_decode($result,true);
|
||||
|
||||
// 返回结果
|
||||
if ($result['output'] == "SUCCESS") {
|
||||
header('location: /admin/class_book.php');
|
||||
} elseif ($result['output'] == "MYSQL_ERROR") {
|
||||
echo <<<EOF
|
||||
<script language="javascript">
|
||||
alert( "数据库错误,请联系管理员" )
|
||||
window.history.go(-1);
|
||||
</script>
|
||||
EOF;
|
||||
} else {
|
||||
echo <<<EOF
|
||||
<script language="javascript">
|
||||
alert( "密钥错误" )
|
||||
window.history.go(-1);
|
||||
</script>
|
||||
EOF;
|
||||
}
|
||||
} else {
|
||||
echo <<<EOF
|
||||
<script language="javascript">
|
||||
alert( "你没有权限" )
|
||||
window.history.go(-1);
|
||||
</script>
|
||||
EOF;
|
||||
}
|
182
api/class/task.php
Normal file
182
api/class/task.php
Normal file
@ -0,0 +1,182 @@
|
||||
<?PHP
|
||||
/*
|
||||
* wxxy_class 项目组
|
||||
* 代码均开源
|
||||
*/
|
||||
|
||||
// 载入头
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/api/header-control.php');
|
||||
|
||||
// 载入组件
|
||||
$key = htmlspecialchars($_GET['key']);
|
||||
$type = htmlspecialchars($_GET['type']);
|
||||
$task_id = htmlspecialchars($_GET['task_id']);
|
||||
|
||||
// 获取密钥数据库
|
||||
$result_key = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['system_info']." WHERE info='system_key'");
|
||||
$sql_key = mysqli_fetch_object($result_key)->text;
|
||||
|
||||
// 构建函数
|
||||
if ($key == $sql_key) {
|
||||
if ($type == 'normal') {
|
||||
if (!empty($task_id)) {
|
||||
// 从数据库获取数据
|
||||
$result_task = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['task']." WHERE task_id='$task_id'");
|
||||
$result_task_object = mysqli_fetch_object($result_task);
|
||||
if (!empty($result_task_object->task_id)) {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'SUCCESS',
|
||||
'code'=>200,
|
||||
'info'=>'数据输出成功',
|
||||
'data'=>array(
|
||||
'id'=>$result_task_object->id,
|
||||
'task_id'=>$result_task_object->task_id,
|
||||
'title'=>$result_task_object->title,
|
||||
'text'=>$result_task_object->text,
|
||||
'creator'=>$result_task_object->creator,
|
||||
'opentime'=>$result_task_object->opentime,
|
||||
'closetime'=>$result_task_object->closetime,
|
||||
'open'=>$result_task_object->open,
|
||||
),
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
} else {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'TASK_ID_ERROR',
|
||||
'code'=>403,
|
||||
'info'=>'未查询到数据'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
}
|
||||
} elseif (empty($task_id)) {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'TASK_ID_NONE',
|
||||
'code'=>403,
|
||||
'info'=>'数据缺失'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
} else {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'_NONE',
|
||||
'code'=>403,
|
||||
'info'=>'未知数据丢失'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
}
|
||||
} elseif ($type == 'all') {
|
||||
// 从数据库获取数据
|
||||
$result_task = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['task']." ORDER BY id DESC");
|
||||
$num = 1;
|
||||
while ($result_task_object = mysqli_fetch_object($result_task)) {
|
||||
$array[$num] = array(
|
||||
'id'=>$result_task_object->id,
|
||||
'task_id'=>$result_task_object->task_id,
|
||||
'title'=>$result_task_object->title,
|
||||
'creator'=>$result_task_object->creator,
|
||||
'opentime'=>$result_task_object->opentime,
|
||||
'closetime'=>$result_task_object->closetime,
|
||||
'open'=>$result_task_object->open,
|
||||
);
|
||||
$num ++;
|
||||
}
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'SUCCESS',
|
||||
'code'=>200,
|
||||
'info'=>'数据输出成功',
|
||||
'data'=>$array,
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
} elseif ($type == 'check') {
|
||||
if (!empty($task_id)) {
|
||||
// 从数据库获取数据
|
||||
$result_task = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['task']." WHERE task_id='$task_id'");
|
||||
$result_task_object = mysqli_fetch_object($result_task);
|
||||
if (!empty($result_task_object->task_id)) {
|
||||
$result_task_person = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['task_person']." a RIGHT JOIN ".$setting['SQL_DATA']['info']." b ON a.studentID=b.studentID");
|
||||
while ($result_task_person_object = mysqli_fetch_object($result_task_person)) {
|
||||
if ($result_task_person_object->task_id == $task_id or empty($result_task_person_object->task_id)) {
|
||||
$result_person = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['info']." WHERE studentID='".$result_task_person_object->creator."'");
|
||||
$result_person_object = mysqli_fetch_object($result_person);
|
||||
$array[$result_task_person_object->studentID] = array(
|
||||
'studentID'=>$result_task_person_object->studentID,
|
||||
'name'=>$result_task_person_object->name,
|
||||
'finish'=>$result_task_person_object->finish,
|
||||
'creator'=>$result_person_object->name,
|
||||
'time'=>$result_task_person_object->time,
|
||||
);
|
||||
}
|
||||
}
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'SUCCESS',
|
||||
'code'=>200,
|
||||
'info'=>'数据输出成功',
|
||||
'data'=>array(
|
||||
'id'=>$result_task_object->id,
|
||||
'task_id'=>$result_task_object->task_id,
|
||||
'title'=>$result_task_object->title,
|
||||
'text'=>$result_task_object->text,
|
||||
'person'=>$array,
|
||||
),
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
} else {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'TASK_ID_ERROR',
|
||||
'code'=>403,
|
||||
'info'=>'未查询到数据'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
}
|
||||
} elseif (empty($task_id)) {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'TASK_ID_NONE',
|
||||
'code'=>403,
|
||||
'info'=>'数据缺失'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
} else {
|
||||
|
||||
}
|
||||
} else {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'TYPE_NONE',
|
||||
'code'=>403,
|
||||
'info'=>'类型缺失'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
}
|
||||
} else {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'KEY_ERROR',
|
||||
'code'=>403,
|
||||
'info'=>'密钥错误'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
}
|
90
api/class/task_change.php
Normal file
90
api/class/task_change.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?PHP
|
||||
/*
|
||||
* wxxy_class 项目组
|
||||
* 代码均开源
|
||||
*/
|
||||
|
||||
// 载入头
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/api/header-control.php');
|
||||
|
||||
// 获取参数
|
||||
$post = file_get_contents('php://input');
|
||||
$POST_INFO = json_decode($post,true);
|
||||
|
||||
// 构建函数
|
||||
if ($POST_INFO['key'] == $setting['Key']) {
|
||||
// 对数据进行转义,避免数据库注入
|
||||
$data_studentID = addslashes($POST_INFO['data']['studentID']);
|
||||
$data_task_id = addslashes($POST_INFO['data']['task_id']);
|
||||
$data_creator = addslashes($POST_INFO['data']['creator']);
|
||||
$data_finish = addslashes($POST_INFO['data']['finish']);
|
||||
$data_time = date("Y-m-d H:i:s");
|
||||
|
||||
// 进行数据库匹配(由于没有设置过于复杂的密码则没有)
|
||||
// 确认数据是否存在
|
||||
$result_person = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['info']." WHERE studentID='$data_studentID'");
|
||||
$result_task = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['task']." WHERE task_id='$data_task_id'");
|
||||
$result_person_object = mysqli_fetch_object($result_person);
|
||||
$result_task_object = mysqli_fetch_object($result_task);
|
||||
if (!empty($result_person_object->studentID) and !empty($result_task_object->task_id)) {
|
||||
$result_task_person = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['task_person']." WHERE studentID='$data_studentID' AND task_id='$data_task_id'");
|
||||
$result_task_person_object = mysqli_fetch_object($result_task_person);
|
||||
mysqli_query($conn,"LOCK TABLE ".$setting['SQL_DATA']['task_person']." WRITE");
|
||||
if (empty($result_task_person_object->studentID)) {
|
||||
if (mysqli_query($conn,"INSERT INTO ".$setting['SQL_DATA']['task_person']." (studentID,task_id,finish,creator,time) VALUES ('$data_studentID','$data_task_id','$data_finish','$data_creator','$data_time')")) {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'SUCCESS',
|
||||
'code'=>200,
|
||||
'info'=>'完成!'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
} else {
|
||||
if (mysqli_query($conn,"UPDATE ".$setting['SQL_DATA']['task_person']." SET finish='$data_finish',creator='$data_creator',time='$data_time' WHERE studentID='$data_studentID' AND task_id='$data_task_id'")) {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'SUCCESS_CHANGE',
|
||||
'code'=>200,
|
||||
'info'=>'完成修改!'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}
|
||||
mysqli_query($conn,"UNLOCK TABLE");
|
||||
} else {
|
||||
if (empty($result_person_object->studentID)) {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'USER_NO_CREATE',
|
||||
'code'=>403,
|
||||
'info'=>'没有此用户'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
} elseif (empty($result_task_object->task_id)) {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'TASK_ID_NO_CREATE',
|
||||
'code'=>403,
|
||||
'info'=>'未创建作业,无法查询'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'KEY_ERROR',
|
||||
'code'=>403,
|
||||
'info'=>'密钥错误'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
}
|
65
api/class/task_create.php
Normal file
65
api/class/task_create.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?PHP
|
||||
/*
|
||||
* wxxy_class 项目组
|
||||
* 代码均开源
|
||||
*/
|
||||
|
||||
// 载入头
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/api/header-control.php');
|
||||
|
||||
// 获取参数
|
||||
$post = file_get_contents('php://input');
|
||||
$POST_INFO = json_decode($post,true);
|
||||
|
||||
// 构建函数
|
||||
if ($POST_INFO['key'] == $setting['Key']) {
|
||||
// 对数据进行转义,避免数据库注入
|
||||
$data_title = addslashes($POST_INFO['data']['title']);
|
||||
$data_text = addslashes($POST_INFO['data']['text']);
|
||||
$data_creator = addslashes($POST_INFO['data']['creator']);
|
||||
$data_opentime = addslashes($POST_INFO['data']['opentime']);
|
||||
$data_closetime = addslashes($POST_INFO['data']['closetime']);
|
||||
$data_open = addslashes($POST_INFO['data']['open']);
|
||||
|
||||
// 进行数据库匹配(由于没有设置过于复杂的密码则没有)
|
||||
start:
|
||||
$data_task_id = date("Ymd").rand(0000,9999);
|
||||
$result_task = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['task']." WHERE task_id='$data_task_id'");
|
||||
$result_task_object = mysqli_fetch_object($result_task);
|
||||
if (empty($result_task_object->task_id)) {
|
||||
mysqli_query($conn,"LOCK TABLE ".$setting['SQL_DATA']['task']." WRITE");
|
||||
if (mysqli_query($conn,"INSERT INTO ".$setting['SQL_DATA']['task']." (task_id,title,text,creator,opentime,closetime,open) VALUES ('$data_task_id','$data_title','$data_text','$data_creator','$data_opentime','$data_closetime','$data_open')")) {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'SUCCESS',
|
||||
'code'=>200,
|
||||
'info'=>'数据成功上传',
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
} else {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'MYSQL_ERROR',
|
||||
'code'=>403,
|
||||
'info'=>'数据库出错,无法上传'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
}
|
||||
mysqli_query($conn,"UNLOCK TABLE");
|
||||
} else {
|
||||
goto start;
|
||||
}
|
||||
} else {
|
||||
// 编译数据
|
||||
$data = array(
|
||||
'output'=>'KEY_ERROR',
|
||||
'code'=>403,
|
||||
'info'=>'密钥错误'
|
||||
);
|
||||
// 输出数据
|
||||
echo json_encode($data,JSON_UNESCAPED_UNICODE);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
}
|
@ -9,6 +9,15 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="/index.php"><i class="bi bi-house"></i> 主页</a>
|
||||
</li>
|
||||
<?PHP
|
||||
if ($member['data']['op'] == '1') {
|
||||
?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" aria-current="page" href="/admin/"><i class="bi bi-person-rolodex"></i> 管理员</a>
|
||||
</li>
|
||||
<?PHP
|
||||
}
|
||||
?>
|
||||
<?PHP
|
||||
if (empty($_COOKIE['studentID'])) {
|
||||
?>
|
||||
|
@ -17,6 +17,7 @@ function menu_color($menu_num) {
|
||||
<div class="accordion-body">
|
||||
<div class="row px-4">
|
||||
<div class="col-12 mb-1"><a href="/index.php" class="text-decoration-none <?PHP menu_color(1) ?>"><i class="bi bi-house-door"></i> 主页</a></div>
|
||||
<div class="col-12 mb-1"><a href="/task.php" class="text-decoration-none <?PHP menu_color(9) ?>"><i class="bi bi-book"></i> 作业提交查询表</a></div>
|
||||
<div class="col-12 mb-1"><a href="/nucleic_acid.php" class="text-decoration-none <?PHP menu_color(3) ?>"><i class="bi bi-bandaid"></i> 核酸信息提交</a></div>
|
||||
<div class="col-12 mb-1"><a href="/pan.php" class="text-decoration-none <?PHP menu_color(4) ?>"><i class="bi bi-device-hdd"></i> 班级网盘</a></div>
|
||||
<div class="col-12 mb-1"><a href="/non-member-fty.php" class="text-decoration-none <?PHP menu_color(5) ?>"><i class="bi bi-chat"></i> 青年大学习(全员)</a></div>
|
||||
|
1707
plugins/Parsedown.php
Normal file
1707
plugins/Parsedown.php
Normal file
File diff suppressed because it is too large
Load Diff
203
task.php
Normal file
203
task.php
Normal file
@ -0,0 +1,203 @@
|
||||
<?php
|
||||
// 页面ID
|
||||
$menu_page = 9;
|
||||
// 载入组件
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/admin/module/head-check.php');
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/plugins/Parsedown.php');
|
||||
// 获取参数
|
||||
$task_id = htmlspecialchars($_GET['task_id']);
|
||||
|
||||
// 载入用户个人信息
|
||||
$task_url = $setting['API']['Domain'].'/class/task.php?key='.$setting['Key'].'&type=all';
|
||||
$task_ch = curl_init($task_url);
|
||||
curl_setopt($task_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($task_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$task = curl_exec($task_ch);
|
||||
$task = json_decode($task,true);
|
||||
|
||||
// 使用MarkDown转HTML编译
|
||||
$Parsedown = new Parsedown();
|
||||
?>
|
||||
<!doctype html>
|
||||
<!--
|
||||
哎呀,原来你看到了呀。
|
||||
欢迎你~
|
||||
如果你想看完整的代码你可以去我的GITHUB看代码,代码地址如下哦:
|
||||
https://github.com/XiaoLFeng/wxxy_class
|
||||
欢迎来201宿舍玩啊~
|
||||
-->
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?PHP echo $normal['data']['web_title']['text']?> - <?PHP echo $normal['data']['web_subtitle']['text']?></title>
|
||||
<link rel="shortcut icon" href="<?PHP echo $normal['data']['web_icon']['text']?>" type="image/x-icon">
|
||||
<meta name="description" content="<?PHP echo $normal['data']['web_desc']['text']?>">
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="<?PHP echo $mirror['data']['info']['bootstrap_css'] ?>">
|
||||
<link rel="stylesheet" href="<?PHP echo $mirror['data']['info']['bootstrap_icon'] ?>">
|
||||
<link rel="stylesheet" href="<?PHP echo $mirror['data']['info']['qweather'] ?>">
|
||||
</head>
|
||||
<body style="background-color:#e3f2fd;">
|
||||
<!-- 菜单 -->
|
||||
<header>
|
||||
<?PHP include($_SERVER['DOCUMENT_ROOT'].'/module/header.php') ?>
|
||||
</header>
|
||||
<!-- 内容 -->
|
||||
<div id="loader" class="container placeholder-glow text-center py-4">
|
||||
<div class="spinner-grow text-primary" role="status"><span class="visually-hidden">Loading...</span></div>
|
||||
<div class="spinner-grow text-primary" role="status"><span class="visually-hidden">Loading...</span></div>
|
||||
<div class="spinner-grow text-primary" role="status"><span class="visually-hidden">Loading...</span></div>
|
||||
</div>
|
||||
<?PHP
|
||||
if (empty($task_id)) {
|
||||
?>
|
||||
<div id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 col-bg-4 col-lg-3 mb-3">
|
||||
<?PHP include('./module/menu.php'); ?>
|
||||
</div>
|
||||
<div class="col-12 col-bg-8 col-lg-9 mt-3 mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card shadow rounded-3">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12 fs-5 fw-bold mb-3"><i class="bi bi-journal-bookmark"></i> 作业管理</div>
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">作业标题</th>
|
||||
<th scope="col">截止时间</th>
|
||||
<th scope="col">创建人</th>
|
||||
<th scope="col">查看数据</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?PHP
|
||||
$num = 1;
|
||||
while ($task['data'][$num]['id']) {
|
||||
// 载入用户个人信息
|
||||
$member_creator_url = $setting['API']['Domain'].'/class/person.php?key='.$setting['Key'].'&type=normal&studentID='.$task['data'][$num]['creator'];
|
||||
$member_creator_ch = curl_init($member_creator_url);
|
||||
curl_setopt($member_creator_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($member_creator_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$member_creator = curl_exec($member_creator_ch);
|
||||
$member_creator = json_decode($member_creator,true);
|
||||
?>
|
||||
<tr>
|
||||
<td><?PHP echo stripslashes($task['data'][$num]['title']) ?></td>
|
||||
<td><?PHP echo stripslashes($task['data'][$num]['closetime']) ?></td>
|
||||
<td><?PHP echo $member_creator['data']['name'] ?></td>
|
||||
<td><a class="btn btn-outline-primary btn-sm" href="?task_id=<?PHP echo $task['data'][$num]['task_id'] ?>" role="button"><i class="bi bi-eye"></i> 查看数据</a></td>
|
||||
</tr>
|
||||
<?PHP
|
||||
$num ++;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?PHP
|
||||
} else {
|
||||
// 载入用户个人信息
|
||||
$task_url = $setting['API']['Domain'].'/class/task.php?key='.$setting['Key'].'&type=check&task_id='.$task_id;
|
||||
$task_ch = curl_init($task_url);
|
||||
curl_setopt($task_ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($task_ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$task = curl_exec($task_ch);
|
||||
$task = json_decode($task,true);
|
||||
?>
|
||||
<div id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 col-bg-4 col-lg-3 mb-3">
|
||||
<?PHP include('./module/menu.php'); ?>
|
||||
</div>
|
||||
<div class="col-12 col-bg-8 col-lg-9 mt-3 mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card shadow rounded-3">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12 fs-5 fw-bold mb-3"><i class="bi bi-journal-bookmark"></i> 作业管理</div>
|
||||
<div class="col-12 mb-3"><a class="btn btn-outline-primary" href="./task.php" role="button"><i class="bi bi-arrow-90deg-left"></i> 返回作业列表</a></div>
|
||||
<div class="col-12 fs-5 fw-bold mb-3 text-center"><?PHP echo stripslashes($task['data']['title']) ?></div>
|
||||
<div class="col-12 mb-3 px-4"><?PHP echo $Parsedown->text(stripslashes($task['data']['text'])); ?></div>
|
||||
<div class="col-12 fs-5 fw-bold mb-1"><i class="bi bi-journal-bookmark"></i> 本班情况</div>
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">学号</th>
|
||||
<th scope="col">姓名</th>
|
||||
<th scope="col">交作业</th>
|
||||
<th scope="col">时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?PHP
|
||||
$num = 22344201;
|
||||
while ($task['data']['person'][$num]['studentID']) {
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?PHP echo stripslashes($task['data']['person'][$num]['studentID']) ?></th>
|
||||
<td><?PHP echo stripslashes($task['data']['person'][$num]['name']) ?></td>
|
||||
<td>
|
||||
<?PHP
|
||||
if (empty($task['data']['person'][$num]['finish']) or $task['data']['person'][$num]['finish'] == "FALSE") {
|
||||
echo '<font color="red">未提交</font>';
|
||||
} else {
|
||||
if ($task['data']['person'][$num]['finish'] == "TRUE") {
|
||||
echo '<font color="green">已提交</font>';
|
||||
} else {
|
||||
echo '<font color="grey">未知</font>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?PHP echo stripslashes($task['data']['person'][$num]['time']) ?></td>
|
||||
</tr>
|
||||
<?PHP
|
||||
$num ++;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?PHP
|
||||
}
|
||||
?>
|
||||
<!-- 页尾 -->
|
||||
<?PHP include($_SERVER['DOCUMENT_ROOT'].'/module/footer.php') ?>
|
||||
</body>
|
||||
<!-- JavaScript -->
|
||||
<script src="<?PHP echo $mirror['data']['info']['qweather'] ?>"></script>
|
||||
<script src="<?PHP echo $mirror['data']['info']['bootstrap_bundle_js'] ?>"></script>
|
||||
<script src="<?PHP echo $mirror['data']['info']['jquery'] ?>"></script>
|
||||
<script>
|
||||
// 加载内容
|
||||
$("#main").hide();
|
||||
window.onload=function(){
|
||||
$("#loader").fadeOut(200);
|
||||
$("#main").show(500);
|
||||
}
|
||||
</script>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user