mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 18:48:41 +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,70 +191,82 @@
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($show_ip) {
|
$header_row = '<tr><th>#</th><th>'.UOJLocale::get('username').'</th>';
|
||||||
$header_row = '<tr><th>#</th><th>'.UOJLocale::get('username').'</th><th>remote_addr</th><th>http_x_forwarded_for</th><th>是否参赛</th></tr>';
|
if ($show_ip) {
|
||||||
|
$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();
|
||||||
$has_participated = array();
|
$has_participated = array();
|
||||||
foreach (DB::selectAll("select * from contests_registrants where contest_id = {$contest['id']} order by username desc") as $reg) {
|
foreach (DB::selectAll("select * from contests_registrants where contest_id = {$contest['id']} order by username desc") as $reg) {
|
||||||
$user = queryUser($reg['username']);
|
$user = queryUser($reg['username']);
|
||||||
$ip_owner[$user['remote_addr']] = $reg['username'];
|
$ip_owner[$user['remote_addr']] = $reg['username'];
|
||||||
$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>';
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
echoLongTable(array('*'), 'contests_registrants', "contest_id = {$contest['id']}", 'order by username desc',
|
if ($has_contest_permission) {
|
||||||
$header_row,
|
$header_row .= '<th>是否参赛</th>';
|
||||||
function($contest, $num) {
|
}
|
||||||
global $myUser;
|
$header_row .= '</tr>';
|
||||||
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' => '',
|
|
||||||
'print_after_table' => function() {
|
|
||||||
global $add_new_contestant_form,
|
|
||||||
$add_group_to_contest_form,
|
|
||||||
$remove_user_from_contest_form,
|
|
||||||
$force_set_user_participated_form;
|
|
||||||
|
|
||||||
if (isset($add_new_contestant_form)) {
|
$config = array('page_len' => 100,
|
||||||
$add_new_contestant_form->printHTML();
|
'get_row_index' => '',
|
||||||
}
|
'print_after_table' => function() {
|
||||||
if (isset($add_group_to_contest_form)) {
|
global $add_new_contestant_form,
|
||||||
$add_group_to_contest_form->printHTML();
|
$add_group_to_contest_form,
|
||||||
}
|
$remove_user_from_contest_form,
|
||||||
if (isset($remove_user_from_contest_form)) {
|
$force_set_user_participated_form;
|
||||||
$remove_user_from_contest_form->printHTML();
|
|
||||||
}
|
if (isset($add_new_contestant_form)) {
|
||||||
if (isset($force_set_user_participated_form)) {
|
$add_new_contestant_form->printHTML();
|
||||||
$force_set_user_participated_form->printHTML();
|
}
|
||||||
}
|
if (isset($add_group_to_contest_form)) {
|
||||||
|
$add_group_to_contest_form->printHTML();
|
||||||
|
}
|
||||||
|
if (isset($remove_user_from_contest_form)) {
|
||||||
|
$remove_user_from_contest_form->printHTML();
|
||||||
|
}
|
||||||
|
if (isset($force_set_user_participated_form)) {
|
||||||
|
$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