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( + +
= qh_h(qh_t('These phrases will scroll at the bottom of the display screen.', 'ستتحرك هذه العبارات في أسفل شاشة العرض.')) ?>
+| = qh_h(qh_t('Phrase', 'العبارة')) ?> | += qh_h(qh_t('Status', 'الحالة')) ?> | += qh_h(qh_t('Actions', 'الإجراءات')) ?> | +
|---|---|---|
| = qh_h(qh_t('No phrases added yet.', 'لم يتم إضافة عبارات بعد.')) ?> | +||
| + = qh_h($n['phrase']) ?> + | ++ + = qh_h(qh_t('Active', 'مفعل')) ?> + + = qh_h(qh_t('Inactive', 'غير مفعل')) ?> + + | +
+
+
+
+
+ |
+
| = qh_h(qh_t('Clinic', 'العيادة')) ?> | -= qh_h(qh_t('Vitals Wait', 'انتظار العلامات')) ?> | -= qh_h(qh_t('Doctor Wait', 'انتظار الطبيب')) ?> | -
|---|---|---|
| = qh_h(qh_name($row)) ?> | -= qh_h((string) $row['vitals_waiting']) ?> | -= qh_h((string) $row['doctor_waiting']) ?> | -