From 1fb5dec73fe1243acb4c6f35d14c215931611c3c Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Wed, 1 Apr 2026 00:51:46 +0000 Subject: [PATCH] Autosave: 20260401-005145 --- admin_ads.php | 106 +++++++++++++++++++++++++++++++++++++++ assets/css/custom.css | 52 +++++++++++++++++++ display.php | 113 +++++++++++++++++++++++++++++++----------- doctor.php | 14 +++--- queue_bootstrap.php | 2 +- 5 files changed, 252 insertions(+), 35 deletions(-) diff --git a/admin_ads.php b/admin_ads.php index 74fe86e..c920e56 100644 --- a/admin_ads.php +++ b/admin_ads.php @@ -15,6 +15,14 @@ $pdo->exec("CREATE TABLE IF NOT EXISTS hospital_ads ( created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )"); +$pdo->exec("CREATE TABLE IF NOT EXISTS hospital_news ( + id INT AUTO_INCREMENT PRIMARY KEY, + phrase VARCHAR(1000) NOT NULL, + is_active TINYINT(1) DEFAULT 1, + sort_order INT DEFAULT 0, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +)"); + // Handle Form Submissions $message = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { @@ -74,6 +82,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $stmt = $pdo->prepare("UPDATE hospital_ads SET is_active = NOT is_active WHERE id = ?"); $stmt->execute([$id]); $message = qh_t('Video status updated.', 'تم تحديث حالة الفيديو.'); + } elseif (isset($_POST['action']) && $_POST['action'] === 'add_news' && !empty($_POST['phrase'])) { + $phrase = trim($_POST['phrase']); + $stmt = $pdo->prepare("INSERT INTO hospital_news (phrase, is_active) VALUES (?, 1)"); + $stmt->execute([$phrase]); + $message = qh_t('Phrase added successfully.', 'تمت إضافة العبارة بنجاح.'); + } elseif (isset($_POST['action']) && $_POST['action'] === 'delete_news' && !empty($_POST['news_id'])) { + $id = (int) $_POST['news_id']; + $pdo->prepare("DELETE FROM hospital_news WHERE id = ?")->execute([$id]); + $message = qh_t('Phrase deleted successfully.', 'تم حذف العبارة بنجاح.'); + } elseif (isset($_POST['action']) && $_POST['action'] === 'toggle_news_status' && !empty($_POST['news_id'])) { + $id = (int) $_POST['news_id']; + $pdo->prepare("UPDATE hospital_news SET is_active = NOT is_active WHERE id = ?")->execute([$id]); + $message = qh_t('Phrase status updated.', 'تم تحديث حالة العبارة.'); } } @@ -81,6 +102,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $stmt = $pdo->query("SELECT * FROM hospital_ads ORDER BY sort_order ASC, id DESC"); $ads = $stmt->fetchAll(); +$stmt2 = $pdo->query("SELECT * FROM hospital_news ORDER BY sort_order ASC, id DESC"); +$newsPhrases = $stmt2->fetchAll(); + qh_page_start( 'admin_ads', qh_t('Manage Advertisements', 'إدارة الإعلانات'), @@ -191,6 +215,88 @@ qh_page_start( + +
+
+

+

+
+
+ +
+
+
+
+
+
+ +
+ + +
+
+ +
+
+
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+ + + +
+
+ + + +
+
+
+
+
+
diff --git a/assets/css/custom.css b/assets/css/custom.css index ed04ee7..0e3414a 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -1259,3 +1259,55 @@ html[dir="rtl"] .hospital-detail-list dd { size: 80mm auto; } } + +/* News Ticker */ +.news-ticker-container { + position: fixed; + bottom: 0; + left: 0; + width: 100%; + background-color: var(--accent-strong); + color: #fff; + padding: 0.75rem 0; + z-index: 1030; + overflow: hidden; + white-space: nowrap; + box-shadow: 0 -4px 12px rgba(0,0,0,0.1); +} + +.news-ticker-content { + display: inline-block; + white-space: nowrap; + animation: ticker-ltr 30s linear infinite; +} + +@keyframes ticker-ltr { + 0% { transform: translateX(-100%); } + 100% { transform: translateX(100vw); } +} + +.news-ticker-item { + display: inline-block; + padding: 0 1.5rem; + font-weight: 600; + font-size: 1.25rem; +} + +.news-ticker-item::after { + content: "✦"; + margin-left: 3rem; + opacity: 0.6; +} + +html[dir="rtl"] .news-ticker-item::after { + margin-left: 0; + margin-right: 3rem; +} + +.news-ticker-item:last-child::after { + display: none; +} + +body { + padding-bottom: 3.5rem; +} diff --git a/display.php b/display.php index 741e9df..9479f95 100644 --- a/display.php +++ b/display.php @@ -16,6 +16,16 @@ try { // Table might not exist yet, safe to ignore } +$activeNews = []; +try { + $stmt = db()->query("SELECT phrase FROM hospital_news WHERE is_active = 1 ORDER BY sort_order ASC, id DESC"); + if ($stmt) { + $activeNews = $stmt->fetchAll(PDO::FETCH_COLUMN); + } +} catch (Throwable $e) { + // Table might not exist yet +} + qh_page_start( 'display', qh_t('General display board', 'لوحة العرض العامة'), @@ -23,16 +33,35 @@ qh_page_start( ); ?>
+ +
+
+ + <?= qh_h(qh_hospital_name()) ?> + +
+ +
+ +
+

+ +
+ +
+
+
+
+ +
+
+
-

-
-
-
- +

@@ -70,28 +99,27 @@ qh_page_start(
-
+
-
-
- - - - - - - - - - - - - - - - - -
+
+
+ +
+
+
+
+
+ + +
+
+ + +
+
+
+
+
@@ -107,9 +135,23 @@ qh_page_start(
@@ -154,4 +200,15 @@ qh_page_start(
+ + +
+
+ + + +
+
+ + \ No newline at end of file diff --git a/doctor.php b/doctor.php index 3de9e3b..65f7432 100644 --- a/doctor.php +++ b/doctor.php @@ -85,16 +85,18 @@ qh_page_start( -
+ + - - - - - + + + + + +
diff --git a/queue_bootstrap.php b/queue_bootstrap.php index 7a7a0d0..3347a74 100644 --- a/queue_bootstrap.php +++ b/queue_bootstrap.php @@ -968,7 +968,7 @@ function qh_admin_handle_request(): void } $action = trim((string) ($_POST['action'] ?? '')); - if ($action === '' || in_array($action, ['add_video', 'delete_video', 'toggle_status'])) { + if ($action === '' || in_array($action, ['add_video', 'delete_video', 'toggle_status', 'add_news', 'delete_news', 'toggle_news_status'])) { return; }