0 ? get_application($applicationId) : null; $cycleValues = school_cycle_defaults($application ?: null); $cycleErrors = []; $cycleRollover = school_cycle_rollover_defaults(); if (!$application) { http_response_code(404); render_page_start('صفحة المركز غير موجودة', 'approved', 'تعذر العثور على المركز المطلوب لعرض صفحة الهبوط بعد الاعتماد.'); render_flash($flash); ?>
المركز غير موجود

تحقق من رقم الطلب أو ارجع إلى قائمة المراكز المعتمدة.

عرض المراكز المعتمدة
[], 'selected' => null, 'active' => null, 'read_only' => false]; $selectedCycle = null; $selectedCycleId = 0; $isCycleReadOnly = false; $cycleLabel = 'لا توجد دورة بعد'; if ($isApproved) { $cycleContext = resolve_school_cycle_context((int) $application['id'], $application, $requestedCycleId); $selectedCycle = $cycleContext['selected']; $selectedCycleId = $selectedCycle ? (int) ($selectedCycle['id'] ?? 0) : 0; $isCycleReadOnly = (bool) $cycleContext['read_only']; $cycleLabel = $selectedCycle ? (string) $selectedCycle['cycle_name'] : $cycleLabel; $cycleRollover = school_cycle_rollover_defaults($selectedCycle); } if ($_SERVER['REQUEST_METHOD'] === 'POST' && $isApproved) { $cycleAction = clean_text((string) ($_POST['cycle_action'] ?? ''), 30); if ($cycleAction === 'create_cycle') { [$cycleValues, $cycleErrors] = validate_school_cycle_input($_POST, $application); $cycleRollover = school_cycle_rollover_input((int) $application['id'], $_POST, $selectedCycle); $wantsRollover = !empty($cycleRollover['copy_teachers']) || !empty($cycleRollover['copy_assessments']) || !empty($cycleRollover['copy_students']); if ($wantsRollover && (int) $cycleRollover['source_cycle_id'] <= 0) { $cycleErrors['form'] = 'اختر دورة مصدر إذا كنت تريد نسخ الفريق أو التقييمات أو الطلاب إلى الدورة الجديدة.'; } if ($cycleErrors === []) { try { $cycleCreation = create_school_cycle((int) $application['id'], $cycleValues, $cycleRollover); $newCycleId = (int) ($cycleCreation['cycle_id'] ?? 0); $rolloverSummary = (array) ($cycleCreation['rollover'] ?? []); $flashMessage = 'تم إنشاء الدورة الموسمية الجديدة بنجاح. يمكنك الآن العمل داخل ' . e((string)($cycleValues['cycle_name'] ?? 'الدورة الجديدة')) . '.'; $rolloverParts = []; if (!empty($rolloverSummary['teachers'])) { $rolloverParts[] = 'ترحيل ' . (int) $rolloverSummary['teachers'] . ' من أعضاء الفريق'; } if (!empty($rolloverSummary['assessments'])) { $rolloverParts[] = 'نسخ ' . (int) $rolloverSummary['assessments'] . ' من بنود التقييم'; } if (!empty($rolloverSummary['students'])) { $rolloverParts[] = 'نقل ' . (int) $rolloverSummary['students'] . ' من الطلاب المستمرين'; } if ($rolloverParts !== []) { $sourceCycleName = (string) ($cycleCreation['source_cycle_name'] ?? 'الدورة السابقة'); $flashMessage .= ' تم أيضاً ' . implode('، ', $rolloverParts) . ' من ' . $sourceCycleName . '.'; } set_flash('success', $flashMessage); header('Location: ' . school_page_url('approved_school.php', (int) $application['id'], $newCycleId)); exit; } catch (PDOException $exception) { $duplicateCode = isset($exception->errorInfo[1]) && (int) $exception->errorInfo[1] === 1062; if ($duplicateCode) { $cycleErrors['year'] = 'هذه الدورة موجودة مسبقاً لهذا المركز. اختر موسماً أو سنة مختلفة.'; } else { $cycleErrors['form'] = 'تعذر إنشاء الدورة حالياً. يرجى المحاولة مرة أخرى.'; } } catch (InvalidArgumentException $exception) { $cycleErrors['form'] = 'تعذر ترحيل البيانات من الدورة المحددة. اختر دورة صحيحة ثم حاول مرة أخرى.'; } catch (Throwable $exception) { $cycleErrors['form'] = 'تعذر إنشاء الدورة حالياً. يرجى المحاولة مرة أخرى.'; } } } elseif ($cycleAction === 'archive_cycle') { $postedCycleId = (int) ($_POST['cycle_id'] ?? 0); $cycleToArchive = $postedCycleId > 0 ? get_school_cycle((int) $application['id'], $postedCycleId) : null; if (!$cycleToArchive) { $cycleErrors['form'] = 'تعذر العثور على الدورة المطلوب أرشفتها.'; } elseif ((string) $cycleToArchive['status'] === 'archived') { $cycleErrors['form'] = 'هذه الدورة مؤرشفة بالفعل.'; } else { archive_school_cycle((int) $application['id'], $postedCycleId); set_flash('success', 'تمت أرشفة الدورة ' . (string) $cycleToArchive['cycle_name'] . ' بنجاح. يمكنك فتح دورة جديدة متى شئت.'); header('Location: ' . school_page_url('approved_school.php', (int) $application['id'])); exit; } } $cycleContext = resolve_school_cycle_context((int) $application['id'], $application, $requestedCycleId); $selectedCycle = $cycleContext['selected']; $selectedCycleId = $selectedCycle ? (int) ($selectedCycle['id'] ?? 0) : 0; $isCycleReadOnly = (bool) $cycleContext['read_only']; $cycleLabel = $selectedCycle ? (string) $selectedCycle['cycle_name'] : $cycleLabel; if ($cycleAction !== 'create_cycle') { $cycleRollover = school_cycle_rollover_defaults($selectedCycle); } } $scoreValue = $application['evaluation_score'] !== null ? max(0, min(100, (int) $application['evaluation_score'])) : null; $durationDays = 0; $startTs = strtotime((string) $application['start_date']); $endTs = strtotime((string) $application['end_date']); if ($startTs !== false && $endTs !== false && $endTs >= $startTs) { $durationDays = (int) floor(($endTs - $startTs) / 86400) + 1; } $studentsUrl = school_page_url('students.php', (int) $application['id'], $selectedCycleId); $teachersUrl = school_page_url('teachers.php', (int) $application['id'], $selectedCycleId); $assessmentsUrl = school_page_url('assessments.php', (int) $application['id'], $selectedCycleId); $attendanceUrl = school_page_url('attendance.php', (int) $application['id'], $selectedCycleId); $assessmentScoresUrl = school_page_url('assessment_scores.php', (int) $application['id'], $selectedCycleId); $approvedSchoolUrl = school_page_url('approved_school.php', (int) $application['id'], $selectedCycleId); $centerSubjectsUrl = school_page_url('center_subjects.php', (int) $application['id'], $selectedCycleId); $studentCycleMetrics = $isApproved && $selectedCycleId > 0 ? school_student_metrics_by_cycle((int) $application['id'], $selectedCycleId) : ['total' => 0, 'active' => 0]; $teacherCycleMetrics = $isApproved && $selectedCycleId > 0 ? school_teacher_metrics_by_cycle((int) $application['id'], $selectedCycleId) : ['total' => 0, 'active' => 0]; $assessmentCycleMetrics = $isApproved && $selectedCycleId > 0 ? school_assessment_metrics_by_cycle((int) $application['id'], $selectedCycleId) : ['total' => 0, 'active' => 0, 'active_weight' => 0]; $attendanceCycleMetrics = $isApproved && $selectedCycleId > 0 ? school_attendance_metrics_by_cycle((int) $application['id'], $selectedCycleId) : ['total' => 0, 'today_count' => 0, 'latest_date' => '']; $pageTitle = $isApproved ? 'صفحة المركز المعتمد: ' . (string) $application['center_name'] . ($selectedCycle ? ' — ' . $cycleLabel : '') : 'صفحة المركز بعد الاعتماد'; $pageDescription = $isApproved ? 'صفحة تشغيلية للمركز المعتمد تعرض الجاهزية، الدورات الموسمية، والخطوات التالية بعد الموافقة.' : 'هذه الصفحة تصبح متاحة بعد اعتماد طلب المركز من المشرف العام.'; render_page_start($pageTitle, 'approved', $pageDescription, (string) ($application['favicon'] ?? '')); render_flash($flash); ?>
هذه الصفحة تُفتح بعد الاعتماد فقط

الحالة الحالية: • مرجع الطلب #
في انتظار الاعتماد

تم تجهيز صفحة الهبوط لهذا المركز، لكنها ستصبح الصفحة التشغيلية الرسمية فقط بعد تغيير الحالة إلى معتمد.

مركز معتمد وجاهز للانطلاق

• من إلى
المقاعد المتوقعة
مدة البرنامج
0 ? $durationDays : '—')) ?> يوم
مرجع التشغيل
#
درجة التقييم
الدورة الموسمية الحالية
الدورة المحددة
الفترة

حالة الدورة
الطلاب
الفريق
التقييمات
سجلات الغياب
هذه الدورة مؤرشفة حالياً، لذلك كل الصفحات المرتبطة بها أصبحت للقراءة فقط. يمكنك فتح دورة جديدة من النموذج المجاور.
نبذة المدرسة / المركز