34 lines
939 B
PHP
34 lines
939 B
PHP
<?php
|
|
namespace Misuzu;
|
|
|
|
use Misuzu\Pagination;
|
|
|
|
if(!$msz->getAuthInfo()->getPerms('global')->check(Perm::G_LOGS_VIEW))
|
|
Template::throwError(403);
|
|
|
|
$users = $msz->getUsers();
|
|
$auditLog = $msz->getAuditLog();
|
|
$pagination = new Pagination($auditLog->countLogs(), 50);
|
|
|
|
if(!$pagination->hasValidOffset())
|
|
Template::throwError(404);
|
|
|
|
$logs = $auditLog->getLogs(pagination: $pagination);
|
|
$userInfos = [];
|
|
$userColours = [];
|
|
|
|
foreach($logs as $log)
|
|
if($log->hasUserId()) {
|
|
$userId = $log->getUserId();
|
|
if(!array_key_exists($userId, $userInfos)) {
|
|
$userInfos[$userId] = $users->getUser($userId, 'id');
|
|
$userColours[$userId] = $users->getUserColour($userInfos[$userId]);
|
|
}
|
|
}
|
|
|
|
Template::render('manage.general.logs', [
|
|
'global_logs' => $logs,
|
|
'global_logs_pagination' => $pagination,
|
|
'global_logs_users' => $userInfos,
|
|
'global_logs_users_colours' => $userColours,
|
|
]);
|