misuzu/public/manage/news/posts.php

27 lines
617 B
PHP
Raw Normal View History

2019-06-09 22:10:59 +00:00
<?php
namespace Misuzu;
use Misuzu\News\NewsPost;
2020-05-25 19:58:06 +00:00
use Misuzu\Users\User;
2019-06-09 22:10:59 +00:00
require_once '../../../misuzu.php';
2020-05-25 19:58:06 +00:00
if(!User::hasCurrent() || !perms_check_user(MSZ_PERMS_NEWS, User::getCurrent()->getId(), MSZ_PERM_NEWS_MANAGE_POSTS)) {
2019-06-09 22:10:59 +00:00
echo render_error(403);
return;
}
$postsPagination = new Pagination(NewsPost::countAll(false, true, true), 15);
2019-06-09 22:10:59 +00:00
if(!$postsPagination->hasValidOffset()) {
2019-06-09 22:10:59 +00:00
echo render_error(404);
return;
}
$posts = NewsPost::all($postsPagination, false, true, true);
2019-06-09 22:10:59 +00:00
Template::render('manage.news.posts', [
2019-06-09 22:10:59 +00:00
'news_posts' => $posts,
'posts_pagination' => $postsPagination,
]);