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 .= ' ' . UOJLocale::get('problems::my problem') . ' ';
}
if ($info['type'] == 'remote') {
$html .= ' ' . HTML::tag('span', ['class' => 'badge text-bg-success'], '远端评测题');
}
if ($info['is_hidden']) {
$html .= ' ' . UOJLocale::get('hidden') . ' ';
}
if (isset($_COOKIE['show_tags_mode'])) {
foreach ($problem->queryTags() as $tag) {
$html .= ' ' . '' . HTML::escape($tag) . '' . ' ';
}
}
$html .= HTML::tag_end('td');
if (isset($_COOKIE['show_submit_mode'])) {
$perc = $info['submit_num'] > 0 ? round(100 * $info['ac_num'] / $info['submit_num']) : 0;
$html .= HTML::tag(
'td',
[],
HTML::tag(
'div',
[
'class' => 'progress',
'data-bs-toggle' => 'tooltip',
'data-bs-title' => "{$info['ac_num']} / {$info['submit_num']}",
'data-bs-placement' => 'bottom',
],
HTML::tag('div', [
'class' => 'progress-bar bg-success',
'role' => 'progressbar',
'aria-valuenow' => $perc,
'aria-valuemin' => 0,
'aria-valuemax' => 100,
'style' => "width: {$perc}%; min-width: 20px;",
], "{$perc}%")
)
);
}
$html .= HTML::tag('td', [], $problem->getDifficultyHTML());
$html .= HTML::tag('td', [], ClickZans::getCntBlock($problem->info['zan']));
$html .= HTML::tag_end('tr');
return $html;
}
$header = '
';
$header .= 'ID | ';
$header .= '' . UOJLocale::get('problems::problem') . ' | ';
if (isset($_COOKIE['show_submit_mode'])) {
$header .= '' . UOJLocale::get('problems::ac ratio') . ' | ';
}
$header .= '' . UOJLocale::get('problems::difficulty') . ' | ';
$header .= '' . UOJLocale::get('appraisal') . ' | ';
$header .= '
';
$pag_config = [
'page_len' => 20,
'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.difficulty as difficulty',
'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"),
],
],
'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);
?>
= UOJList::info('title') ?>
(ID: #= UOJList::info('id') ?>)
= UOJLocale::get('hidden') ?>
userCanManage(Auth::user())) : ?>
题单简介
= UOJList::cur()->queryContent()['content'] ?>
= $pag->pagination() ?>
=
HTML::responsive_table($header, $pag->get(), [
'table_attr' => [
'class' => ['table', 'uoj-table', 'mb-0'],
],
'tr' => function ($row, $idx) {
return getProblemTR($row);
}
]);
?>
= $pag->pagination() ?>