S2OJ/web/app/controllers/group.php

154 lines
4.2 KiB
PHP
Raw Permalink Normal View History

2022-03-20 00:07:46 +00:00
<?php
2022-11-11 00:20:33 +00:00
requirePHPLib('form');
requirePHPLib('judger');
requirePHPLib('data');
2022-03-20 00:07:46 +00:00
2022-11-11 00:20:33 +00:00
Auth::check() || redirectToLogin();
UOJGroup::init(UOJRequest::get('id')) || UOJResponse::page404();
UOJGroup::cur()->userCanView(Auth::user(), ['ensure' => true]);
?>
2022-04-03 10:18:17 +00:00
2023-02-17 13:46:28 +00:00
<?php echoUOJPageHeader(UOJGroup::info('title') . ' - 小组') ?>
2022-03-20 00:07:46 +00:00
2022-09-26 04:09:54 +00:00
<div class="row">
2022-11-11 00:20:33 +00:00
<!-- left col -->
<div class="col-lg-9">
<!-- title -->
<div class="d-flex justify-content-between">
<h1>
<?= UOJGroup::info('title') ?>
<span class="fs-5">(ID: #<?= UOJGroup::info('id') ?>)</span>
<?php if (UOJGroup::info('is_hidden')) : ?>
<span class="badge text-bg-danger fs-6">
<i class="bi bi-eye-slash-fill"></i>
<?= UOJLocale::get('hidden') ?>
</span>
<?php endif ?>
</h1>
<?php if (UOJGroup::cur()->userCanManage(Auth::user())) : ?>
<div class="text-end">
<?=
UOJGroup::cur()->getLink([
'where' => '/manage',
'class' => 'btn btn-primary',
'text' => UOJLocale::get('problems::manage'),
]);
?>
</div>
<?php endif ?>
2022-10-21 12:42:48 +00:00
</div>
2022-11-11 00:20:33 +00:00
<!-- end title -->
<!-- main content -->
<div class="card mb-3">
<div class="card-body">
<h2 class="h3">
<?= UOJLocale::get('group announcement') ?>
</h2>
<?php if (UOJGroup::info('announcement')) : ?>
<div class="text-break">
2023-01-15 03:13:43 +00:00
<?= HTML::purifier_inline()->purify(HTML::parsedown(['username_with_color' => true])->line(UOJGroup::info('announcement'))) ?>
2022-11-11 00:20:33 +00:00
</div>
<?php else : ?>
<div class="text-muted">
<?= UOJLocale::get('none') ?>
</div>
<?php endif ?>
</div>
2022-10-21 12:42:48 +00:00
</div>
2022-09-20 00:28:38 +00:00
2022-11-11 00:20:33 +00:00
<div class="card mb-3">
<div class="card-body">
<h2 class="card-title h3">
<?= UOJLocale::get('news') ?>
</h2>
<ul class="mb-0">
2023-02-13 03:34:43 +00:00
<?php foreach (UOJGroup::cur()->getLatestGroupMatesAcceptedSubmissions(Auth::user()) as $submission) : ?>
<?php if ($submission->userCanView(Auth::user())) : ?>
<li>
<?= UOJUser::getLink($submission->info['submitter']) ?>
解决了问题
<?= $submission->problem->getLink(['with' => 'id']) ?>
(<time><?= $submission->info['submit_time'] ?></time>)
</li>
<?php endif ?>
2022-11-11 00:20:33 +00:00
<?php endforeach ?>
</ul>
</div>
</div>
2022-10-23 05:58:34 +00:00
2022-11-11 00:20:33 +00:00
<div class="card card-default mb-3">
<div class="card-body">
<h2 class="card-title h3">
<?= UOJLocale::get('assignments') ?>
</h2>
<?php
echoLongTable(
['*'],
[
"groups_assignments",
"left join lists",
"on", [
"lists.id" => DB::raw("groups_assignments.list_id"),
]
],
[
"groups_assignments.group_id" => UOJGroup::info('id'),
["groups_assignments.end_time", ">", DB::raw("addtime(now(), '-168:00:00')")]
],
'order by groups_assignments.end_time desc, groups_assignments.list_id desc',
<<<EOD
<tr>
<th style="width:3em" class="text-center">ID</th>
<th style="width:12em">标题</th>
<th style="width:4em">状态</th>
<th style="width:8em">结束时间</th>
</tr>
EOD,
function ($info) {
$assignment = new UOJGroupAssignment($info, UOJGroup::cur());
echo HTML::tag_begin('tr');
echo HTML::tag('td', ['class' => 'text-center'], $assignment->info['id']);
echo HTML::tag('td', [], $assignment->getLink());
if ($assignment->info['end_time'] < UOJTime::$time_now) {
echo HTML::tag('td', ['class' => 'text-danger'], '已结束');
} else {
echo HTML::tag('td', ['class' => 'text-success'], '进行中');
}
echo HTML::tag('td', [], $assignment->info['end_time_str']);
echo HTML::tag_end('tr');
},
[
'echo_full' => true,
'div_classes' => ['table-responsive'],
'table_classes' => ['table', 'align-middle', 'mb-0'],
],
);
?>
</div>
</div>
2022-03-20 00:07:46 +00:00
2023-01-17 05:58:07 +00:00
<div class="card mb-3">
<div class="card-header bg-transparent">
<h2 class="h3 mb-0"><?= UOJLocale::get('top solver') ?></h2>
2022-11-11 00:20:33 +00:00
</div>
2023-01-17 05:58:07 +00:00
<?php UOJRanklist::printHTML([
'page_len' => 15,
'group_id' => UOJGroup::info('id'),
'flush' => true,
]) ?>
2022-11-11 00:20:33 +00:00
</div>
<!-- end left col -->
2022-03-21 02:51:31 +00:00
</div>
2022-09-26 04:09:54 +00:00
2022-11-11 00:20:33 +00:00
<!-- right col -->
<aside class="col-lg-3 mt-3 mt-lg-0">
<?php uojIncludeView('sidebar') ?>
</aside>
2022-09-26 04:09:54 +00:00
</div>
2022-03-20 00:07:46 +00:00
<?php echoUOJPageFooter() ?>