update courses

This commit is contained in:
Flatlogic Bot 2026-04-08 06:49:57 +00:00
parent da6711e592
commit 77eb65f631
6 changed files with 81 additions and 3 deletions

View File

@ -142,6 +142,7 @@ $items = $stmt->fetchAll(PDO::FETCH_ASSOC);
<input type="hidden" name="action" value="reset_all_students">
<button type="submit" class="btn btn-outline-danger btn-sm"><?= h(t('Reset Batch', 'إعادة ضبط الدفعة')) ?></button>
</form>
<?php endif; ?>
<button type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#addCourseModal" style="background-color: var(--accent); border-color: var(--accent);">+ <?= h(t('Add Course', 'إضافة دورة')) ?></button>
</div>
</div>
@ -227,6 +228,7 @@ $items = $stmt->fetchAll(PDO::FETCH_ASSOC);
<svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/></svg>
</button>
<?php endif; ?>
<?php if (has_permission('courses', 'delete')): ?>
<form method="post" action="<?= h(app_url('admin.php', ['page'=>'courses', 'action'=>'delete', 'id'=>$row['id']])) ?>" class="d-inline" onsubmit="return confirm('<?= h(t('Are you sure?', 'هل أنت متأكد؟')) ?>');">
<button type="submit" class="btn btn-sm btn-outline-danger" title="<?= h(t('Delete', 'حذف')) ?>"><svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/><path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/></svg></button>
</form>

View File

@ -2,4 +2,4 @@
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
127.0.0.1 FALSE / FALSE 0 PHPSESSID 69opohn4d8347kh0d07rl59f2n
localhost FALSE / FALSE 0 PHPSESSID tf03tbhu7e9rjeotatir4nlali

71
courses.php Normal file
View File

@ -0,0 +1,71 @@
<?php
require_once __DIR__ . '/includes/app.php';
$courses = db()->query("SELECT * FROM courses WHERE status = 'active' ORDER BY created_at DESC")->fetchAll();
render_head(
t('Courses', 'الدورات'),
t('Browse our specialized short courses.', 'تصفح دوراتنا القصيرة المتخصصة.')
);
render_nav('courses.php');
?>
<main class="py-5 bg-light min-vh-100">
<div class="container">
<div class="section-header mb-5 text-center">
<span class="eyebrow"><?= h(t('All Courses', 'جميع الدورات')) ?></span>
<h1 class="section-title mb-2 fw-bold"><?= h(t('Accelerate Your Skills', 'سرّع تطوير مهاراتك')) ?></h1>
<p class="text-secondary mx-auto" style="max-width: 600px;"><?= h(t('Enroll in our specialized short courses designed to help you achieve your goals.', 'سجل في دوراتنا القصيرة المتخصصة المصممة لمساعدتك على تحقيق أهدافك.')) ?></p>
</div>
<?php if (empty($courses)): ?>
<div class="alert alert-info text-center py-4 rounded-3 shadow-sm border-0">
<?= h(t('No active courses found at the moment. Please check back later.', 'لم يتم العثور على دورات نشطة في الوقت الحالي. يرجى التحقق مرة أخرى لاحقاً.')) ?>
</div>
<?php else: ?>
<div class="row g-4">
<?php foreach ($courses as $course): ?>
<div class="col-lg-4 col-md-6">
<article class="card h-100 border-0 shadow-sm overflow-hidden" style="border-radius: 1rem; transition: transform 0.2s;">
<?php if (!empty($course['picture'])): ?>
<img src="<?= h($course['picture']) ?>" class="card-img-top" alt="<?= h(current_lang() === 'ar' ? $course['name_ar'] : $course['name_en']) ?>" style="height: 220px; object-fit: cover;">
<?php else: ?>
<div class="card-img-top bg-secondary d-flex align-items-center justify-content-center text-white" style="height: 220px;">
<i class="bi bi-play-btn fs-1"></i>
</div>
<?php endif; ?>
<div class="card-body d-flex flex-column p-4">
<div class="d-flex justify-content-between align-items-start mb-3">
<h3 class="h5 mb-0 fw-bold"><?= h(current_lang() === 'ar' ? $course['name_ar'] : $course['name_en']) ?></h3>
<span class="badge bg-primary bg-gradient text-white rounded-pill fs-6 px-3 py-2 shadow-sm"><?= h(format_price((float)$course['price'])) ?></span>
</div>
<p class="text-secondary mb-4 flex-grow-1" style="font-size: 0.95rem;"><?= h(current_lang() === 'ar' ? $course['description_ar'] : $course['description_en']) ?></p>
<div class="d-grid mt-auto">
<?php
$isFull = false;
$isClosed = !$course['registration_open'];
if ($course['max_students'] > 0) {
$enrolled = db()->query("SELECT COUNT(*) FROM course_students WHERE course_id = " . $course['id'])->fetchColumn();
if ($enrolled >= $course['max_students']) {
$isFull = true;
}
}
if ($isClosed || $isFull):
?>
<button class="btn btn-outline-secondary rounded-pill py-2" disabled>
<?= h(t('Registration Closed', 'التسجيل مغلق')) ?>
</button>
<?php else: ?>
<a href="<?= h(app_url('checkout.php', ['course_id' => $course['id']])) ?>" class="btn btn-dark rounded-pill py-2 shadow-sm fw-bold">
<?= h(t('Enroll Now', 'سجل الآن')) ?>
</a>
<?php endif; ?>
</div>
</div>
</article>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</main>
<?php render_footer(); ?>

View File

@ -35,7 +35,7 @@ render_nav('dashboard.php');
<p class="text-secondary mb-4"><?= h(t('Start with pricing, complete the checkout form, and your personalized classroom dashboard will appear here.', 'ابدأ بالتسعير وأكمل نموذج الدفع وستظهر هنا لوحة الفصول الشخصية الخاصة بك.')) ?></p>
<div class="d-flex justify-content-center flex-wrap gap-2">
<a class="btn btn-dark" href="<?= h(app_url('pricing.php')) ?>"><?= h(t('Choose a plan', 'اختر خطة')) ?></a>
<a class="btn btn-outline-dark" href="<?= h(app_url('index.php')) ?>"><?= h(t('Browse courses', 'تصفح الدورات')) ?></a>
<a class="btn btn-outline-dark" href="<?= h(app_url('courses.php')) ?>"><?= h(t('Browse courses', 'تصفح الدورات')) ?></a>
</div>
</div>
<?php else: ?>
@ -118,7 +118,7 @@ render_nav('dashboard.php');
<div class="summary-row"><span><?= h(t('WhatsApp reminders', 'تذكيرات واتساب')) ?></span><strong><?= h((int) $subscription['wablas_opt_in'] === 1 ? t('Enabled', 'مفعلة') : t('Off', 'متوقفة')) ?></strong></div>
<hr>
<div class="d-grid gap-2">
<a class="btn btn-dark" href="<?= h(app_url('index.php')) ?>"><?= h(t('Explore more courses', 'استكشف المزيد من الدورات')) ?></a>
<a class="btn btn-dark" href="<?= h(app_url('courses.php')) ?>"><?= h(t('Explore more courses', 'استكشف المزيد من الدورات')) ?></a>
<a class="btn btn-outline-dark" href="<?= h(app_url('teacher.php')) ?>"><?= h(t('Open teacher view', 'افتح عرض المعلم')) ?></a>
</div>
</aside>

View File

@ -624,6 +624,7 @@ function nav_items(): array
return [
'index.php' => t('Home', 'الرئيسية'),
'catalog.php' => t('Subjects', 'المواد'),
'courses.php' => t('Courses', 'الدورات'),
'pricing.php' => t('Plans', 'الخطط'),
'dashboard.php' => t('Student', 'الطالب'),
'teacher.php' => t('Teacher', 'المعلم'),
@ -704,6 +705,7 @@ function render_footer(): void
</div>
<div class="d-flex gap-3 flex-wrap">
<a class="text-decoration-none text-secondary" href="<?= h(app_url('catalog.php')) ?>"><?= h(t('Subject catalog', 'كتالوج المواد')) ?></a>
<a class="text-decoration-none text-secondary" href="<?= h(app_url('courses.php')) ?>"><?= h(t('Courses', 'الدورات')) ?></a>
<a class="text-decoration-none text-secondary" href="<?= h(app_url('pricing.php')) ?>"><?= h(t('Plans', 'الخطط')) ?></a>
<a class="text-decoration-none text-secondary" href="<?= h(app_url('dashboard.php')) ?>"><?= h(t('Student dashboard', 'لوحة الطالب')) ?></a>
</div>

View File

@ -102,6 +102,9 @@ $metrics = ['subjects' => count($subjects), 'teachers' => db()->query("SELECT CO
</article>
</div>
<?php endforeach; ?>
<div class="text-center mt-5">
<a class="btn btn-outline-dark rounded-pill px-4 shadow-sm fw-bold" href="<?= h(app_url('courses.php')) ?>"><?= h(t('View All Courses', 'عرض جميع الدورات')) ?></a>
</div>
</div>
</div>
</section>