mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-08 13:38:41 +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 = []) {
|
public static function link(?string $uri, $text, $cfg = []) {
|
||||||
$cfg += ['location' => 'main', 'escape' => true];
|
$cfg += ['location' => 'main', 'escape' => true, 'class' => ''];
|
||||||
|
|
||||||
if ($cfg['escape']) {
|
if ($cfg['escape']) {
|
||||||
$text = HTML::escape($text);
|
$text = HTML::escape($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($uri === null) {
|
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 = []) {
|
public static function autolink(string $url, array $attr = [], $cfg = []) {
|
||||||
|
@ -367,7 +367,7 @@ class UOJProblem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getLink(array $cfg = []) {
|
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() {
|
public function getAttachmentUri() {
|
||||||
|
@ -252,17 +252,24 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card mb-2">
|
<div class="card mb-2">
|
||||||
<div class="card-body">
|
<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">
|
<h4 class="card-title">
|
||||||
<?= UOJLocale::get('accepted problems') . ': ' . UOJLocale::get('n problems in total', count($ac_problems)) ?>
|
<?= UOJLocale::get('accepted problems') . ': ' . UOJLocale::get('n problems in total', count($ac_problems)) ?>
|
||||||
</h4>
|
</h4>
|
||||||
<ul class="nav uoj-ac-problems-list">
|
<ul class="nav uoj-ac-problems-list">
|
||||||
<?php foreach ($ac_problems as $problem) : ?>
|
<?php foreach ($ac_problems as $prob) : ?>
|
||||||
<li class="nav-item">
|
<?php $problem = UOJProblem::query($prob['problem_id']) ?>
|
||||||
<a class="nav-link rounded uoj-ac-problems-list-item" href="/problem/<?= $problem['problem_id'] ?>" role="button">
|
<?php if ($problem->userCanView(Auth::user())) : ?>
|
||||||
#<?= $problem['problem_id'] ?>. <?= $problem['title'] ?>
|
<li class="nav-item">
|
||||||
</a>
|
<?= $problem->getLink(['with' => 'id', 'class' => 'nav-link rounded uoj-ac-problems-list-item']) ?>
|
||||||
</li>
|
</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 endforeach ?>
|
||||||
|
|
||||||
<?php if (empty($ac_problems)) : ?>
|
<?php if (empty($ac_problems)) : ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user