2019-06-09 22:10:59 +00:00
|
|
|
<?php
|
2019-09-28 22:43:51 +00:00
|
|
|
namespace Misuzu;
|
|
|
|
|
2020-05-16 22:35:11 +00:00
|
|
|
use Misuzu\News\NewsCategory;
|
2020-05-25 19:58:06 +00:00
|
|
|
use Misuzu\Users\User;
|
2020-05-16 22:35:11 +00:00
|
|
|
|
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_CATEGORIES)) {
|
2019-06-09 22:10:59 +00:00
|
|
|
echo render_error(403);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-16 22:35:11 +00:00
|
|
|
$categoriesPagination = new Pagination(NewsCategory::countAll(true), 15);
|
2019-06-09 22:10:59 +00:00
|
|
|
|
2019-12-06 01:04:10 +00:00
|
|
|
if(!$categoriesPagination->hasValidOffset()) {
|
2019-06-09 22:10:59 +00:00
|
|
|
echo render_error(404);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-16 22:35:11 +00:00
|
|
|
$categories = NewsCategory::all($categoriesPagination, true);
|
2019-06-09 22:10:59 +00:00
|
|
|
|
2019-12-04 18:16:22 +00:00
|
|
|
Template::render('manage.news.categories', [
|
2019-06-09 22:10:59 +00:00
|
|
|
'news_categories' => $categories,
|
|
|
|
'categories_pagination' => $categoriesPagination,
|
|
|
|
]);
|