2016-07-18 16:39:37 +00:00
|
|
|
<?php
|
2022-11-06 02:26:21 +00:00
|
|
|
requirePHPLib('judger');
|
2022-10-21 02:39:33 +00:00
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
Auth::check() || redirectToLogin();
|
2022-03-17 04:00:03 +00:00
|
|
|
|
2023-02-18 01:19:21 +00:00
|
|
|
$conds = [
|
|
|
|
UOJSubmission::sqlForUserCanView(Auth::user()),
|
|
|
|
];
|
2022-11-06 02:26:21 +00:00
|
|
|
$config = [
|
2023-02-17 11:01:22 +00:00
|
|
|
'time_format' => 'friendly',
|
|
|
|
'time_font_size' => 'normal',
|
2022-11-06 02:26:21 +00:00
|
|
|
'judge_time_hidden' => true,
|
|
|
|
'table_config' => [
|
|
|
|
'div_classes' => ['card', 'mb-3', 'table-responsive'],
|
|
|
|
'table_classes' => ['table', 'mb-0', 'uoj-table', 'text-center'],
|
|
|
|
]
|
|
|
|
];
|
2022-04-03 10:18:17 +00:00
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
$q_problem_id = UOJRequest::get('problem_id', 'validateUInt', null);
|
|
|
|
$q_submitter = UOJRequest::get('submitter', 'validateUsername', null);
|
2023-02-04 10:17:31 +00:00
|
|
|
$q_min_score = UOJRequest::get('min_score', 'validateUFloat', null);
|
|
|
|
$q_max_score = UOJRequest::get('max_score', 'validateUFloat', null);
|
2022-11-06 02:26:21 +00:00
|
|
|
$q_lang = UOJRequest::get('language', 'is_short_string', null);
|
|
|
|
|
|
|
|
if ($q_problem_id !== null) {
|
|
|
|
$problem = UOJProblem::query($q_problem_id);
|
|
|
|
if ($problem) {
|
|
|
|
$config['problem'] = $problem;
|
2016-07-18 16:39:37 +00:00
|
|
|
}
|
2022-11-06 02:26:21 +00:00
|
|
|
|
|
|
|
$conds['problem_id'] = $q_problem_id;
|
|
|
|
}
|
|
|
|
if ($q_submitter !== null) {
|
|
|
|
$conds['submitter'] = $q_submitter;
|
|
|
|
}
|
|
|
|
if ($q_min_score !== null) {
|
|
|
|
$conds[] = ['score', '>=', $q_min_score];
|
|
|
|
}
|
|
|
|
if ($q_max_score !== null) {
|
|
|
|
$conds[] = ['score', '<=', $q_max_score];
|
|
|
|
}
|
|
|
|
if ($q_lang != null) {
|
|
|
|
$conds['language'] = $q_lang;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$conds) {
|
|
|
|
$conds = '1';
|
|
|
|
}
|
2023-02-18 01:19:21 +00:00
|
|
|
|
|
|
|
function echoSubmissionItem($info) {
|
|
|
|
$submission = new UOJSubmission($info);
|
|
|
|
$submission->setProblem();
|
|
|
|
$submitter = UOJUser::query($submission->info['submitter']);
|
|
|
|
$cfg = [
|
|
|
|
'show_actual_score' => $submission->viewerCanSeeScore(Auth::user()),
|
|
|
|
'unknown_char' => '?',
|
|
|
|
'result_badge' => true,
|
|
|
|
];
|
2023-02-19 00:02:28 +00:00
|
|
|
$show_status_details = $submission->viewerCanSeeStatusDetailsHTML(Auth::user());
|
2023-02-18 01:19:21 +00:00
|
|
|
|
2023-02-19 00:02:28 +00:00
|
|
|
if ($show_status_details) {
|
|
|
|
echo '<div class="list-group-item bg-warning bg-opacity-25">';
|
|
|
|
} else {
|
|
|
|
echo '<div class="list-group-item">';
|
|
|
|
}
|
2023-02-18 01:19:21 +00:00
|
|
|
echo '<div class="row gy-2 align-items-center">';
|
|
|
|
|
|
|
|
echo '<div class="col-lg-3 col-sm-8 d-flex gap-2">';
|
|
|
|
echo '<div class="d-flex align-items-center">';
|
|
|
|
echo HTML::tag('a', [
|
|
|
|
'href' => HTML::url('/user/' . $submitter['username']),
|
|
|
|
'class' => 'd-inline-block me-2',
|
|
|
|
], HTML::empty_tag('img', [
|
|
|
|
'src' => HTML::avatar_addr($submitter, 64),
|
|
|
|
'class' => 'uoj-user-avatar rounded',
|
|
|
|
'style' => 'width: 2.5rem; height: 2.5rem;',
|
|
|
|
]));
|
|
|
|
echo '</div>';
|
|
|
|
echo '<div class="d-flex flex-column gap-1">';
|
|
|
|
echo '<div>', UOJUser::getLink($submitter), '</div>';
|
|
|
|
echo '<div class="small text-muted">', '<i class="bi bi-clock"></i> ', UOJTime::userFriendlyFormat($submission->info['submit_time']), '</div>';
|
|
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
|
|
|
|
|
|
echo '<div class="col-lg-2 col-sm-4">';
|
|
|
|
echo '<div>', $submission->echoStatusBarTD('result', $cfg), '</div>';
|
|
|
|
echo '</div>';
|
|
|
|
|
|
|
|
echo '<div class="col-lg-4 col-sm-12 text-truncate">';
|
|
|
|
echo $submission->problem->getLink();
|
|
|
|
echo '</div>';
|
|
|
|
|
|
|
|
$lang = UOJLang::getLanguageDisplayName($submission->info['language']);
|
|
|
|
|
2023-02-18 01:28:46 +00:00
|
|
|
echo '<div class="col-lg-3 ps-2 small text-muted">';
|
2023-02-18 01:19:21 +00:00
|
|
|
echo '<span class="d-inline-block">', '<i class="bi bi-hourglass-split"></i> ', $submission->echoStatusBarTD('used_time', $cfg), '</span>', ' / ';
|
|
|
|
echo '<span class="d-inline-block">', '<i class="bi bi-memory"></i> ', $submission->echoStatusBarTD('used_memory', $cfg), '</span>', ' / ';
|
|
|
|
echo '<span class="d-inline-block">', '<i class="bi bi-file-code"></i> ', $submission->echoStatusBarTD('tot_size', $cfg), '</span>';
|
|
|
|
if ($lang != '/') {
|
|
|
|
echo ' / <span class="d-inline-block">', $lang, '</span> ';
|
|
|
|
}
|
|
|
|
echo '</div>';
|
|
|
|
|
|
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
2023-02-19 00:02:28 +00:00
|
|
|
|
|
|
|
if ($show_status_details) {
|
|
|
|
echo '<div class="list-group-item">';
|
|
|
|
echo '<table class="w-100">';
|
|
|
|
echo '<tr id="status_details_' . $submission->info['id'] . '">';
|
|
|
|
echo $submission->getStatusDetailsHTML();
|
|
|
|
echo '</tr>';
|
|
|
|
echo '<script>update_judgement_status_details(' . $submission->info['id'] . ')</script>';
|
|
|
|
echo '</table>';
|
|
|
|
echo '</div>';
|
|
|
|
}
|
2023-02-18 01:19:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$pag = new Paginator([
|
|
|
|
'page_len' => 10,
|
|
|
|
'table_name' => 'submissions',
|
|
|
|
'col_names' => [
|
|
|
|
'id',
|
|
|
|
'problem_id',
|
|
|
|
'contest_id',
|
|
|
|
'submitter',
|
|
|
|
'used_time',
|
|
|
|
'used_memory',
|
|
|
|
'tot_size',
|
|
|
|
'language',
|
|
|
|
'submit_time',
|
|
|
|
'status_details',
|
|
|
|
'status',
|
|
|
|
'result_error',
|
|
|
|
'score',
|
|
|
|
'hide_score_to_others',
|
|
|
|
'hidden_score',
|
|
|
|
],
|
|
|
|
'cond' => $conds,
|
|
|
|
'tail' => 'order by id desc',
|
|
|
|
]);
|
2022-11-06 02:26:21 +00:00
|
|
|
?>
|
2016-07-18 16:39:37 +00:00
|
|
|
<?php echoUOJPageHeader(UOJLocale::get('submissions')) ?>
|
2022-09-24 05:39:55 +00:00
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
<h1>
|
2022-09-24 05:39:55 +00:00
|
|
|
<?= UOJLocale::get('submissions') ?>
|
|
|
|
</h1>
|
|
|
|
|
2022-10-21 02:39:33 +00:00
|
|
|
<div class="d-none d-sm-block mb-3">
|
|
|
|
<form id="form-search" class="row gy-2 gx-3 align-items-end mb-3" target="_self" method="GET">
|
|
|
|
<div id="form-group-problem_id" class="col-auto">
|
|
|
|
<label for="input-problem_id" class="form-label">
|
2023-02-18 01:19:21 +00:00
|
|
|
<?= UOJLocale::get('problems::problem id') ?>
|
2022-10-21 02:39:33 +00:00
|
|
|
</label>
|
|
|
|
<input type="text" class="form-control form-control-sm" name="problem_id" id="input-problem_id" value="<?= $q_problem_id ?>" style="width:4em" />
|
2016-07-18 16:39:37 +00:00
|
|
|
</div>
|
2022-10-21 02:39:33 +00:00
|
|
|
<div id="form-group-submitter" class="col-auto">
|
2022-11-06 06:15:07 +00:00
|
|
|
<label for="input-submitter" class="form-label">
|
2023-02-18 01:19:21 +00:00
|
|
|
<?= UOJLocale::get('username') ?>
|
2022-10-21 02:39:33 +00:00
|
|
|
</label>
|
|
|
|
<div class="input-group input-group-sm">
|
|
|
|
<input type="text" class="form-control form-control-sm" name="submitter" id="input-submitter" value="<?= $q_submitter ?>" maxlength="20" style="width:10em" />
|
2022-11-06 02:26:21 +00:00
|
|
|
<?php if (Auth::check()) : ?>
|
|
|
|
<a id="my-submissions" href="/submissions?submitter=<?= Auth::id() ?>" class="btn btn-outline-secondary btn-sm">
|
|
|
|
我的
|
|
|
|
</a>
|
2022-10-21 02:39:33 +00:00
|
|
|
<?php endif ?>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
$('#my-submissions').click(function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
$('#input-submitter').val('<?= Auth::id() ?>');
|
|
|
|
$('#form-search').submit();
|
|
|
|
});
|
|
|
|
</script>
|
2016-07-18 16:39:37 +00:00
|
|
|
</div>
|
2022-10-21 02:39:33 +00:00
|
|
|
<div id="form-group-score" class="col-auto">
|
2022-11-06 06:15:07 +00:00
|
|
|
<label for="input-min_score" class="form-label">
|
2023-02-18 01:19:21 +00:00
|
|
|
<?= UOJLocale::get('score range') ?>
|
2022-10-21 02:39:33 +00:00
|
|
|
</label>
|
|
|
|
<div class="input-group input-group-sm">
|
2023-02-04 10:17:31 +00:00
|
|
|
<input type="text" class="form-control" name="min_score" id="input-min_score" value="<?= $q_min_score ?>" maxlength="15" style="width:4em" placeholder="0" />
|
2022-10-21 02:39:33 +00:00
|
|
|
<span class="input-group-text" id="basic-addon3">~</span>
|
2023-02-04 10:17:31 +00:00
|
|
|
<input type="text" class="form-control" name="max_score" id="input-max_score" value="<?= $q_max_score ?>" maxlength="15" style="width:4em" placeholder="100" />
|
2022-10-21 02:39:33 +00:00
|
|
|
</div>
|
2016-07-18 16:39:37 +00:00
|
|
|
</div>
|
2022-10-21 02:39:33 +00:00
|
|
|
<div id="form-group-language" class="col-auto">
|
2022-11-06 06:15:07 +00:00
|
|
|
<label for="input-language" class="form-label">
|
2023-02-18 01:19:21 +00:00
|
|
|
<?= UOJLocale::get('problems::language') ?>
|
2022-11-06 06:15:07 +00:00
|
|
|
</label>
|
2022-10-21 02:39:33 +00:00
|
|
|
<select class="form-select form-select-sm" id="input-language" name="language">
|
|
|
|
<option value="">All</option>
|
2022-11-06 02:26:21 +00:00
|
|
|
<?php foreach (UOJLang::$supported_languages as $name => $lang) : ?>
|
|
|
|
<option value="<?= HTML::escape($name) ?>" <?= $name == $q_lang ? 'selected' : '' ?>><?= HTML::escape($lang) ?></option>
|
2022-10-21 02:39:33 +00:00
|
|
|
<?php endforeach ?>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="col-auto">
|
2023-02-18 01:19:21 +00:00
|
|
|
<button type="submit" id="submit-search" class="btn btn-secondary btn-sm ml-2">
|
|
|
|
<?= UOJLocale::get('search') ?>
|
|
|
|
</button>
|
2016-07-18 16:39:37 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
2022-09-24 00:13:39 +00:00
|
|
|
|
2023-02-18 01:19:21 +00:00
|
|
|
<div class="card mb-3">
|
2023-02-18 02:47:48 +00:00
|
|
|
<div class="list-group list-group-flush" style="--bs-list-group-item-padding-y: 0.325rem;">
|
2023-02-18 01:19:21 +00:00
|
|
|
<?php if ($pag->isEmpty()) : ?>
|
|
|
|
<div class="list-group-item text-center">
|
|
|
|
<?= UOJLocale::get('none') ?>
|
|
|
|
</div>
|
|
|
|
<?php endif ?>
|
|
|
|
|
|
|
|
<?php foreach ($pag->get() as $idx => $row) : ?>
|
|
|
|
<?php echoSubmissionItem($row) ?>
|
|
|
|
<?php endforeach ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="">
|
|
|
|
<?= $pag->pagination() ?>
|
|
|
|
</div>
|
2022-09-24 00:13:39 +00:00
|
|
|
|
2016-07-18 16:39:37 +00:00
|
|
|
<?php echoUOJPageFooter() ?>
|