mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-08 14:18:40 +00:00
fix(user): hide hidden problems
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
5055fb3777
commit
2787028069
@ -307,17 +307,17 @@ class HTML {
|
||||
}
|
||||
|
||||
public static function link(?string $uri, $text, $cfg = []) {
|
||||
$cfg += ['location' => 'main', 'escape' => true];
|
||||
$cfg += ['location' => 'main', 'escape' => true, 'class' => ''];
|
||||
|
||||
if ($cfg['escape']) {
|
||||
$text = HTML::escape($text);
|
||||
}
|
||||
|
||||
if ($uri === null) {
|
||||
return HTML::tag('a', [], $text);
|
||||
return HTML::tag('a', ['class' => $cfg['class']], $text);
|
||||
}
|
||||
|
||||
return HTML::tag('a', ['href' => HTML::url($uri, $cfg)], $text);
|
||||
return HTML::tag('a', ['href' => HTML::url($uri, $cfg), 'class' => $cfg['class']], $text);
|
||||
}
|
||||
|
||||
public static function autolink(string $url, array $attr = [], $cfg = []) {
|
||||
|
@ -367,7 +367,7 @@ class UOJProblem {
|
||||
}
|
||||
|
||||
public function getLink(array $cfg = []) {
|
||||
return HTML::link($this->getUri(), $this->getTitle($cfg), ['escape' => false]);
|
||||
return HTML::link($this->getUri(), $this->getTitle($cfg), ['escape' => false, 'class' => $cfg['class'] ?: '']);
|
||||
}
|
||||
|
||||
public function getAttachmentUri() {
|
||||
|
@ -252,17 +252,24 @@
|
||||
</div>
|
||||
<div class="card mb-2">
|
||||
<div class="card-body">
|
||||
<?php $ac_problems = DB::selectAll("select a.problem_id as problem_id, b.title as title from best_ac_submissions a inner join problems b on a.problem_id = b.id where submitter = '{$user['username']}' order by id") ?>
|
||||
<?php $ac_problems = DB::selectAll("select problem_id from best_ac_submissions where submitter = '{$user['username']}' order by problem_id") ?>
|
||||
<h4 class="card-title">
|
||||
<?= UOJLocale::get('accepted problems') . ': ' . UOJLocale::get('n problems in total', count($ac_problems)) ?>
|
||||
</h4>
|
||||
<ul class="nav uoj-ac-problems-list">
|
||||
<?php foreach ($ac_problems as $problem) : ?>
|
||||
<?php foreach ($ac_problems as $prob) : ?>
|
||||
<?php $problem = UOJProblem::query($prob['problem_id']) ?>
|
||||
<?php if ($problem->userCanView(Auth::user())) : ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link rounded uoj-ac-problems-list-item" href="/problem/<?= $problem['problem_id'] ?>" role="button">
|
||||
#<?= $problem['problem_id'] ?>. <?= $problem['title'] ?>
|
||||
<?= $problem->getLink(['with' => 'id', 'class' => 'nav-link rounded uoj-ac-problems-list-item']) ?>
|
||||
</li>
|
||||
<?php else : ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link disabled rounded" role="button">
|
||||
#<?= $problem->info['id'] ?>. 隐藏的题目
|
||||
</a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
|
||||
<?php if (empty($ac_problems)) : ?>
|
||||
|
Loading…
Reference in New Issue
Block a user