diff --git a/web/app/controllers/contests.php b/web/app/controllers/contests.php index 02cd3c8..029ef6b 100644 --- a/web/app/controllers/contests.php +++ b/web/app/controllers/contests.php @@ -5,14 +5,24 @@ become403Page(UOJLocale::get('need login')); } + if (!isset($_COOKIE['bootstrap4'])) { + $REQUIRE_LIB['bootstrap5'] = ''; + } + $upcoming_contest_name = null; $upcoming_contest_href = null; $rest_second = 1000000; function echoContest($contest) { - global $myUser, $upcoming_contest_name, $upcoming_contest_href, $rest_second; + global $myUser, $upcoming_contest_name, $upcoming_contest_href, $rest_second, $REQUIRE_LIB; + + $a_class = ' '; + + if (isset($REQUIRE_LIB['bootstrap5'])) { + $a_class = ' class="text-decoration-none" '; + } $contest_name_link = <<{$contest['name']} +{$contest['name']} EOD; genMoreContestInfo($contest); if ($contest['cur_progress'] == CONTEST_NOT_STARTED) { @@ -23,18 +33,18 @@ EOD; $rest_second = $cur_rest_second; } if ($myUser != null && hasRegistered($myUser, $contest)) { - $contest_name_link .= ''.UOJLocale::get('contests::registered').''; + $contest_name_link .= ''.UOJLocale::get('contests::registered').''; } else { - $contest_name_link .= ''.UOJLocale::get('contests::register').''; + $contest_name_link .= ''.UOJLocale::get('contests::register').''; } } elseif ($contest['cur_progress'] == CONTEST_IN_PROGRESS) { - $contest_name_link .= ''.UOJLocale::get('contests::in progress').''; + $contest_name_link .= ''.UOJLocale::get('contests::in progress').''; } elseif ($contest['cur_progress'] == CONTEST_PENDING_FINAL_TEST) { - $contest_name_link .= ''.UOJLocale::get('contests::pending final test').''; + $contest_name_link .= ''.UOJLocale::get('contests::pending final test').''; } elseif ($contest['cur_progress'] == CONTEST_TESTING) { - $contest_name_link .= ''.UOJLocale::get('contests::final testing').''; + $contest_name_link .= ''.UOJLocale::get('contests::final testing').''; } elseif ($contest['cur_progress'] == CONTEST_FINISHED) { - $contest_name_link .= ''.UOJLocale::get('contests::ended').''; + $contest_name_link .= ''.UOJLocale::get('contests::ended').''; } $last_hour = round($contest['last_min'] / 60, 2); @@ -42,17 +52,28 @@ EOD; $click_zan_block = getClickZanBlock('C', $contest['id'], $contest['zan']); echo ''; echo '', $contest_name_link, ''; - echo '', ''.$contest['start_time_str'].'', ''; + echo '', ' $contest['last_min'])).'">'.$contest['start_time_str'].'', ''; echo '', UOJLocale::get('hours', $last_hour), ''; - echo '', ' ×'.$contest['player_num'].'', ''; + echo '', ' ×'.$contest['player_num'].'', ''; echo '', '
'.$click_zan_block.'
', ''; echo ''; } ?> +'; + } else { + echo ''; +} + ?>

'; $table_header .= ''.UOJLocale::get('contests::contest name').''; $table_header .= ''.UOJLocale::get('contests::start time').''; @@ -60,16 +81,22 @@ EOD; $table_header .= ''.UOJLocale::get('contests::the number of registrants').''; $table_header .= ''.UOJLocale::get('appraisal').''; $table_header .= ''; + + $table_config = array('page_len' => 40); + if (isset($REQUIRE_LIB['bootstrap5'])) { + $table_config['div_classes'] = array('card', 'mb-3'); + $table_config['table_classes'] = array('table', 'uoj-table', 'mb-0'); + } echoLongTable(array('*'), 'contests', "status != 'finished'", 'order by start_time desc, id desc', $table_header, echoContest, - array('page_len' => 40) + $table_config ); if ($rest_second <= 86400) { $notification = json_encode($upcoming_contest_name . " 已经开始了。是否要跳转到比赛页面?"); echo << -
$upcoming_contest_name 倒计时
+
$upcoming_contest_name 倒计时