feat(web/user): display groups

This commit is contained in:
Baoshuo Ren 2022-10-20 10:51:56 +08:00
parent a5e12f5c59
commit 002827ef48
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
3 changed files with 28 additions and 2 deletions

View File

@ -1,5 +1,6 @@
<?php <?php
return [ return [
'belongs to these groups' => 'Belongs to these groups:',
'avatar source' => 'Avatar source', 'avatar source' => 'Avatar source',
'website' => 'Website', 'website' => 'Website',
'user type' => 'User type', 'user type' => 'User type',

View File

@ -1,5 +1,6 @@
<?php <?php
return [ return [
'belongs to these groups' => '属于这些小组:',
'avatar source' => '头像来源', 'avatar source' => '头像来源',
'website' => '网址', 'website' => '网址',
'user type' => '用户类型', 'user type' => '用户类型',

View File

@ -257,7 +257,31 @@ function fTime($time, $gran = -1) {
<?= UOJLocale::get('contests::contest self reviews') ?> <?= UOJLocale::get('contests::contest self reviews') ?>
</a> </a>
</nav> </nav>
<div class="card card-default mb-2">
<?php if (!isset($is_blog_aboutme)): ?>
<?php $groups = queryGroupsOfUser($user['username']) ?>
<div class="card mb-2">
<div class="card-body">
<h4 class="card-title h5">
<?= UOJLocale::get('user::belongs to these groups') ?>
</h4>
<ul class="mb-0">
<?php foreach ($groups as $group): ?>
<li>
<a class="text-decoration-none" href="<?= HTML::url('/group/'.$group['id']) ?>">
<?= $group['title'] ?>
</a>
</li>
<?php endforeach ?>
<?php if (!count($groups)): ?>
<?= UOJLocale::get('none') ?>
<?php endif ?>
</ul>
</div>
</div>
<?php endif ?>
<div class="card mb-2">
<div class="card-body"> <div class="card-body">
<?php <?php
$_result = DB::query("select date_format(submit_time, '%Y-%m-%d'), problem_id from submissions where submitter = '{$user['username']}' and score = 100 and date(submit_time) between date_sub(curdate(), interval 1 year) and curdate()"); $_result = DB::query("select date_format(submit_time, '%Y-%m-%d'), problem_id from submissions where submitter = '{$user['username']}' and score = 100 and date(submit_time) between date_sub(curdate(), interval 1 year) and curdate()");
@ -286,7 +310,7 @@ while ($row = DB::fetch($_result)) {
</script> </script>
</div> </div>
</div> </div>
<div class="card card-default 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 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") ?>
<h4 class="card-title h5"> <h4 class="card-title h5">