mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-26 12:28:42 +00:00
refactor: contest_members page with bs5
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2b00906fa1
commit
7678b34221
@ -12,6 +12,11 @@
|
|||||||
if (!validateUInt($_GET['id']) || !($contest = queryContest($_GET['id']))) {
|
if (!validateUInt($_GET['id']) || !($contest = queryContest($_GET['id']))) {
|
||||||
become404Page();
|
become404Page();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($_COOKIE['bootstrap4'])) {
|
||||||
|
$REQUIRE_LIB['bootstrap5'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
genMoreContestInfo($contest);
|
genMoreContestInfo($contest);
|
||||||
|
|
||||||
if (isSuperUser($myUser)) {
|
if (isSuperUser($myUser)) {
|
||||||
@ -186,8 +191,9 @@
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
$header_row = '<tr><th>#</th><th>'.UOJLocale::get('username').'</th>';
|
||||||
if ($show_ip) {
|
if ($show_ip) {
|
||||||
$header_row = '<tr><th>#</th><th>'.UOJLocale::get('username').'</th><th>remote_addr</th><th>http_x_forwarded_for</th><th>是否参赛</th></tr>';
|
$header_row .= '<th>remote_addr</th><th>http_x_forwarded_for</th>';
|
||||||
|
|
||||||
$ip_owner = array();
|
$ip_owner = array();
|
||||||
$forwarded_ip_owner = array();
|
$forwarded_ip_owner = array();
|
||||||
@ -198,37 +204,13 @@
|
|||||||
$forwarded_ip_owner[$user['http_x_forwarded_for']] = $reg['username'];
|
$forwarded_ip_owner[$user['http_x_forwarded_for']] = $reg['username'];
|
||||||
$has_participated[$reg['username']] = $reg['has_participated'];
|
$has_participated[$reg['username']] = $reg['has_participated'];
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$header_row = '<tr><th>#</th><th>'.UOJLocale::get('username').'</th></tr>';
|
|
||||||
}
|
}
|
||||||
|
if ($has_contest_permission) {
|
||||||
|
$header_row .= '<th>是否参赛</th>';
|
||||||
|
}
|
||||||
|
$header_row .= '</tr>';
|
||||||
|
|
||||||
echoLongTable(array('*'), 'contests_registrants', "contest_id = {$contest['id']}", 'order by username desc',
|
$config = array('page_len' => 100,
|
||||||
$header_row,
|
|
||||||
function($contest, $num) {
|
|
||||||
global $myUser;
|
|
||||||
global $show_ip, $ip_owner, $has_participated;
|
|
||||||
|
|
||||||
$user = queryUser($contest['username']);
|
|
||||||
$user_link = getUserLink($contest['username']);
|
|
||||||
if (!$show_ip) {
|
|
||||||
echo '<tr>';
|
|
||||||
} else {
|
|
||||||
if ($ip_owner[$user['remote_addr']] != $user['username'] || $forwarded_ip_owner[$user['http_x_forwarded_for']] != $user['username']) {
|
|
||||||
echo '<tr class="danger">';
|
|
||||||
} else {
|
|
||||||
echo '<tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo '<td>'.$num.'</td>';
|
|
||||||
echo '<td>'.$user_link.'</td>';
|
|
||||||
if ($show_ip) {
|
|
||||||
echo '<td>'.$user['remote_addr'].'</td>';
|
|
||||||
echo '<td>'.$user['http_x_forwarded_for'].'</td>';
|
|
||||||
echo '<td>'.($has_participated[$user['username']] ? 'Yes' : 'No').'</td>';
|
|
||||||
}
|
|
||||||
echo '</tr>';
|
|
||||||
},
|
|
||||||
array('page_len' => 100,
|
|
||||||
'get_row_index' => '',
|
'get_row_index' => '',
|
||||||
'print_after_table' => function() {
|
'print_after_table' => function() {
|
||||||
global $add_new_contestant_form,
|
global $add_new_contestant_form,
|
||||||
@ -249,7 +231,42 @@
|
|||||||
$force_set_user_participated_form->printHTML();
|
$force_set_user_participated_form->printHTML();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
|
|
||||||
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
$config['div_classes'] = array('card', 'mb-3');
|
||||||
|
$config['table_classes'] = array('table', 'uoj-table', 'mb-0', 'text-center');
|
||||||
|
}
|
||||||
|
|
||||||
|
echoLongTable(array('*'), 'contests_registrants', "contest_id = {$contest['id']}", 'order by username desc',
|
||||||
|
$header_row,
|
||||||
|
function($contest, $num) {
|
||||||
|
global $myUser;
|
||||||
|
global $has_contest_permission, $show_ip, $ip_owner, $has_participated;
|
||||||
|
|
||||||
|
$user = queryUser($contest['username']);
|
||||||
|
$user_link = getUserLink($contest['username']);
|
||||||
|
if (!$show_ip) {
|
||||||
|
echo '<tr>';
|
||||||
|
} else {
|
||||||
|
if ($ip_owner[$user['remote_addr']] != $user['username'] || $forwarded_ip_owner[$user['http_x_forwarded_for']] != $user['username']) {
|
||||||
|
echo '<tr class="danger">';
|
||||||
|
} else {
|
||||||
|
echo '<tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo '<td>'.$num.'</td>';
|
||||||
|
echo '<td>'.$user_link.'</td>';
|
||||||
|
if ($show_ip) {
|
||||||
|
echo '<td>'.$user['remote_addr'].'</td>';
|
||||||
|
echo '<td>'.$user['http_x_forwarded_for'].'</td>';
|
||||||
|
}
|
||||||
|
if ($has_contest_permission) {
|
||||||
|
echo '<td>'.($has_participated[$user['username']] ? 'Yes' : 'No').'</td>';
|
||||||
|
}
|
||||||
|
echo '</tr>';
|
||||||
|
},
|
||||||
|
$config
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
<?php echoUOJPageFooter() ?>
|
<?php echoUOJPageFooter() ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user