S2OJ/web/app/controllers/announcements.php

74 lines
1.7 KiB
PHP
Raw Normal View History

2016-07-18 16:39:37 +00:00
<?php
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
redirectToLogin();
2022-03-17 04:00:03 +00:00
}
if (!isNormalUser($myUser) && UOJConfig::$data['switch']['force-login']) {
2022-04-03 10:18:17 +00:00
become403Page();
}
2022-10-22 13:12:13 +00:00
requireLib('bootstrap5');
2016-07-18 16:39:37 +00:00
requirePHPLib('form');
function echoBlogCell($blog) {
$level = $blog['level'];
switch ($level) {
case 0:
$level_str = '';
break;
case 1:
$level_str = '<span style="color:red">[三级置顶]</span> ';
break;
case 2:
$level_str = '<span style="color:red">[二级置顶]</span> ';
break;
case 3:
$level_str = '<span style="color:red">[一级置顶]</span> ';
break;
}
echo '<tr>';
echo '<td>' . $level_str . getBlogLink($blog['id']) . '</td>';
echo '<td>' . getUserLink($blog['poster']) . '</td>';
echo '<td>' . $blog['post_time'] . '</td>';
echo '</tr>';
}
$header = <<<EOD
<tr>
<th width="60%">标题</th>
<th width="20%">发表者</th>
<th width="20%">发表日期</th>
</tr>
EOD;
$config = [
2022-10-22 13:12:13 +00:00
'page_len' => 40,
'div_classes' => ['card', 'my-3'],
'table_classes' => ['table', 'uoj-table', 'mb-0'],
2016-07-18 16:39:37 +00:00
];
2022-09-18 04:58:35 +00:00
?>
2016-07-18 16:39:37 +00:00
<?php echoUOJPageHeader(UOJLocale::get('announcements')) ?>
2022-10-07 10:24:11 +00:00
<div class="row">
<!-- left col -->
<div class="col-lg-9">
<h1 class="h2">
<?= UOJLocale::get('announcements') ?>
</h1>
2016-07-18 16:39:37 +00:00
<?php echoLongTable(array('blogs.id', 'poster', 'title', 'post_time', 'zan', 'level'), 'important_blogs, blogs', 'is_hidden = 0 and important_blogs.blog_id = blogs.id', 'order by level desc, important_blogs.blog_id desc', $header, 'echoBlogCell', $config); ?>
2022-10-07 10:24:11 +00:00
</div>
<!-- end left col -->
<!-- right col -->
2022-10-19 03:57:06 +00:00
<aside class="col-lg-3 mt-3 mt-lg-0">
2022-10-07 10:24:11 +00:00
<?php uojIncludeView('sidebar', array()) ?>
</aside>
<!-- end right col -->
</div>
2016-07-18 16:39:37 +00:00
<?php echoUOJPageFooter() ?>