عذراً

هذه الصفحة مخصصة للمشرف العام فقط.

العودة للرئيسية
prepare('INSERT INTO global_cycles (cycle_name, start_date, end_date) VALUES (?, ?, ?)'); $stmt->execute([$cycleName, $startDate, $endDate]); set_flash('success', 'تم إضافة الدورة بنجاح.'); header('Location: global_cycles.php'); exit; } catch (Throwable $e) { $errors['form'] = 'حدث خطأ أثناء حفظ الدورة.'; } } } elseif ($action === 'toggle') { $cycleId = filter_input(INPUT_POST, 'cycle_id', FILTER_VALIDATE_INT); if ($cycleId) { try { $stmt = db()->prepare('UPDATE global_cycles SET is_active = NOT is_active WHERE id = ?'); $stmt->execute([$cycleId]); set_flash('success', 'تم تغيير حالة الدورة.'); } catch (Throwable $e) { set_flash('error', 'حدث خطأ.'); } } header('Location: global_cycles.php'); exit; } elseif ($action === 'delete') { $cycleId = filter_input(INPUT_POST, 'cycle_id', FILTER_VALIDATE_INT); if ($cycleId) { try { $stmt = db()->prepare('DELETE FROM global_cycles WHERE id = ?'); $stmt->execute([$cycleId]); set_flash('success', 'تم حذف الدورة بنجاح.'); } catch (Throwable $e) { set_flash('error', 'لا يمكن حذف الدورة، ربما تكون مرتبطة بطلبات أخرى.'); } } header('Location: global_cycles.php'); exit; } elseif ($action === 'edit') { $cycleId = filter_input(INPUT_POST, 'cycle_id', FILTER_VALIDATE_INT); $cycleName = clean_text($_POST['cycle_name'] ?? ''); $startDate = $_POST['start_date'] ?? ''; $endDate = $_POST['end_date'] ?? ''; if ($cycleId && $cycleName && $startDate && $endDate) { try { $stmt = db()->prepare('UPDATE global_cycles SET cycle_name = ?, start_date = ?, end_date = ? WHERE id = ?'); $stmt->execute([$cycleName, $startDate, $endDate, $cycleId]); set_flash('success', 'تم تعديل الدورة بنجاح.'); } catch (Throwable $e) { set_flash('error', 'حدث خطأ أثناء التعديل.'); } } header('Location: global_cycles.php'); exit; } } // Fetch cycles $search = clean_text($_GET['search'] ?? '', 255); $page = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT) ?: 1; $limit = 10; $offset = ($page - 1) * $limit; $cycles = []; $totalItems = 0; try { $query = 'SELECT * FROM global_cycles'; $countQuery = 'SELECT COUNT(*) FROM global_cycles'; $params = []; if ($search !== '') { $where = ' WHERE cycle_name LIKE ?'; $query .= $where; $countQuery .= $where; $params[] = "%$search%"; } $stmtCount = db()->prepare($countQuery); $stmtCount->execute($params); $totalItems = (int)$stmtCount->fetchColumn(); $query .= ' ORDER BY start_date DESC LIMIT ' . $limit . ' OFFSET ' . $offset; $stmt = db()->prepare($query); $stmt->execute($params); $cycles = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch (Throwable $e) {} render_page_start('إدارة الدورات الموسمية', 'cycles', 'إضافة وإدارة الدورات التي تتقدم لها المراكز.'); render_flash($flash); ?>

الدورات الموسمية

يمكنك هنا تعريف الدورات الجديدة ليتاح للمراكز التقديم عليها.

اسم الدورة الفترة الزمنية الحالة الإجراءات
لا توجد دورات مسجلة حالياً.
من: إلى: متاحة للتقديم مغلقة