120 lines
4.6 KiB
PHP
120 lines
4.6 KiB
PHP
<?php
|
|
/**
|
|
* 班级操行分管理系统 - 管理端作业管理
|
|
*
|
|
* 开发者: Canglan
|
|
* 联系方式: admin@sea-studio.top
|
|
* 版权归属: Sea Network Technology Studio
|
|
* 许可证: MIT License
|
|
*
|
|
* 版权所有 © Sea Network Technology Studio
|
|
*/
|
|
|
|
require_once __DIR__ . '/../config.php';
|
|
|
|
if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'admin') {
|
|
header('Location: /index.php');
|
|
exit();
|
|
}
|
|
|
|
$page_title = '作业管理';
|
|
$role = $_SESSION['role'] ?? '';
|
|
|
|
if (!in_array($role, ['班主任', '学习委员'])) {
|
|
header('Location: /admin/dashboard.php');
|
|
exit();
|
|
}
|
|
|
|
include __DIR__ . '/../includes/header.php';
|
|
?>
|
|
|
|
<?php include __DIR__ . '/../includes/nav.php'; ?>
|
|
|
|
<div class="container">
|
|
<div class="card">
|
|
<div class="action-bar">
|
|
<div class="action-buttons">
|
|
<button class="btn btn-primary" onclick="showBatchPointsModal()">批量加减分</button>
|
|
</div>
|
|
</div>
|
|
<div class="table-wrapper">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th><input type="checkbox" id="selectAll" onclick="toggleSelectAll()"></th>
|
|
<th>学号</th>
|
|
<th>姓名</th>
|
|
<th>当前操行分</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="studentList"></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="batchPointsModal" class="modal">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h3>批量加减分</h3>
|
|
<button class="modal-close" onclick="closeModal('batchPointsModal')">×</button>
|
|
</div>
|
|
<form onsubmit="event.preventDefault(); handleSubmitPoints()">
|
|
<div class="form-group">
|
|
<label>已选学生</label>
|
|
<div id="selectedStudentsCount" class="selected-info">未选择学生</div>
|
|
</div>
|
|
<?php if ($role === '学习委员'): ?>
|
|
<div class="form-group">
|
|
<label>科目</label>
|
|
<select id="hwSubjectSelect">
|
|
<option value="">不选择科目</option>
|
|
</select>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="form-group">
|
|
<label>扣分类型</label>
|
|
<div class="deduction-types">
|
|
<button type="button" class="btn btn-sm" onclick="selectDeductionType(-window.DEDUCTION_HOMEWORK_NOT_SUBMIT, '未交作业')">未交作业(-<span class="hw-not-submit"></span>分)</button>
|
|
<button type="button" class="btn btn-sm" onclick="selectDeductionType(-window.DEDUCTION_HOMEWORK_LATE, '迟交作业')">迟交作业(-<span class="hw-late"></span>分)</button>
|
|
<button type="button" class="btn btn-sm" onclick="selectDeductionType(0, '')">自定义</button>
|
|
</div>
|
|
</div>
|
|
<?php if ($role === '学习委员'): ?>
|
|
<div class="form-group">
|
|
<label>具体作业</label>
|
|
<input type="text" id="hwTitle" placeholder="选填,如:第三章练习">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>缴交时间</label>
|
|
<input type="date" id="hwDeadline">
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="form-group">
|
|
<label>分数变动</label>
|
|
<input type="number" id="pointsChange" required min="-5" max="5" step="1" placeholder="正数加分,负数扣分">
|
|
<small><?php
|
|
if ($role === '学习委员') echo '学习委员单次±5分以内';
|
|
else echo '班主任无限制';
|
|
?></small>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>原因</label>
|
|
<textarea id="pointsReason" rows="3" required placeholder="请输入加减分原因"></textarea>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="submit" class="btn btn-primary">确认提交</button>
|
|
<button type="button" class="btn" onclick="closeModal('batchPointsModal')">取消</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script>window.PAGE_CONFIG = { role: '<?php echo $role; ?>' };</script>
|
|
<script src="/assets/js/modules/modal-utils.js"></script>
|
|
<script src="/assets/js/modules/utils.js"></script>
|
|
<script src="/assets/js/modules/points-mgmt.js"></script>
|
|
<script src="/assets/js/homework-manage.js"></script>
|
|
|
|
<?php include __DIR__ . '/../includes/footer.php'; ?>
|