Files
pongpon pitisuk 72701ad58c Initial import
2026-06-25 16:49:13 +07:00

82 lines
3.3 KiB
PHP

<?php
$page_title = 'ข้อมูลส่วนตัว';
require_once __DIR__ . '/../includes/functions.php';
requireLogin();
if (isStudent()) {
header('Location: ' . BASE_URL . '/index.php');
exit;
}
// Hardcoded admin has no DB record
if ($_SESSION['user_id'] === null) {
header('Location: ' . BASE_URL . '/index.php');
exit;
}
$user = getUser($_SESSION['user_id']);
if (!$user) {
echo '<div class="alert alert-danger">ไม่พบข้อมูลผู้ใช้</div>';
exit;
}
require_once __DIR__ . '/../includes/header.php';
?>
<div class="page-heading">
<div>
<h4><i class="bi bi-person-bounding-box"></i> ข้อมูลส่วนตัว</h4>
<div class="text-muted small">ดูรายละเอียดข้อมูลบัญชีผู้ใช้ของคุณ</div>
</div>
<a href="<?= BASE_URL ?>/index.php" class="btn btn-secondary btn-sm"><i class="bi bi-arrow-left"></i> กลับหน้าหลัก</a>
</div>
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header bg-primary text-white">
<h5 class="mb-0"><i class="bi bi-person-circle"></i> รายละเอียดผู้ใช้งาน</h5>
</div>
<div class="card-body">
<table class="table table-borderless table-striped">
<tr>
<th style="width: 200px;">รหัสบุคลากร:</th>
<td><?= htmlspecialchars($user['staff_code']) ?></td>
</tr>
<tr>
<th>ชื่อ-สกุล:</th>
<td><?= htmlspecialchars($user['name']) ?></td>
</tr>
<tr>
<th>อีเมล:</th>
<td><?= htmlspecialchars($user['email'] ?: '-') ?></td>
</tr>
<tr>
<th>บทบาทในระบบ:</th>
<td>
<span class="badge bg-<?= $user['role'] === 'admin' ? 'danger' : 'primary' ?>">
<?= $user['role'] === 'admin' ? 'ผู้ดูแลระบบ' : 'อาจารย์ที่ปรึกษา' ?>
</span>
</td>
</tr>
<tr>
<th>สาขาวิชาที่ดูแล:</th>
<td>
<?= htmlspecialchars($user['curriculum_name'] ?: 'ไม่ระบุ') ?>
<?php if ($user['curriculum_code']): ?>
(<?= htmlspecialchars($user['curriculum_code']) ?>)
<?php endif; ?>
</td>
</tr>
</table>
<hr>
<div class="d-flex justify-content-between">
<a href="profile_edit.php" class="btn btn-warning"><i class="bi bi-pencil-square"></i> แก้ไขข้อมูลส่วนตัว</a>
</div>
</div>
</div>
</div>
</div>
<?php require_once __DIR__ . '/../includes/footer.php'; ?>