S2OJ/web/app/controllers/announcements.php

52 lines
1.3 KiB
PHP
Raw Normal View History

2016-07-18 16:39:37 +00:00
<?php
2022-03-17 04:00:03 +00:00
if (!Auth::check()) {
2022-04-02 10:01:26 +00:00
become403Page(UOJLocale::get('need login'));
2022-03-17 04:00:03 +00:00
}
2022-04-03 10:18:17 +00:00
if (!isNormalUser($myUser)) {
become403Page();
}
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 = [
'table_classes' => ['table', 'table-hover'],
2022-09-18 13:06:18 +00:00
'page_len' => 40
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')) ?>
<h3>公告</h3>
<?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); ?>
<?php echoUOJPageFooter() ?>