feat(problem): show contests used this problem
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2023-02-16 11:03:32 +08:00
parent 32efcd3e64
commit 0f3c934adc
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
3 changed files with 22 additions and 2 deletions

View File

@ -307,7 +307,25 @@ if (UOJContest::cur()) {
<?= UOJLocale::get('problems::memory limit') ?>: <?= $memory_limit ? "$memory_limit MB" : "N/A" ?>
</div>
<hr>
<hr />
<?php if (!UOJContest::cur()) : ?>
<?php $contest_problems = UOJProblem::cur()->findInContests(); ?>
<?php if (!empty($contest_problems)) : ?>
<div class="alert alert-light">
<h5 class="alert-heading"><?= UOJLocale::get('problems::the problem was used in the following contest') ?>:</h5>
<ul class="mb-0">
<?php foreach ($contest_problems as $cp) : ?>
<?php if ($cp->userCanView(Auth::user())) : ?>
<li><?= $cp->contest->getLink(['class' => 'alert-link text-decoration-underline']) ?></li>
<?php endif ?>
<?php endforeach ?>
</ul>
</div>
<hr />
<?php endif ?>
<?php endif ?>
<div class="tab-content">
<div class="tab-pane active" id="statement">

View File

@ -64,4 +64,5 @@ return [
'attachments download' => 'Attachments download',
'resources' => 'Resources',
'cannot submit' => 'This problem doesn\'t configured <code>submission_requirement</code>, so it cannot be submitted temporarily.',
'the problem was used in the following contest' => 'The problem was used in the following contest',
];

View File

@ -63,5 +63,6 @@ return [
'test data' => '测试数据',
'attachments download' => '附件下载',
'resources' => '相关资源',
'cannot submit' => '当前题目未配置 <code>submission_requirement</code>,暂时无法提交。'
'cannot submit' => '当前题目未配置 <code>submission_requirement</code>,暂时无法提交。',
'the problem was used in the following contest' => '该题目被以下比赛使用',
];