87 lines
4.9 KiB
PHP
87 lines
4.9 KiB
PHP
<?php
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
require_once __DIR__ . '/config.php';
|
|
checkAdmin();
|
|
|
|
$message = '';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
if (isset($_POST['topbar_text']) && isset($_POST['footer_text'])) {
|
|
$topbar = trim($_POST['topbar_text']);
|
|
$footer = trim($_POST['footer_text']);
|
|
|
|
$success1 = setSystemSetting('topbar_text', $topbar);
|
|
$success2 = setSystemSetting('footer_text', $footer);
|
|
|
|
if ($success1 && $success2) {
|
|
$message = '<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-6">บันทึกการตั้งค่าสำเร็จ</div>';
|
|
// Add system log
|
|
addSystemLog('UPDATE_SETTINGS', 'อัปเดตการตั้งค่าทั่วไป (Topbar / Footer)');
|
|
} else {
|
|
$message = '<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-6">เกิดข้อผิดพลาดในการบันทึกการตั้งค่า</div>';
|
|
}
|
|
}
|
|
}
|
|
|
|
$topbar_text = getSystemSetting('topbar_text', 'ระบบตรวจสอบข้อมูล HOSxP');
|
|
$footer_text = getSystemSetting('footer_text', 'หน่วยงานสุขภาพดิจิทัล โรงพยาบาลเกาะสมุย');
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="th">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>ตั้งค่าทั่วไป - <?php echo htmlspecialchars($topbar_text); ?></title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<link href="https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="icon" href="assets/img/logo.png" type="image/png">
|
|
<style>
|
|
body { font-family: 'Sarabun', sans-serif; display: flex; flex-direction: column; min-height: 100vh; }
|
|
.main-content { flex: 1; }
|
|
</style>
|
|
</head>
|
|
<body class="bg-gray-50">
|
|
|
|
<?php include 'topbar.php'; ?>
|
|
|
|
<div class="main-content max-w-7xl mx-auto py-10 px-4 sm:px-6 lg:px-8 w-full">
|
|
<div class="flex items-center mb-6">
|
|
<a href="settings.php" class="text-gray-500 hover:text-gray-900 mr-3">
|
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg>
|
|
</a>
|
|
<h2 class="text-2xl font-bold text-gray-900">ตั้งค่าทั่วไป (General Settings)</h2>
|
|
</div>
|
|
|
|
<?php echo $message; ?>
|
|
|
|
<div class="bg-white shadow rounded-lg p-6 max-w-3xl">
|
|
<form method="POST" action="">
|
|
<div class="mb-6">
|
|
<label for="topbar_text" class="block text-sm font-medium text-gray-700 mb-2">ข้อความแถบเมนูด้านบน (Topbar)</label>
|
|
<input type="text" name="topbar_text" id="topbar_text" required value="<?php echo htmlspecialchars($topbar_text); ?>"
|
|
class="block w-full border border-gray-300 rounded-md py-2 px-3 focus:outline-none focus:ring-green-500 focus:border-green-500 sm:text-sm">
|
|
<p class="mt-1 text-sm text-gray-500">ข้อความนี้จะแสดงอยู่ข้างๆ โลโก้ในแถบเมนูสีเขียวด้านบนของทุกหน้า</p>
|
|
</div>
|
|
|
|
<div class="mb-8">
|
|
<label for="footer_text" class="block text-sm font-medium text-gray-700 mb-2">ข้อความลิขสิทธิ์ด้านล่างสุด (Footer)</label>
|
|
<input type="text" name="footer_text" id="footer_text" required value="<?php echo htmlspecialchars($footer_text); ?>"
|
|
class="block w-full border border-gray-300 rounded-md py-2 px-3 focus:outline-none focus:ring-green-500 focus:border-green-500 sm:text-sm">
|
|
<p class="mt-1 text-sm text-gray-500">ข้อความนี้จะแสดงอยู่ส่วนท้ายสุดของเว็บ โดยมีคำว่า © ตามด้วยปีปัจจุบันนำหน้า</p>
|
|
</div>
|
|
|
|
<div class="flex items-center justify-end">
|
|
<button type="submit" class="bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-6 rounded focus:outline-none focus:shadow-outline transition duration-150">
|
|
บันทึกการตั้งค่า
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include 'footer.php'; ?>
|
|
|
|
</body>
|
|
</html>
|