Files
jongryangje/app/Views/admin/access/activity_log_detail.php
taekyoungc 7294c56c50 fix: 앱 타임존 Asia/Seoul 적용(시각 9시간 오차 수정) + 활동로그 IP 표시 제거
- appTimezone UTC → Asia/Seoul: date()가 KST로 기록되어 DB(KST)와 일치
- 활동 로그 목록/상세에서 IP 컬럼 제거

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 23:21:33 +09:00

69 lines
3.2 KiB
PHP

<?php
declare(strict_types=1);
/**
* @var object $row
* @var array<string,mixed> $before
* @var array<string,mixed> $after
* @var array<string,string> $tableLabels
* @var array<string,string> $actionLabels
*/
$act = (string) ($row->al_action ?? '');
$tbl = (string) ($row->al_table ?? '');
$who = trim((string) ($row->mb_name ?? '') . (($row->mb_id ?? '') !== '' ? ' (' . $row->mb_id . ')' : ''));
// 변경된 키 강조용: before/after 값이 다른 키
$allKeys = array_values(array_unique(array_merge(array_keys($before), array_keys($after))));
$fmt = static function ($v): string {
if (is_array($v)) {
return json_encode($v, JSON_UNESCAPED_UNICODE);
}
return (string) ($v ?? '');
};
?>
<section class="p-4">
<div class="flex items-center justify-between mb-3 no-print">
<a href="<?= base_url('admin/access/activity-logs') ?>" class="text-sm text-blue-700 hover:underline">&larr; 목록으로</a>
<button onclick="window.print()" class="border border-btn-print-border text-gray-600 px-3 py-1 rounded-sm text-sm hover:bg-gray-50">인쇄</button>
</div>
<table class="w-full data-table text-sm mb-5" style="max-width:680px;">
<tbody>
<tr><th class="text-left bg-gray-50 w-32">일시</th><td class="text-left pl-2"><?= esc((string) ($row->al_regdate ?? '')) ?></td></tr>
<tr><th class="text-left bg-gray-50">사용자</th><td class="text-left pl-2"><?= $who !== '' ? esc($who) : '시스템' ?></td></tr>
<tr><th class="text-left bg-gray-50">작업</th><td class="text-left pl-2"><?= esc($actionLabels[$act] ?? $act) ?></td></tr>
<tr><th class="text-left bg-gray-50">대상</th><td class="text-left pl-2"><?= esc($tableLabels[$tbl] ?? $tbl) ?> (<?= esc($tbl) ?>) · 번호 <?= (int) ($row->al_record_id ?? 0) ?></td></tr>
</tbody>
</table>
<h3 class="font-bold text-gray-700 mb-2">변경 내역 (전 → 후)</h3>
<?php if ($allKeys === []): ?>
<p class="text-gray-400 text-sm">상세 데이터가 없습니다.</p>
<?php else: ?>
<div class="border border-gray-300 rounded-lg overflow-auto">
<table class="w-full data-table text-sm">
<thead>
<tr>
<th class="text-left w-40">항목</th>
<th class="text-left">변경 전</th>
<th class="text-left">변경 후</th>
</tr>
</thead>
<tbody>
<?php foreach ($allKeys as $k): ?>
<?php
$b = array_key_exists($k, $before) ? $fmt($before[$k]) : null;
$a = array_key_exists($k, $after) ? $fmt($after[$k]) : null;
$changed = ($act === 'update') && ($b !== $a);
?>
<tr<?= $changed ? ' style="background:#fffbeb;"' : '' ?>>
<td class="text-left pl-2 font-semibold text-gray-700"><?= esc((string) $k) ?></td>
<td class="text-left pl-2 <?= $changed ? 'text-red-700' : 'text-gray-500' ?>"><?= $b === null ? '<span class="text-gray-300">—</span>' : esc($b) ?></td>
<td class="text-left pl-2 <?= $changed ? 'text-blue-700 font-semibold' : 'text-gray-700' ?>"><?= $a === null ? '<span class="text-gray-300">—</span>' : esc($a) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</section>