From 6b85af0eebac7e20f59e3528809a2dda07a551cf Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Wed, 9 Nov 2022 21:56:39 +0800 Subject: [PATCH] fix(web/problem_set): problem difficulty --- web/app/controllers/problem_set.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/web/app/controllers/problem_set.php b/web/app/controllers/problem_set.php index e02a2f9..d0ad81d 100644 --- a/web/app/controllers/problem_set.php +++ b/web/app/controllers/problem_set.php @@ -86,14 +86,9 @@ EOD; function getProblemTR($info) { $problem = new UOJProblem($info); - $html = ''; - if ($info['submission_id']) { - $html .= ''; - } else { - $html .= ''; - } - $html .= "#{$info['id']}"; - $html .= ''; + $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') . ' '; @@ -106,7 +101,7 @@ function getProblemTR($info) { $html .= ' ' . '' . HTML::escape($tag) . '' . ' '; } } - $html .= ''; + $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 .= '×' . $info['ac_num'] . ''; @@ -119,8 +114,11 @@ function getProblemTR($info) { $html .= ''; $html .= ''; } - $html .= '' . ClickZans::getCntBlock($problem->info['zan']) . ''; - $html .= ''; + if (isset($_COOKIE['show_difficulty'])) { + $html .= HTML::tag('td', [], $problem->getExtraConfig('difficulty')); + } + $html .= HTML::tag('td', [], ClickZans::getCntBlock($problem->info['zan'])); + $html .= HTML::tag_end('tr'); return $html; } @@ -384,4 +382,4 @@ $pag = new Paginator([ - + \ No newline at end of file