mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2025-03-26 05:37:02 +00:00
Compare commits
2 Commits
d502fb95ac
...
7ab64c1ba3
Author | SHA1 | Date | |
---|---|---|---|
7ab64c1ba3 | |||
219d3526e5 |
@ -12,113 +12,13 @@
|
||||
if (!validateUInt($list_id) || !($list = queryProblemList($list_id))) {
|
||||
become404Page();
|
||||
}
|
||||
|
||||
if (isSuperUser($myUser)) {
|
||||
$list_tags = queryProblemListTags($list_id);
|
||||
|
||||
$list_editor = new UOJBlogEditor();
|
||||
$list_editor->name = 'list';
|
||||
$list_editor->blog_url = null;
|
||||
$list_editor->cur_data = array(
|
||||
'title' => $list['title'],
|
||||
'tags' => $list_tags,
|
||||
'is_hidden' => $list['is_hidden']
|
||||
);
|
||||
$list_editor->label_text = array_merge($list_editor->label_text, array(
|
||||
'view blog' => '保存题单信息',
|
||||
'blog visibility' => '题单可见性'
|
||||
));
|
||||
$list_editor->show_editor = false;
|
||||
|
||||
$list_editor->save = function($data) {
|
||||
global $list_id, $list;
|
||||
DB::update("update lists set title = '" . DB::escape($data['title']) . "' where id = {$list_id}");
|
||||
|
||||
if ($data['tags'] !== $list_tags) {
|
||||
DB::delete("delete from lists_tags where list_id = {$list_id}");
|
||||
foreach ($data['tags'] as $tag) {
|
||||
DB::insert("insert into lists_tags (list_id, tag) values ({$list_id}, '" . DB::escape($tag) . "')");
|
||||
}
|
||||
}
|
||||
|
||||
if ($data['is_hidden'] != $list['is_hidden'] ) {
|
||||
DB::update("update lists set is_hidden = {$data['is_hidden']} where id = {$list_id}");
|
||||
}
|
||||
};
|
||||
|
||||
$list_editor->runAtServer();
|
||||
}
|
||||
|
||||
function removeFromProblemListForm($problem_id) {
|
||||
$res_form = new UOJForm("remove_problem_{$problem_id}");
|
||||
$input_name = "problem_id_delete_{$problem_id}";
|
||||
$res_form->addHidden($input_name, $problem_id, function($problem_id) {
|
||||
global $myUser;
|
||||
if (!isSuperUser($myUser)) {
|
||||
return '只有超级用户可以编辑题单';
|
||||
}
|
||||
}, null);
|
||||
$res_form->handle = function() use ($input_name) {
|
||||
global $list_id;
|
||||
$problem_id = $_POST[$input_name];
|
||||
DB::query("delete from lists_problems where problem_id={$problem_id} and list_id={$list_id}");
|
||||
};
|
||||
$res_form->submit_button_config['class_str'] = 'btn btn-danger';
|
||||
$res_form->submit_button_config['text'] = '删除';
|
||||
$res_form->submit_button_config['align'] = 'inline';
|
||||
return $res_form;
|
||||
}
|
||||
|
||||
$removeProblemForms = array();
|
||||
if (isSuperUser($myUser)) {
|
||||
$problem_ids = DB::query("select problem_id from lists_problems where list_id = {$list_id}");
|
||||
while ($row = DB::fetch($problem_ids)) {
|
||||
$problem_id = $row['problem_id'];
|
||||
$removeForm = removeFromProblemListForm($problem_id);
|
||||
$removeForm->runAtServer();
|
||||
$removeProblemForms[$problem_id] = $removeForm;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSuperUser($myUser)) {
|
||||
$add_new_problem_form = new UOJForm('add_new_problem');
|
||||
$add_new_problem_form->addInput('problem_id', 'text', '题目 ID', '',
|
||||
function ($x) {
|
||||
global $myUser, $list_id;
|
||||
|
||||
if (!isSuperUser($myUser)) {
|
||||
return '只有超级用户可以编辑题单';
|
||||
}
|
||||
|
||||
if (!validateUInt($x)) {
|
||||
return 'ID 不合法';
|
||||
}
|
||||
$problem = queryProblemBrief($x);
|
||||
if (!$problem) {
|
||||
return '题目不存在';
|
||||
}
|
||||
|
||||
if (queryProblemInList($list_id, $x)) {
|
||||
return '该题目已经在题单中';
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
null
|
||||
);
|
||||
$add_new_problem_form->submit_button_config['align'] = 'compressed';
|
||||
$add_new_problem_form->submit_button_config['text'] = '添加到题单';
|
||||
$add_new_problem_form->handle = function() {
|
||||
global $list_id, $myUser;
|
||||
$problem_id = $_POST['problem_id'];
|
||||
|
||||
DB::insert("insert into lists_problems (list_id, problem_id) values ({$list_id}, {$problem_id})");
|
||||
};
|
||||
$add_new_problem_form->runAtServer();
|
||||
if (!isset($_COOKIE['bootstrap4'])) {
|
||||
$REQUIRE_LIB['bootstrap5'] = '';
|
||||
}
|
||||
|
||||
function echoProblem($problem) {
|
||||
global $myUser, $removeProblemForms;
|
||||
global $myUser, $removeProblemForms, $REQUIRE_LIB;
|
||||
|
||||
if (isProblemVisibleToUser($problem, $myUser)) {
|
||||
echo '<tr class="text-center">';
|
||||
@ -128,10 +28,10 @@
|
||||
echo '<td>';
|
||||
}
|
||||
echo '#', $problem['id'], '</td>';
|
||||
echo '<td class="text-left">';
|
||||
if (isSuperUser($myUser)) {
|
||||
$form = $removeProblemForms[$problem['id']];
|
||||
$form->printHTML();
|
||||
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||
echo '<td class="text-start">';
|
||||
} else {
|
||||
echo '<td class="text-left">';
|
||||
}
|
||||
if ($problem['is_hidden']) {
|
||||
echo ' <span class="text-danger">[隐藏]</span> ';
|
||||
@ -139,13 +39,26 @@
|
||||
if ($problem['uploader'] == $myUser['username']) {
|
||||
echo ' <span class="text-info">[我的题目]</span> ';
|
||||
}
|
||||
echo '<a href="/problem/', $problem['id'], '">', $problem['title'], '</a>';
|
||||
echo '<a ';
|
||||
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||
echo ' class="text-decoration-none" ';
|
||||
}
|
||||
echo ' href="/problem/', $problem['id'], '">', $problem['title'], '</a>';
|
||||
|
||||
if (isset($_COOKIE['show_tags_mode'])) {
|
||||
echo ' <span class="text-info" style="font-size: 10px">' . $problem["uploader"] . '</span> ';
|
||||
|
||||
foreach (queryProblemTags($problem['id']) as $tag) {
|
||||
echo '<a class="uoj-problem-tag">', '<span class="badge badge-pill badge-secondary">', HTML::escape($tag), '</span>', '</a>';
|
||||
|
||||
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||
echo '<a class="uoj-problem-tag my-1">';
|
||||
echo '<span class="badge bg-secondary">';
|
||||
} else {
|
||||
echo '<a class="uoj-problem-tag">';
|
||||
echo '<span class="badge badge-pill badge-secondary">';
|
||||
}
|
||||
echo HTML::escape($tag), '</span>';
|
||||
echo '</a> ';
|
||||
}
|
||||
}
|
||||
echo '</td>';
|
||||
@ -161,14 +74,6 @@
|
||||
</td>
|
||||
EOD;
|
||||
}
|
||||
if (isset($_COOKIE['show_difficulty'])) {
|
||||
$extra_config = getProblemExtraConfig($problem);
|
||||
if ($extra_config['difficulty'] == 0) {
|
||||
echo "<td></td>";
|
||||
} else {
|
||||
echo "<td>{$extra_config['difficulty']}</td>";
|
||||
}
|
||||
}
|
||||
echo '<td class="text-left">', getClickZanBlock('P', $problem['id'], $problem['zan']), '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
@ -178,14 +83,11 @@ EOD;
|
||||
$header .= '<th class="text-center" style="width:5em;">ID</th>';
|
||||
$header .= '<th>'.UOJLocale::get('problems::problem').'</th>';
|
||||
if (isset($_COOKIE['show_submit_mode'])) {
|
||||
$header .= '<th class="text-center" style="width:5em;">'.UOJLocale::get('problems::ac').'</th>';
|
||||
$header .= '<th class="text-center" style="width:5em;">'.UOJLocale::get('problems::submit').'</th>';
|
||||
$header .= '<th class="text-center" style="width:150px;">'.UOJLocale::get('problems::ac ratio').'</th>';
|
||||
$header .= '<th class="text-center" style="width:' . (isset($REQUIRE_LIB['bootstrap5']) ? '4' : '5') . 'em;">'.UOJLocale::get('problems::ac').'</th>';
|
||||
$header .= '<th class="text-center" style="width:' . (isset($REQUIRE_LIB['bootstrap5']) ? '4' : '5') . 'em;">'.UOJLocale::get('problems::submit').'</th>';
|
||||
$header .= '<th class="text-center" style="width:' . (isset($REQUIRE_LIB['bootstrap5']) ? '125' : '150') . 'px;">'.UOJLocale::get('problems::ac ratio').'</th>';
|
||||
}
|
||||
if (isset($_COOKIE['show_difficulty'])) {
|
||||
$header .= '<th class="text-center" style="width:7em;">'.UOJLocale::get('problems::difficulty').'</th>';
|
||||
}
|
||||
$header .= '<th class="text-center" style="width:180px;">'.UOJLocale::get('appraisal').'</th>';
|
||||
$header .= '<th class="text-center" style="width:190px;">'.UOJLocale::get('appraisal').'</th>';
|
||||
$header .= '</tr>';
|
||||
|
||||
$pag_config = array('page_len' => 40);
|
||||
@ -197,35 +99,107 @@ EOD;
|
||||
$pag_config['tail'] = "order by id asc";
|
||||
$pag = new Paginator($pag_config);
|
||||
|
||||
$div_classes = array('table-responsive');
|
||||
$table_classes = array('table', 'table-bordered', 'table-hover', 'table-striped');
|
||||
$div_classes = isset($REQUIRE_LIB['bootstrap5'])
|
||||
? array('card', 'my-3', 'overflow-auto')
|
||||
: array('table-responsive');
|
||||
$table_classes = isset($REQUIRE_LIB['bootstrap5'])
|
||||
? array('table', 'uoj-table', 'mb-0')
|
||||
: array('table', 'table-bordered', 'table-hover', 'table-striped');
|
||||
?>
|
||||
<?php echoUOJPageHeader(UOJLocale::get('problems lists')); ?>
|
||||
<?php
|
||||
if (isSuperUser($myUser)) {
|
||||
echo '<h5>编辑题单信息</h5>';
|
||||
echo '<div class="mb-4">';
|
||||
$list_editor->printHTML();
|
||||
echo '</div>';
|
||||
|
||||
echo '<h5>添加题目到题单</h5>';
|
||||
$add_new_problem_form->printHTML();
|
||||
}
|
||||
?>
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<h5>"<?= $list['title'] ?>" 中的题目: </h5>
|
||||
<p>(题单 ID: #<?= $list['id'] ?>)</p>
|
||||
<div class="col-sm-12 col-md-9">
|
||||
<div class="d-flex justify-content-between">
|
||||
<?php endif ?>
|
||||
<h1 class="h2">
|
||||
<?= $list['title'] ?>
|
||||
<span class="fs-5">(ID: #<?= $list['id'] ?>)</span>
|
||||
</h1>
|
||||
|
||||
<?php if (isSuperUser($myUser)): ?>
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<div class="text-end">
|
||||
<a class="btn btn-primary" href="/problem_list/<?= $list['id'] ?>/manage" role="button">
|
||||
<?= UOJLocale::get('problems::manage') ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-4 order-sm-9 checkbox text-right fine-tune-down">
|
||||
<label class="checkbox-inline" for="input-show_tags_mode"><input type="checkbox" id="input-show_tags_mode" <?= isset($_COOKIE['show_tags_mode']) ? 'checked="checked" ': ''?>/> <?= UOJLocale::get('problems::show tags') ?></label>
|
||||
<label class="checkbox-inline" for="input-show_submit_mode"><input type="checkbox" id="input-show_submit_mode" <?= isset($_COOKIE['show_submit_mode']) ? 'checked="checked" ': ''?>/> <?= UOJLocale::get('problems::show statistics') ?></label>
|
||||
<?php else: ?>
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/problem_list/<?= $list['id'] ?>/manage" role="tab">
|
||||
<?= UOJLocale::get('problems::manage') ?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-4"></div>
|
||||
<div class="col-sm-4 order-sm-5
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
text-end p-2
|
||||
<?php else: ?>
|
||||
text-right checkbox
|
||||
<?php endif ?>
|
||||
">
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<div class="form-check d-inline-block me-2">
|
||||
<?php else: ?>
|
||||
<label class="checkbox-inline" for="input-show_tags_mode">
|
||||
<?php endif ?>
|
||||
<input type="checkbox" id="input-show_tags_mode"
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
class="form-check-input"
|
||||
<?php endif ?>
|
||||
<?= isset($_COOKIE['show_tags_mode']) ? 'checked="checked" ': ''?>
|
||||
/>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<label class="form-check-label" for="input-show_tags_mode">
|
||||
<?php endif ?>
|
||||
<?= UOJLocale::get('problems::show tags') ?>
|
||||
|
||||
</label>
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<div class="form-check d-inline-block">
|
||||
<?php else: ?>
|
||||
<label class="checkbox-inline" for="input-show_submit_mode">
|
||||
<?php endif ?>
|
||||
<input type="checkbox" id="input-show_submit_mode"
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
class="form-check-input"
|
||||
<?php endif ?>
|
||||
<?= isset($_COOKIE['show_submit_mode']) ? 'checked="checked" ': ''?>
|
||||
/>
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<label class="form-check-label" for="input-show_submit_mode">
|
||||
<?php endif ?>
|
||||
<?= UOJLocale::get('problems::show statistics') ?>
|
||||
</label>
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<div class="col-sm-4 order-sm-5">
|
||||
<div class="col-sm-4 order-sm-3">
|
||||
<?php echo $pag->pagination(); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<div class="top-buffer-sm"></div>
|
||||
<?php endif ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#input-show_tags_mode').click(function() {
|
||||
if (this.checked) {
|
||||
@ -253,27 +227,40 @@ $('#input-show_difficulty').click(function() {
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="<?= join($div_classes, ' ') ?>">
|
||||
<table class="<?= join($table_classes, ' ') ?>">
|
||||
<thead>
|
||||
<?= $header ?>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
echo '<div class="', join($div_classes, ' '), '">';
|
||||
echo '<table class="', join($table_classes, ' '), '">';
|
||||
echo '<thead>';
|
||||
echo $header;
|
||||
echo '</thead>';
|
||||
echo '<tbody>';
|
||||
|
||||
foreach ($pag->get() as $idx => $row) {
|
||||
echoProblem($row);
|
||||
echo "\n";
|
||||
}
|
||||
if ($pag->isEmpty()) {
|
||||
echo '<tr><td class="text-center" colspan="233">'.UOJLocale::get('none').'</td></tr>';
|
||||
}
|
||||
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
|
||||
echo $pag->pagination();
|
||||
?>
|
||||
|
||||
<?php if ($pag->isEmpty()): ?>
|
||||
<tr>
|
||||
<td class="text-center" colspan="233">
|
||||
<?= UOJLocale::get('none') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?= $pag->pagination(); ?>
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
</div>
|
||||
|
||||
<aside class="col mt-3 mt-md-0">
|
||||
|
||||
<?php uojIncludeView('sidebar', array()); ?>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php echoUOJPageFooter() ?>
|
||||
|
194
web/app/controllers/problem_list_manage.php
Normal file
194
web/app/controllers/problem_list_manage.php
Normal file
@ -0,0 +1,194 @@
|
||||
<?php
|
||||
if (!Auth::check()) {
|
||||
become403Page(UOJLocale::get('need login'));
|
||||
}
|
||||
|
||||
requirePHPLib('form');
|
||||
requirePHPLib('judger');
|
||||
requirePHPLib('data');
|
||||
|
||||
$list_id = $_GET['id'];
|
||||
|
||||
if (!validateUInt($list_id) || !($list = queryProblemList($list_id))) {
|
||||
become404Page();
|
||||
}
|
||||
|
||||
if (!isSuperUser($myUser)) {
|
||||
become403Page();
|
||||
}
|
||||
|
||||
$list_tags = queryProblemListTags($list_id);
|
||||
|
||||
$list_editor = new UOJBlogEditor();
|
||||
$list_editor->name = 'list';
|
||||
$list_editor->blog_url = null;
|
||||
$list_editor->cur_data = array(
|
||||
'title' => $list['title'],
|
||||
'tags' => $list_tags,
|
||||
'is_hidden' => $list['is_hidden']
|
||||
);
|
||||
$list_editor->label_text = array_merge($list_editor->label_text, array(
|
||||
'view blog' => '保存题单信息',
|
||||
'blog visibility' => '题单可见性'
|
||||
));
|
||||
$list_editor->show_editor = false;
|
||||
|
||||
$list_editor->save = function($data) {
|
||||
global $list_id, $list;
|
||||
DB::update("update lists set title = '" . DB::escape($data['title']) . "' where id = {$list_id}");
|
||||
|
||||
if ($data['tags'] !== $list_tags) {
|
||||
DB::delete("delete from lists_tags where list_id = {$list_id}");
|
||||
foreach ($data['tags'] as $tag) {
|
||||
DB::insert("insert into lists_tags (list_id, tag) values ({$list_id}, '" . DB::escape($tag) . "')");
|
||||
}
|
||||
}
|
||||
|
||||
if ($data['is_hidden'] != $list['is_hidden'] ) {
|
||||
DB::update("update lists set is_hidden = {$data['is_hidden']} where id = {$list_id}");
|
||||
}
|
||||
};
|
||||
|
||||
$list_editor->runAtServer();
|
||||
|
||||
$add_new_problem_form = new UOJForm('add_new_problem');
|
||||
$add_new_problem_form->addInput('problem_id', 'text', '题目 ID', '',
|
||||
function ($x) {
|
||||
global $myUser, $list_id;
|
||||
|
||||
if (!isSuperUser($myUser)) {
|
||||
return '只有超级用户可以编辑题单';
|
||||
}
|
||||
|
||||
if (!validateUInt($x)) {
|
||||
return 'ID 不合法';
|
||||
}
|
||||
$problem = queryProblemBrief($x);
|
||||
if (!$problem) {
|
||||
return '题目不存在';
|
||||
}
|
||||
|
||||
if (queryProblemInList($list_id, $x)) {
|
||||
return '该题目已经在题单中';
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
null
|
||||
);
|
||||
$add_new_problem_form->submit_button_config['align'] = 'compressed';
|
||||
$add_new_problem_form->submit_button_config['text'] = '添加到题单';
|
||||
$add_new_problem_form->handle = function() {
|
||||
global $list_id, $myUser;
|
||||
$problem_id = $_POST['problem_id'];
|
||||
|
||||
DB::insert("insert into lists_problems (list_id, problem_id) values ({$list_id}, {$problem_id})");
|
||||
};
|
||||
$add_new_problem_form->runAtServer();
|
||||
|
||||
function removeFromProblemListForm($problem_id) {
|
||||
$res_form = new UOJForm("remove_problem_{$problem_id}");
|
||||
$input_name = "problem_id_delete_{$problem_id}";
|
||||
$res_form->addHidden($input_name, $problem_id, function($problem_id) {
|
||||
global $myUser;
|
||||
if (!isSuperUser($myUser)) {
|
||||
return '只有超级用户可以编辑题单';
|
||||
}
|
||||
}, null);
|
||||
$res_form->handle = function() use ($input_name) {
|
||||
global $list_id;
|
||||
$problem_id = $_POST[$input_name];
|
||||
DB::query("delete from lists_problems where problem_id={$problem_id} and list_id={$list_id}");
|
||||
};
|
||||
$res_form->submit_button_config['class_str'] = 'btn btn-danger';
|
||||
$res_form->submit_button_config['text'] = '删除';
|
||||
$res_form->submit_button_config['align'] = 'inline';
|
||||
return $res_form;
|
||||
}
|
||||
|
||||
$removeProblemForms = array();
|
||||
$problem_ids = DB::query("select problem_id from lists_problems where list_id = {$list_id}");
|
||||
while ($row = DB::fetch($problem_ids)) {
|
||||
$problem_id = $row['problem_id'];
|
||||
$removeForm = removeFromProblemListForm($problem_id);
|
||||
$removeForm->runAtServer();
|
||||
$removeProblemForms[$problem_id] = $removeForm;
|
||||
}
|
||||
|
||||
function echoProblem($problem) {
|
||||
global $myUser, $removeProblemForms;
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="text-center">';
|
||||
echo '#', $problem['id'], '</td>';
|
||||
echo '<td class="text-left">';
|
||||
if ($problem['is_hidden']) {
|
||||
echo ' <span class="text-danger">[隐藏]</span> ';
|
||||
}
|
||||
if ($problem['uploader'] == $myUser['username']) {
|
||||
echo ' <span class="text-info">[我的题目]</span> ';
|
||||
}
|
||||
echo '<a href="/problem/', $problem['id'], '">', $problem['title'], '</a>';
|
||||
echo '</td>';
|
||||
echo '<td class="text-center">';
|
||||
$removeProblemForms[$problem['id']]->printHTML();
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
$pag_config = array('page_len' => 40);
|
||||
$pag_config['col_names'] = array('problems.id as id', 'problems.is_hidden as is_hidden', 'problems.title as title', 'problems.uploader as uploader');
|
||||
|
||||
$pag_config['table_name'] = "problems inner join lists_problems lp on lp.list_id = {$list_id} and lp.problem_id = problems.id";
|
||||
|
||||
$pag_config['cond'] = '1';
|
||||
$pag_config['tail'] = "order by id asc";
|
||||
$pag = new Paginator($pag_config);
|
||||
?>
|
||||
|
||||
<?php echoUOJPageHeader($list['title'] . ' 管理'); ?>
|
||||
|
||||
<h1 class="h2">
|
||||
<?= $list['title'] ?>(#<?= $list['id'] ?>)管理
|
||||
</h1>
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item"><a class="nav-link" href="/problem_list/<?= $list['id'] ?>/manage" role="tab">管理</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="/problem_list/<?= $list['id'] ?>" role="tab">返回</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="mb-4">
|
||||
<?php $list_editor->printHTML(); ?>
|
||||
</div>
|
||||
|
||||
<table class="table table-hover mb-4">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">ID</th>
|
||||
<th>题目名称</th>
|
||||
<th class="text-center">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($pag->get() as $idx => $row) {
|
||||
echoProblem($row);
|
||||
echo "\n";
|
||||
}
|
||||
?>
|
||||
<?php if ($pag->isEmpty()): ?>
|
||||
<tr>
|
||||
<td class="text-center" colspan="233">
|
||||
<?= UOJLocale::get('none') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="my-4">
|
||||
<?php $add_new_problem_form->printHTML() ?>
|
||||
</div>
|
||||
|
||||
<?= $pag->pagination(); ?>
|
||||
|
||||
<?php echoUOJPageFooter() ?>
|
@ -21,6 +21,7 @@ Route::group([
|
||||
|
||||
Route::any('/problem_lists', '/problem_lists.php');
|
||||
Route::any('/problem_list/{id}', '/problem_list.php');
|
||||
Route::any('/problem_list/{id}/manage', '/problem_list_manage.php');
|
||||
|
||||
Route::any('/contests', '/contests.php');
|
||||
Route::any('/contest/new', '/add_contest.php');
|
||||
|
Loading…
x
Reference in New Issue
Block a user