mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-09 16:38:41 +00:00
This commit is contained in:
parent
e96eaba256
commit
83488ad7cf
@ -58,6 +58,8 @@
|
||||
<?php echoUOJPageHeader(UOJLocale::get('groups')) ?>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-9">
|
||||
<div class="d-flex justify-content-between">
|
||||
<?php endif ?>
|
||||
<h1 class="h2">
|
||||
@ -117,4 +119,16 @@ EOD;
|
||||
);
|
||||
?>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
</div>
|
||||
|
||||
<aside class="col">
|
||||
<?php
|
||||
uojIncludeView('sidebar', array());
|
||||
?>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php echoUOJPageFooter() ?>
|
||||
|
@ -71,8 +71,9 @@
|
||||
|
||||
<?php echoUOJPageHeader(UOJLocale::get('problems lists')) ?>
|
||||
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-9">
|
||||
<div class="d-flex justify-content-between">
|
||||
<?php endif ?>
|
||||
<h1 class="h2">
|
||||
@ -147,4 +148,16 @@ EOD;
|
||||
);
|
||||
?>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
</div>
|
||||
|
||||
<aside class="col">
|
||||
<?php
|
||||
uojIncludeView('sidebar', array());
|
||||
?>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php echoUOJPageFooter() ?>
|
||||
|
@ -160,6 +160,8 @@ EOD;
|
||||
<?php echoUOJPageHeader(UOJLocale::get('problems')) ?>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-9">
|
||||
<div class="d-flex justify-content-between">
|
||||
<?php endif ?>
|
||||
<h1 class="h2">
|
||||
@ -173,13 +175,17 @@ EOD;
|
||||
<?php $new_problem_form->printHTML(); ?>
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<div class="top-buffer-sm"></div>
|
||||
<?php endif ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<?= HTML::tablist($tabs_info, $cur_tab, 'nav-pills') ?>
|
||||
@ -237,7 +243,7 @@ EOD;
|
||||
<?php echo $pag->pagination(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="top-buffer-sm"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#input-show_tags_mode').click(function() {
|
||||
if (this.checked) {
|
||||
@ -274,4 +280,17 @@ $('#input-show_submit_mode').click(function() {
|
||||
</table>
|
||||
</div>
|
||||
<?= $pag->pagination() ?>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
</div>
|
||||
|
||||
<aside class="col">
|
||||
<?php
|
||||
uojIncludeView('sidebar', array());
|
||||
?>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php echoUOJPageFooter() ?>
|
||||
|
@ -29,5 +29,8 @@ return [
|
||||
'contest registrants' => 'Registrants',
|
||||
'problem self review' => 'Problem self review',
|
||||
'contest self review' => 'Contest self review',
|
||||
'contest self reviews' => 'Contest self reviews'
|
||||
'contest self reviews' => 'Contest self reviews',
|
||||
'will start in x days' => function($x) {
|
||||
return "Will start in $x ".($x > 1 ? "days" : "day");
|
||||
},
|
||||
];
|
||||
|
@ -29,5 +29,8 @@ return [
|
||||
'contest registrants' => '报名选手列表',
|
||||
'problem self review' => '题目总结',
|
||||
'contest self review' => '比赛总结',
|
||||
'contest self reviews' => '赛后总结'
|
||||
'contest self reviews' => '赛后总结',
|
||||
'will start in x days' => function($x) {
|
||||
return "将在 $x 天后开始";
|
||||
},
|
||||
];
|
||||
|
@ -81,7 +81,11 @@ class Paginator {
|
||||
if ($this->n_pages == 1) {
|
||||
return '';
|
||||
}
|
||||
$html = '<ul class="pagination top-buffer-no bot-buffer-sm justify-content-center">';
|
||||
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||
$html = '<ul class="pagination my-0 justify-content-center">';
|
||||
} else {
|
||||
$html = '<ul class="pagination top-buffer-no bot-buffer-sm justify-content-center">';
|
||||
}
|
||||
if ($this->cur_page > 1) {
|
||||
$html .= '<li class="page-item">'
|
||||
. '<a class="page-link" href="'.$this->getPageUri(1).'">';
|
||||
|
82
web/app/views/sidebar.php
Normal file
82
web/app/views/sidebar.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php if (!isset($group_announcements_hidden) && Auth::check()): ?>
|
||||
<?php $groups = queryGroupsOfUser(Auth::id()); ?>
|
||||
<?php if (count($groups)): ?>
|
||||
<div class="card card-default mb-2" id="group-user-announcements">
|
||||
<div class="card-header fw-bold bg-transparent">
|
||||
小组公告
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<?php foreach ($groups as $group): ?>
|
||||
<?php
|
||||
$group_detail = DB::selectFirst("select * from groups where id = {$group['id']}");
|
||||
$group_announcement = $group_detail['announcement'];
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<a class="fw-bold text-decoration-none" href="<?= HTML::url('/group/'.$group['id']) ?>">
|
||||
<?= $group['title'] ?>
|
||||
</a>
|
||||
<?php if ($group_announcement): ?>
|
||||
<div id="announcement-content-<?= $group['id'] ?>"></div>
|
||||
<script>(function(){
|
||||
$('#announcement-content-<?= $group['id'] ?>')
|
||||
.html(DOMPurify.sanitize(decodeURIComponent("<?= urlencode($group_announcement) ?>"), <?= DOM_SANITIZE_CONFIG ?>));
|
||||
})();</script>
|
||||
<?php else: ?>
|
||||
<div>(暂无公告)</div>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (!isset($upcoming_contests_hidden)): ?>
|
||||
<?php
|
||||
$upcoming_contests = DB::selectAll("SELECT * FROM contests WHERE status = 'unfinished' ORDER BY start_time ASC, id ASC LIMIT 7");
|
||||
?>
|
||||
<div class="card card-default mb-2" id="group-user-announcements">
|
||||
<div class="card-header fw-bold bg-transparent">
|
||||
近期比赛
|
||||
</div>
|
||||
<?php $count = 0; ?>
|
||||
<ul class="list-group list-group-flush">
|
||||
<?php foreach ($upcoming_contests as $contest): ?>
|
||||
<?php genMoreContestInfo($contest) ?>
|
||||
<?php if ($contest['cur_progress'] == CONTEST_NOT_STARTED || $contest['cur_progress'] == CONTEST_IN_PROGRESS): ?>
|
||||
<?php $count++; ?>
|
||||
<li class="list-group-item text-center">
|
||||
<a class="fw-bold text-decoration-none" href="<?= HTML::url('/contest/'.$contest['id']) ?>">
|
||||
<?= $contest['name'] ?>
|
||||
</a>
|
||||
<div class="small">
|
||||
<?php if ($contest['cur_progress'] == CONTEST_IN_PROGRESS): ?>
|
||||
<?= UOJLocale::get('contests::in progress') ?>
|
||||
<?php else: ?>
|
||||
<?php
|
||||
$rest_seconds = $contest['start_time']->getTimestamp() - UOJTime::$time_now->getTimestamp();
|
||||
?>
|
||||
<?php if ($rest_seconds > 86400): ?>
|
||||
<?= UOJLocale::get('contests::will start in x days', floor($rest_seconds / 86400)) ?>
|
||||
<?php else: ?>
|
||||
<div id="contest-<?= $contest['id'] ?>-countdown"></div>
|
||||
<script>$('#contest-<?= $contest['id'] ?>-countdown').countdown(<?= $rest_seconds ?>, function(){}, 'inherit', false);</script>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
<?php if ($count == 0): ?>
|
||||
<li class="list-group-item text-center">
|
||||
<?= UOJLocale::get('none') ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
</ul>
|
||||
<div class="card-footer bg-transparent text-center small">
|
||||
<a class="text-decoration-none" href="<?= HTML::url('/contests?all=true') ?>">
|
||||
<?= UOJLocale::get('view all') ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
@ -322,7 +322,7 @@ $.fn.click_zan_block = function() {
|
||||
}
|
||||
|
||||
// count down
|
||||
function getCountdownStr(t) {
|
||||
function getCountdownStr(t, font_size, color = true) {
|
||||
var x = Math.floor(t);
|
||||
var ss = toFilledStr(x % 60, '0', 2);
|
||||
x = Math.floor(x / 60);
|
||||
@ -330,17 +330,23 @@ function getCountdownStr(t) {
|
||||
x = Math.floor(x / 60);
|
||||
var hh = x.toString();
|
||||
|
||||
var res = '<span style="font-size:30px">';
|
||||
res += '<span style="color:' + getColOfScore(Math.min(t / 10800 * 100, 100)) + '">' + hh + '</span>';
|
||||
var res = '<span style="font-size:' + font_size + '">';
|
||||
res += '<span '
|
||||
if (color) res += ' style="color:' + getColOfScore(Math.min(t / 10800 * 100, 100)) + '" ';
|
||||
res += ' >' + hh + '</span>';
|
||||
res += ':';
|
||||
res += '<span style="color:' + getColOfScore(mm / 60 * 100) + '">' + mm + '</span>';
|
||||
res += '<span '
|
||||
if (color) res += ' style="color:' + getColOfScore(mm / 60 * 100) + '" ';
|
||||
res += ' >' + mm + '</span>';
|
||||
res += ':';
|
||||
res += '<span style="color:' + getColOfScore(ss / 60 * 100) + '">' + ss + '</span>';
|
||||
res += '<span ';
|
||||
if (color) res += ' style="color:' + getColOfScore(ss / 60 * 100) + '" ';
|
||||
res +=' >' + ss + '</span>';
|
||||
res += '</span>'
|
||||
return res;
|
||||
}
|
||||
|
||||
$.fn.countdown = function(rest, callback) {
|
||||
$.fn.countdown = function(rest, callback, font_size = '30px', color = true) {
|
||||
return this.each(function() {
|
||||
var start = new Date().getTime();
|
||||
var cur_rest = rest != undefined ? rest : parseInt($(this).data('rest'));
|
||||
@ -348,12 +354,12 @@ $.fn.countdown = function(rest, callback) {
|
||||
var countdown = function() {
|
||||
var passed = Math.floor((new Date().getTime() - start) / 1000);
|
||||
if (passed >= cur_rest) {
|
||||
$(cur).html(getCountdownStr(0));
|
||||
$(cur).html(getCountdownStr(0, font_size, color));
|
||||
if (callback != undefined) {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
$(cur).html(getCountdownStr(cur_rest - passed));
|
||||
$(cur).html(getCountdownStr(cur_rest - passed, font_size, color));
|
||||
setTimeout(countdown, 1000);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user