32 lines
904 B
PHP
32 lines
904 B
PHP
<?php
|
|
namespace Misuzu;
|
|
|
|
use Misuzu\Pagination;
|
|
|
|
if(!$msz->authInfo->getPerms('global')->check(Perm::G_LOGS_VIEW))
|
|
Template::throwError(403);
|
|
|
|
$pagination = new Pagination($msz->auditLog->countLogs(), 50);
|
|
|
|
if(!$pagination->hasValidOffset())
|
|
Template::throwError(404);
|
|
|
|
$logs = iterator_to_array($msz->auditLog->getLogs(pagination: $pagination));
|
|
$userInfos = [];
|
|
$userColours = [];
|
|
|
|
foreach($logs as $log)
|
|
if($log->userId !== null) {
|
|
$userId = $log->userId;
|
|
if(!array_key_exists($userId, $userInfos)) {
|
|
$userInfos[$userId] = $msz->usersCtx->getUserInfo($userId);
|
|
$userColours[$userId] = $msz->usersCtx->getUserColour($userId);
|
|
}
|
|
}
|
|
|
|
Template::render('manage.general.logs', [
|
|
'global_logs' => $logs,
|
|
'global_logs_pagination' => $pagination,
|
|
'global_logs_users' => $userInfos,
|
|
'global_logs_users_colours' => $userColours,
|
|
]);
|