misuzu/public-legacy/manage/changelog/index.php

35 lines
966 B
PHP
Raw Permalink Normal View History

2022-09-13 13:14:49 +00:00
<?php
namespace Misuzu;
use RuntimeException;
2022-09-13 13:14:49 +00:00
if(!$msz->getAuthInfo()->getPerms('global')->check(Perm::G_CL_CHANGES_MANAGE))
Template::throwError(403);
2022-09-13 13:14:49 +00:00
2023-07-15 02:05:49 +00:00
$changelog = $msz->getChangelog();
$usersCtx = $msz->getUsersContext();
$changelogPagination = new Pagination($changelog->countChanges(), 30);
2022-09-13 13:14:49 +00:00
if(!$changelogPagination->hasValidOffset())
Template::throwError(404);
2022-09-13 13:14:49 +00:00
$changeInfos = $changelog->getChanges(pagination: $changelogPagination);
2023-07-15 02:05:49 +00:00
$changes = [];
foreach($changeInfos as $changeInfo) {
$userInfo = $changeInfo->hasUserId() ? $usersCtx->getUserInfo($changeInfo->getUserId()) : null;
2023-07-15 02:05:49 +00:00
$changes[] = [
'change' => $changeInfo,
'tags' => $changelog->getTags(changeInfo: $changeInfo),
2023-07-15 02:05:49 +00:00
'user' => $userInfo,
'user_colour' => $usersCtx->getUserColour($userInfo),
2023-07-15 02:05:49 +00:00
];
}
2022-09-13 13:14:49 +00:00
Template::render('manage.changelog.changes', [
'changelog_changes' => $changes,
'changelog_pagination' => $changelogPagination,
]);