From 510602945b8648fa5bbbfd54d55c8e1cfd272fdb Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Thu, 9 Apr 2026 17:56:09 +0000 Subject: [PATCH] Autosave: 20260409-175609 --- admin.php | 35 +++-- admin_categories.php | 21 +-- admin_documents.php | 57 ++++---- admin_subcategories.php | 30 ++-- admin_types.php | 21 +-- assets/css/custom.css | 101 ++++++++++++- document.php | 186 +++++++++++++++++------- includes/admin_layout.php | 10 +- includes/layout.php | 2 +- includes/library.php | 183 ++++++++++++++++++++--- index.php | 295 ++++++++++++++++++++++++++------------ 11 files changed, 702 insertions(+), 239 deletions(-) diff --git a/admin.php b/admin.php index 97630a9..f4ef93f 100644 --- a/admin.php +++ b/admin.php @@ -7,6 +7,7 @@ library_bootstrap(); $documents = library_fetch_documents(false, []); $metrics = library_catalog_metrics(); +$lang = library_get_language(); admin_render_header(library_trans('dashboard'), 'dashboard'); ?> @@ -18,7 +19,7 @@ admin_render_header(library_trans('dashboard'), 'dashboard');
-

+

@@ -29,7 +30,7 @@ admin_render_header(library_trans('dashboard'), 'dashboard');
-

+

@@ -38,10 +39,10 @@ admin_render_header(library_trans('dashboard'), 'dashboard');
-
+
-

- +

+
@@ -67,28 +68,34 @@ admin_render_header(library_trans('dashboard'), 'dashboard'); - No documents found. + + -
-
+
- -
+ +
+ + + + + - - - - + diff --git a/admin_categories.php b/admin_categories.php index e7cea46..45480cc 100644 --- a/admin_categories.php +++ b/admin_categories.php @@ -17,28 +17,28 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $nameEn = trim($_POST['name_en'] ?? ''); $nameAr = trim($_POST['name_ar'] ?? ''); if (!$nameEn || !$nameAr) { - throw new RuntimeException('Both English and Arabic names are required for Category.'); + throw new RuntimeException(library_trans('category_name_required')); } library_create_category($nameEn, $nameAr); - library_set_flash('success', 'Category created successfully.'); + library_set_flash('success', library_trans('category_created_success')); header('Location: /admin_categories.php'); exit; } elseif ($action === 'update_category') { $nameEn = trim($_POST['name_en'] ?? ''); $nameAr = trim($_POST['name_ar'] ?? ''); if (!$id || !$nameEn || !$nameAr) { - throw new RuntimeException('ID, English name, and Arabic name are required.'); + throw new RuntimeException(library_trans('category_update_required')); } library_update_category($id, $nameEn, $nameAr); - library_set_flash('success', 'Category updated successfully.'); + library_set_flash('success', library_trans('category_updated_success')); header('Location: /admin_categories.php'); exit; } elseif ($action === 'delete_category') { if (!$id) { - throw new RuntimeException('Invalid Category ID.'); + throw new RuntimeException(library_trans('invalid_category_id')); } library_delete_category($id); - library_set_flash('success', 'Category deleted successfully.'); + library_set_flash('success', library_trans('category_deleted_success')); header('Location: /admin_categories.php'); exit; } @@ -57,6 +57,7 @@ $result = library_get_categories_paginated($search, $limit, $offset); $categories = $result['data']; $totalCategories = $result['total']; $totalPages = (int)ceil($totalCategories / $limit); +$lang = library_get_language(); admin_render_header(library_trans('categories'), 'categories'); ?> @@ -108,8 +109,8 @@ admin_render_header(library_trans('categories'), 'categories'); -
- + +
@@ -164,7 +165,7 @@ admin_render_header(library_trans('categories'), 'categories');
-
diff --git a/admin_documents.php b/admin_documents.php index 214f122..322eba3 100644 --- a/admin_documents.php +++ b/admin_documents.php @@ -26,23 +26,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { try { if ($action === 'create_document') { library_create_document($_POST, $_FILES['document_file'] ?? [], $_FILES['cover_file'] ?? []); - library_set_flash('success', 'Document created successfully.'); + library_set_flash('success', library_trans('document_created_success')); header('Location: /admin_documents.php'); exit; } elseif ($action === 'update_document') { if (!$id) { - throw new RuntimeException('Invalid Document ID.'); + throw new RuntimeException(library_trans('invalid_document_id')); } library_update_document($id, $_POST, $_FILES['document_file'] ?? [], $_FILES['cover_file'] ?? []); - library_set_flash('success', 'Document updated successfully.'); + library_set_flash('success', library_trans('document_updated_success')); header('Location: /admin_documents.php'); exit; } elseif ($action === 'delete_document') { if (!$id) { - throw new RuntimeException('Invalid Document ID.'); + throw new RuntimeException(library_trans('invalid_document_id')); } library_delete_document($id); - library_set_flash('success', 'Document deleted successfully.'); + library_set_flash('success', library_trans('document_deleted_success')); header('Location: /admin_documents.php'); exit; } @@ -67,13 +67,14 @@ $totalPages = (int)ceil($totalDocuments / $limit); $categories = library_get_categories(); $allSubcategories = library_get_subcategories(null); $types = library_get_types(); +$lang = library_get_language(); admin_render_header(library_trans('material_entry'), 'documents'); ?>
-
Submission Error
+
- +
@@ -239,7 +245,8 @@ admin_render_header(library_trans('material_entry'), 'documents'); @@ -248,7 +255,8 @@ admin_render_header(library_trans('material_entry'), 'documents'); @@ -274,14 +282,14 @@ admin_render_header(library_trans('material_entry'), 'documents');
- +
- +
@@ -290,7 +298,7 @@ admin_render_header(library_trans('material_entry'), 'documents');
- Current Cover: +
@@ -311,8 +319,8 @@ admin_render_header(library_trans('material_entry'), 'documents');
@@ -347,6 +355,7 @@ admin_render_header(library_trans('material_entry'), 'documents');