2022-10-22 11:24:48 +00:00
|
|
|
<?php
|
|
|
|
|
2022-11-10 00:16:48 +00:00
|
|
|
requireLib('bootstrap5');
|
|
|
|
requireLib('mathjax');
|
|
|
|
requirePHPLib('form');
|
|
|
|
requirePHPLib('judger');
|
|
|
|
requirePHPLib('data');
|
|
|
|
|
|
|
|
Auth::check() || redirectToLogin();
|
|
|
|
UOJList::init(UOJRequest::get('id')) || UOJResponse::page404();
|
|
|
|
UOJList::cur()->userCanView(Auth::user(), ['ensure' => true]);
|
|
|
|
|
|
|
|
function getProblemTR($info) {
|
|
|
|
$problem = new UOJProblem($info);
|
|
|
|
|
|
|
|
$html = HTML::tag_begin('tr', ['class' => 'text-center']);
|
|
|
|
$html .= HTML::tag('td', ['class' => $info['submission_id'] ? 'table-success' : ''], "#{$info['id']}");
|
|
|
|
$html .= HTML::tag_begin('td', ['class' => 'text-start']);
|
|
|
|
$html .= $problem->getLink(['with' => 'none']);
|
|
|
|
if ($problem->isUserOwnProblem(Auth::user())) {
|
|
|
|
$html .= ' <span class="badge text-white bg-info">' . UOJLocale::get('problems::my problem') . '</span> ';
|
2022-10-22 11:24:48 +00:00
|
|
|
}
|
2022-11-10 00:16:48 +00:00
|
|
|
if ($info['is_hidden']) {
|
|
|
|
$html .= ' <span class="badge text-bg-danger"><i class="bi bi-eye-slash-fill"></i> ' . UOJLocale::get('hidden') . '</span> ';
|
2022-10-22 11:24:48 +00:00
|
|
|
}
|
2022-11-10 00:16:48 +00:00
|
|
|
if (isset($_COOKIE['show_tags_mode'])) {
|
|
|
|
foreach ($problem->queryTags() as $tag) {
|
|
|
|
$html .= ' <a class="uoj-problem-tag">' . '<span class="badge text-bg-secondary">' . HTML::escape($tag) . '</span>' . '</a> ';
|
2022-10-22 11:24:48 +00:00
|
|
|
}
|
|
|
|
}
|
2022-11-10 00:16:48 +00:00
|
|
|
$html .= HTML::tag_end('td');
|
2022-10-22 11:24:48 +00:00
|
|
|
if (isset($_COOKIE['show_submit_mode'])) {
|
2022-11-10 00:16:48 +00:00
|
|
|
$perc = $info['submit_num'] > 0 ? round(100 * $info['ac_num'] / $info['submit_num']) : 0;
|
|
|
|
$html .= '<td><a href="/submissions?problem_id=' . $info['id'] . '&min_score=100&max_score=100">×' . $info['ac_num'] . '</a></td>';
|
|
|
|
$html .= '<td><a href="/submissions?problem_id=' . $info['id'] . '">×' . $info['submit_num'] . '</a></td>';
|
|
|
|
$html .= '<td>';
|
|
|
|
$html .= '<div class="progress bot-buffer-no">';
|
|
|
|
$html .= '<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="' . $perc . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . $perc . '%; min-width: 20px;">';
|
|
|
|
$html .= $perc . '%';
|
|
|
|
$html .= '</div>';
|
|
|
|
$html .= '</div>';
|
|
|
|
$html .= '</td>';
|
2022-10-22 11:24:48 +00:00
|
|
|
}
|
|
|
|
if (isset($_COOKIE['show_difficulty'])) {
|
2022-11-10 00:16:48 +00:00
|
|
|
$html .= HTML::tag('td', [], $problem->getExtraConfig('difficulty'));
|
2022-10-22 11:24:48 +00:00
|
|
|
}
|
2022-11-10 00:16:48 +00:00
|
|
|
$html .= HTML::tag('td', [], ClickZans::getCntBlock($problem->info['zan']));
|
|
|
|
$html .= HTML::tag_end('tr');
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
$header = '<tr>';
|
|
|
|
$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:4em">' . UOJLocale::get('problems::ac') . '</th>';
|
|
|
|
$header .= '<th class="text-center" style="width:4em">' . UOJLocale::get('problems::submit') . '</th>';
|
|
|
|
$header .= '<th class="text-center" style="width:125px;">' . UOJLocale::get('problems::ac ratio') . '</th>';
|
|
|
|
}
|
|
|
|
if (isset($_COOKIE['show_difficulty'])) {
|
|
|
|
$header .= '<th class="text-center" style="width:3em;">' . UOJLocale::get('problems::difficulty') . '</th>';
|
|
|
|
}
|
|
|
|
$header .= '<th class="text-center" style="width:50px;">' . UOJLocale::get('appraisal') . '</th>';
|
|
|
|
$header .= '</tr>';
|
|
|
|
|
|
|
|
$pag_config = [
|
2022-11-12 07:39:17 +00:00
|
|
|
'page_len' => 20,
|
2022-11-10 00:16:48 +00:00
|
|
|
'col_names' => [
|
|
|
|
'best_ac_submissions.submission_id as submission_id',
|
|
|
|
'problems.id as id',
|
|
|
|
'problems.is_hidden as is_hidden',
|
|
|
|
'problems.title as title',
|
|
|
|
'problems.submit_num as submit_num',
|
|
|
|
'problems.ac_num as ac_num',
|
|
|
|
'problems.zan as zan',
|
|
|
|
'problems.extra_config as extra_config',
|
|
|
|
'problems.uploader as uploader',
|
|
|
|
],
|
|
|
|
'table_name' => [
|
|
|
|
"problems",
|
|
|
|
"left join best_ac_submissions",
|
|
|
|
"on", [
|
|
|
|
"best_ac_submissions.submitter" => Auth::id(),
|
|
|
|
"problems.id" => DB::raw("best_ac_submissions.problem_id")
|
|
|
|
],
|
|
|
|
"inner join lists_problems",
|
|
|
|
"on", [
|
|
|
|
"lists_problems.list_id" => UOJList::info('id'),
|
|
|
|
"lists_problems.problem_id" => DB::raw("problems.id"),
|
2022-10-22 11:24:48 +00:00
|
|
|
],
|
2022-11-10 00:16:48 +00:00
|
|
|
],
|
|
|
|
'cond' => '1',
|
|
|
|
'tail' => "order by id asc",
|
|
|
|
'page_len' => 40,
|
|
|
|
'post_filter' => function ($problem) {
|
|
|
|
return (new UOJProblem($problem))->userCanView(Auth::user());
|
|
|
|
}
|
|
|
|
];
|
|
|
|
$pag = new Paginator($pag_config);
|
|
|
|
?>
|
2022-10-22 11:24:48 +00:00
|
|
|
<?php echoUOJPageHeader(UOJLocale::get('problems lists')); ?>
|
|
|
|
|
|
|
|
<div class="row">
|
2022-11-10 00:16:48 +00:00
|
|
|
<!-- left col -->
|
|
|
|
<div class="col-lg-9">
|
|
|
|
<!-- title container -->
|
|
|
|
<div class="d-flex justify-content-between">
|
|
|
|
<h1>
|
|
|
|
<?= UOJList::info('title') ?>
|
|
|
|
<span class="fs-5">(ID: #<?= UOJList::info('id') ?>)</span>
|
|
|
|
<?php if (UOJList::info('is_hidden')) : ?>
|
|
|
|
<span class="badge text-bg-danger fs-6">
|
|
|
|
<i class="bi bi-eye-slash-fill"></i>
|
|
|
|
<?= UOJLocale::get('hidden') ?>
|
|
|
|
</span>
|
|
|
|
<?php endif ?>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<?php if (UOJList::cur()->userCanManage(Auth::user())) : ?>
|
|
|
|
<div class="text-end">
|
|
|
|
<a class="btn btn-primary" href="/list/<?= UOJList::info('id') ?>/manage" role="button">
|
|
|
|
<?= UOJLocale::get('problems::manage') ?>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<?php endif ?>
|
2022-10-22 11:24:48 +00:00
|
|
|
</div>
|
2022-11-10 00:16:48 +00:00
|
|
|
<!-- end title container -->
|
|
|
|
|
|
|
|
<!-- description -->
|
|
|
|
<div class="card my-2">
|
|
|
|
<div class="card-body">
|
|
|
|
<h2 class="h4 mb-3">题单简介</h2>
|
|
|
|
<div class="markdown-body">
|
|
|
|
<?= UOJList::cur()->queryContent()['content'] ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-10-22 11:24:48 +00:00
|
|
|
</div>
|
|
|
|
|
2022-11-10 00:16:48 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-4 col-12"></div>
|
|
|
|
<div class="text-end p-2 col-12 col-sm-8">
|
|
|
|
<div class="form-check d-inline-block me-2">
|
|
|
|
<input type="checkbox" id="input-show_tags_mode" class="form-check-input" <?= isset($_COOKIE['show_tags_mode']) ? 'checked="checked" ' : '' ?> />
|
|
|
|
<label class="form-check-label" for="input-show_tags_mode">
|
|
|
|
<?= UOJLocale::get('problems::show tags') ?>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-check d-inline-block">
|
|
|
|
<input type="checkbox" id="input-show_submit_mode" class="form-check-input" <?= isset($_COOKIE['show_submit_mode']) ? 'checked="checked" ' : '' ?> />
|
|
|
|
<label class="form-check-label" for="input-show_submit_mode">
|
|
|
|
<?= UOJLocale::get('problems::show statistics') ?>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-check d-inline-block">
|
|
|
|
<input type="checkbox" id="input-show_difficulty" class="form-check-input" <?= isset($_COOKIE['show_difficulty']) ? 'checked="checked" ' : '' ?> />
|
|
|
|
<label class="form-check-label" for="input-show_difficulty">
|
|
|
|
<?= UOJLocale::get('problems::show difficulty') ?>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-10-22 11:24:48 +00:00
|
|
|
</div>
|
|
|
|
|
2022-11-10 00:16:48 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
$('#input-show_tags_mode').click(function() {
|
|
|
|
if (this.checked) {
|
|
|
|
$.cookie('show_tags_mode', '', {
|
2022-12-03 06:58:06 +00:00
|
|
|
path: '/list',
|
|
|
|
expires: 365,
|
2022-11-10 00:16:48 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
$.removeCookie('show_tags_mode', {
|
2022-12-03 06:58:06 +00:00
|
|
|
path: '/list',
|
2022-11-10 00:16:48 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
location.reload();
|
|
|
|
});
|
|
|
|
$('#input-show_submit_mode').click(function() {
|
|
|
|
if (this.checked) {
|
|
|
|
$.cookie('show_submit_mode', '', {
|
2022-12-03 06:58:06 +00:00
|
|
|
path: '/list',
|
|
|
|
expires: 365,
|
2022-11-10 00:16:48 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
$.removeCookie('show_submit_mode', {
|
2022-12-03 06:58:06 +00:00
|
|
|
path: '/list',
|
2022-11-10 00:16:48 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
location.reload();
|
|
|
|
});
|
|
|
|
$('#input-show_difficulty').click(function() {
|
|
|
|
if (this.checked) {
|
|
|
|
$.cookie('show_difficulty', '', {
|
2022-12-03 06:58:06 +00:00
|
|
|
path: '/list',
|
|
|
|
expires: 365,
|
2022-11-10 00:16:48 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
$.removeCookie('show_difficulty', {
|
2022-12-03 06:58:06 +00:00
|
|
|
path: '/list',
|
2022-11-10 00:16:48 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
location.reload();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<?= $pag->pagination() ?>
|
|
|
|
|
|
|
|
<div class="card my-3 table-responsive">
|
|
|
|
<?=
|
|
|
|
HTML::responsive_table($header, $pag->get(), [
|
|
|
|
'table_attr' => [
|
|
|
|
'class' => ['table', 'uoj-table', 'mb-0'],
|
|
|
|
],
|
|
|
|
'tr' => function ($row, $idx) {
|
|
|
|
return getProblemTR($row);
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
?>
|
|
|
|
</div>
|
2022-10-22 11:24:48 +00:00
|
|
|
|
2022-11-10 00:16:48 +00:00
|
|
|
<?= $pag->pagination() ?>
|
2022-10-22 11:24:48 +00:00
|
|
|
|
2022-11-10 00:16:48 +00:00
|
|
|
</div>
|
|
|
|
<!-- end left col -->
|
2022-10-22 11:24:48 +00:00
|
|
|
|
2022-11-10 00:16:48 +00:00
|
|
|
<aside class="col-lg-3 mt-3 mt-lg-0">
|
|
|
|
<?php uojIncludeView('sidebar') ?>
|
|
|
|
</aside>
|
2022-10-22 11:24:48 +00:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php echoUOJPageFooter() ?>
|