adding centers assessment
This commit is contained in:
parent
7fc46facca
commit
b80640c59c
@ -21,7 +21,7 @@
|
||||
--radius-sm: 10px;
|
||||
--radius-md: 14px;
|
||||
--radius-lg: 18px;
|
||||
--font-ui: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
|
||||
--font-ui: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
|
||||
}
|
||||
|
||||
* {
|
||||
@ -1662,8 +1662,11 @@ textarea.form-control {
|
||||
|
||||
html,
|
||||
body {
|
||||
width: 297mm;
|
||||
min-height: 210mm;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
width: auto !important;
|
||||
min-height: auto !important;
|
||||
height: auto !important;
|
||||
background: #fff !important;
|
||||
}
|
||||
|
||||
@ -1672,6 +1675,12 @@ textarea.form-control {
|
||||
print-color-adjust: exact;
|
||||
}
|
||||
|
||||
.app-shell,
|
||||
main {
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.site-header,
|
||||
.site-footer,
|
||||
.certificate-toolbar,
|
||||
@ -1704,9 +1713,9 @@ textarea.form-control {
|
||||
.completion-certificate-card {
|
||||
border: 2px solid rgba(180, 146, 42, 0.62);
|
||||
border-radius: 1rem;
|
||||
height: 190mm;
|
||||
min-height: 190mm;
|
||||
max-height: 190mm;
|
||||
height: 188mm;
|
||||
min-height: 188mm;
|
||||
max-height: 188mm;
|
||||
overflow: hidden;
|
||||
page-break-inside: avoid;
|
||||
break-inside: avoid-page;
|
||||
@ -1898,3 +1907,41 @@ textarea.form-control {
|
||||
}
|
||||
}
|
||||
|
||||
.completion-batch-page .certificate-toolbar {
|
||||
position: sticky;
|
||||
top: 1rem;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.batch-certificate-stack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.completion-batch-item {
|
||||
page-break-inside: avoid;
|
||||
break-inside: avoid-page;
|
||||
}
|
||||
|
||||
@media print {
|
||||
.completion-batch-page {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.batch-certificate-stack {
|
||||
gap: 0 !important;
|
||||
}
|
||||
|
||||
.completion-batch-item {
|
||||
margin: 0 !important;
|
||||
page-break-after: always;
|
||||
break-after: page;
|
||||
}
|
||||
|
||||
.completion-batch-item:last-child {
|
||||
page-break-after: auto;
|
||||
break-after: auto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1413,7 +1413,7 @@ function render_page_start(string $pageTitle, string $active = 'home', string $p
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700&display=swap" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.rtl.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="<?= e(asset_url('assets/css/custom.css')) ?>">
|
||||
</head>
|
||||
|
||||
@ -1984,10 +1984,8 @@ function school_student_certificate_summary(int $centerApplicationId, int $cycle
|
||||
]);
|
||||
$rows = $stmt->fetchAll();
|
||||
|
||||
$weightedScore = 0.0;
|
||||
$weightedTotal = 0.0;
|
||||
$plainPercentageSum = 0.0;
|
||||
$plainPercentageCount = 0;
|
||||
$subjectBuckets = [];
|
||||
$completedAssessments = 0;
|
||||
$scoreTotal = 0.0;
|
||||
$maxScoreTotal = 0.0;
|
||||
$latestAssessedOn = '';
|
||||
@ -2011,15 +2009,21 @@ function school_student_certificate_summary(int $centerApplicationId, int $cycle
|
||||
|
||||
$percentage = round(($score / $maxScore) * 100, 2);
|
||||
$weight = max(0.0, (float) ($row['weight_percentage'] ?? 0));
|
||||
if ($weight > 0) {
|
||||
$weightedScore += $percentage * $weight;
|
||||
$weightedTotal += $weight;
|
||||
}
|
||||
$plainPercentageSum += $percentage;
|
||||
$plainPercentageCount++;
|
||||
$completedAssessments++;
|
||||
$scoreTotal += $score;
|
||||
$maxScoreTotal += $maxScore;
|
||||
|
||||
$subjectId = (int) ($row['subject_id'] ?? 0);
|
||||
$subjectKey = $subjectId > 0 ? 'subject_' . $subjectId : 'assessment_' . (int) ($row['assessment_type_id'] ?? 0);
|
||||
if (!isset($subjectBuckets[$subjectKey])) {
|
||||
$subjectBuckets[$subjectKey] = [
|
||||
'score_total' => 0.0,
|
||||
'max_score_total' => 0.0,
|
||||
];
|
||||
}
|
||||
$subjectBuckets[$subjectKey]['score_total'] += $score;
|
||||
$subjectBuckets[$subjectKey]['max_score_total'] += $maxScore;
|
||||
|
||||
$assessedOn = (string) ($row['assessed_on'] ?? '');
|
||||
if ($assessedOn !== '' && ($latestAssessedOn === '' || strtotime($assessedOn) > strtotime($latestAssessedOn))) {
|
||||
$latestAssessedOn = $assessedOn;
|
||||
@ -2038,16 +2042,26 @@ function school_student_certificate_summary(int $centerApplicationId, int $cycle
|
||||
];
|
||||
}
|
||||
|
||||
$overallPercentage = 0.0;
|
||||
if ($weightedTotal > 0) {
|
||||
$overallPercentage = round($weightedScore / $weightedTotal, 2);
|
||||
} elseif ($plainPercentageCount > 0) {
|
||||
$overallPercentage = round($plainPercentageSum / $plainPercentageCount, 2);
|
||||
$subjectPercentageSum = 0.0;
|
||||
$subjectCount = 0;
|
||||
foreach ($subjectBuckets as $bucket) {
|
||||
$subjectMaxScore = (float) ($bucket['max_score_total'] ?? 0);
|
||||
if ($subjectMaxScore <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$subjectPercentage = ((float) ($bucket['score_total'] ?? 0) / $subjectMaxScore) * 100;
|
||||
$subjectPercentageSum += max(0.0, min(100.0, $subjectPercentage));
|
||||
$subjectCount++;
|
||||
}
|
||||
|
||||
$summary['completed_assessments'] = $plainPercentageCount;
|
||||
$overallPercentage = $subjectCount > 0
|
||||
? round($subjectPercentageSum / $subjectCount, 2)
|
||||
: 0.0;
|
||||
|
||||
$summary['completed_assessments'] = $completedAssessments;
|
||||
$summary['missing_assessments'] = max(0, $summary['active_assessments'] - $summary['completed_assessments'] - $summary['absent_assessments'] - $summary['excused_assessments']);
|
||||
$summary['has_results'] = $plainPercentageCount > 0;
|
||||
$summary['has_results'] = $completedAssessments > 0;
|
||||
$summary['overall_percentage'] = $overallPercentage;
|
||||
$summary['score_total'] = round($scoreTotal, 2);
|
||||
$summary['max_score_total'] = round($maxScoreTotal, 2);
|
||||
|
||||
299
student_completion_certificates.php
Normal file
299
student_completion_certificates.php
Normal file
@ -0,0 +1,299 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/includes/app.php';
|
||||
|
||||
function completion_certificate_date_label(string $date): string
|
||||
{
|
||||
if ($date === '' || strtotime($date) === false) {
|
||||
return date('Y/m/d');
|
||||
}
|
||||
|
||||
return date('Y/m/d', strtotime($date));
|
||||
}
|
||||
|
||||
function completion_certificate_decimal_value(float $value): string
|
||||
{
|
||||
return rtrim(rtrim(number_format($value, 2, '.', ''), '0'), '.');
|
||||
}
|
||||
|
||||
function completion_certificate_message_text(string $template, array $tokens, string $fallback): string
|
||||
{
|
||||
$message = trim($template);
|
||||
if ($message === '') {
|
||||
$message = $fallback;
|
||||
}
|
||||
|
||||
return strtr($message, $tokens);
|
||||
}
|
||||
|
||||
function completion_certificate_view_model(array $application, array $settings, int $cycleId, string $cycleLabel, int $studentId): ?array
|
||||
{
|
||||
$certificate = school_student_certificate_summary((int) $application['id'], $cycleId, $studentId);
|
||||
$student = is_array($certificate['student'] ?? null) ? $certificate['student'] : null;
|
||||
if ($student === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$performance = $certificate['performance'] ?? student_certificate_performance_meta(0.0);
|
||||
$hasResults = !empty($certificate['has_results']);
|
||||
$honor = $hasResults
|
||||
? student_completion_certificate_honor_meta((float) ($certificate['overall_percentage'] ?? 0))
|
||||
: [
|
||||
'key' => 'completion',
|
||||
'title' => 'Successful Completion',
|
||||
'title_ar' => 'إتمام ناجح',
|
||||
'completion_line_ar' => 'أتمّ/أتمّت الدورة بنجاح واستفاد/استفادت من محتواها العلمي.',
|
||||
];
|
||||
|
||||
$template = (string) ($settings['completion_certificate_template'] ?? 'modern');
|
||||
if (!in_array($template, ['modern', 'classic'], true)) {
|
||||
$template = 'modern';
|
||||
}
|
||||
|
||||
$centerName = trim((string) ($application['center_name'] ?? ''));
|
||||
if ($centerName === '') {
|
||||
$centerName = (string) ($settings['app_name'] ?? project_name());
|
||||
}
|
||||
|
||||
$centerLogo = trim((string) ($application['logo'] ?? ''));
|
||||
if ($centerLogo === '') {
|
||||
$centerLogo = trim((string) ($settings['app_logo'] ?? ''));
|
||||
}
|
||||
|
||||
$tagline = trim((string) ($settings['completion_certificate_tagline'] ?? ''));
|
||||
if ($tagline === '') {
|
||||
$tagline = 'شهادة إتمام وتكريم';
|
||||
}
|
||||
|
||||
$overallPercentage = (float) ($certificate['overall_percentage'] ?? 0);
|
||||
$percentageLabel = $hasResults ? completion_certificate_decimal_value($overallPercentage) . '%' : '—';
|
||||
$fallbackMessage = sprintf(
|
||||
'تشهد إدارة %s بأن الطالب/الطالبة %s قد أتمّ/أتمّت متطلبات %s %s.',
|
||||
$centerName,
|
||||
(string) ($student['full_name'] ?? 'الطالب/الطالبة'),
|
||||
$cycleLabel,
|
||||
$honor['title_ar']
|
||||
);
|
||||
|
||||
$bodyMessage = completion_certificate_message_text(
|
||||
(string) ($settings['completion_certificate_message'] ?? ''),
|
||||
[
|
||||
'{student}' => (string) ($student['full_name'] ?? ''),
|
||||
'{center}' => $centerName,
|
||||
'{cycle}' => $cycleLabel,
|
||||
'{performance}' => (string) ($performance['label_ar'] ?? 'مميز'),
|
||||
'{honor}' => (string) ($honor['title_ar'] ?? 'بنجاح'),
|
||||
'{percentage}' => $hasResults ? completion_certificate_decimal_value($overallPercentage) : '0',
|
||||
],
|
||||
$fallbackMessage
|
||||
);
|
||||
|
||||
return [
|
||||
'certificate' => $certificate,
|
||||
'student' => $student,
|
||||
'performance' => $performance,
|
||||
'has_results' => $hasResults,
|
||||
'honor' => $honor,
|
||||
'template' => $template,
|
||||
'center_name' => $centerName,
|
||||
'center_logo' => $centerLogo,
|
||||
'tagline' => $tagline,
|
||||
'percentage_label' => $percentageLabel,
|
||||
'body_message' => $bodyMessage,
|
||||
'issue_date_label' => completion_certificate_date_label((string) ($certificate['latest_assessed_on'] ?? '')),
|
||||
];
|
||||
}
|
||||
|
||||
$flash = consume_flash();
|
||||
$settings = get_app_settings();
|
||||
$applicationId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) ?: 0;
|
||||
$requestedCycleId = filter_input(INPUT_GET, 'cycle', FILTER_VALIDATE_INT) ?: 0;
|
||||
$autoprint = filter_input(INPUT_GET, 'autoprint', FILTER_VALIDATE_INT) ?: 0;
|
||||
$search = clean_text($_GET['search'] ?? '', 255);
|
||||
$filters = [
|
||||
'gender' => clean_text($_GET['gender'] ?? '', 50),
|
||||
'grade_level' => clean_text($_GET['grade_level'] ?? '', 50),
|
||||
'enrollment_status' => clean_text($_GET['enrollment_status'] ?? '', 50),
|
||||
];
|
||||
|
||||
$application = $applicationId > 0 ? get_application($applicationId) : null;
|
||||
$isApprovedSchool = $application && (string) $application['status'] === 'approved';
|
||||
$cycleContext = ['cycles' => [], 'selected' => null, 'active' => null, 'read_only' => false];
|
||||
$selectedCycle = null;
|
||||
$selectedCycleId = 0;
|
||||
$cycleLabel = 'الدورة الحالية';
|
||||
$certificateItems = [];
|
||||
|
||||
if ($application && $isApprovedSchool) {
|
||||
$cycleContext = resolve_school_cycle_context((int) $application['id'], $application, $requestedCycleId);
|
||||
$selectedCycle = $cycleContext['selected'];
|
||||
$selectedCycleId = $selectedCycle ? (int) ($selectedCycle['id'] ?? 0) : 0;
|
||||
$cycleLabel = $selectedCycle ? (string) ($selectedCycle['cycle_name'] ?? 'الدورة الحالية') : $cycleLabel;
|
||||
|
||||
if ($selectedCycleId > 0) {
|
||||
$students = list_school_students_by_cycle((int) $application['id'], $selectedCycleId, $search, 0, 0, $filters);
|
||||
foreach ($students as $studentRow) {
|
||||
$viewModel = completion_certificate_view_model($application, $settings, $selectedCycleId, $cycleLabel, (int) ($studentRow['id'] ?? 0));
|
||||
if ($viewModel !== null) {
|
||||
$certificateItems[] = $viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$application || !$isApprovedSchool || $selectedCycleId <= 0) {
|
||||
http_response_code(404);
|
||||
}
|
||||
|
||||
$studentsUrl = $application ? school_page_url('students.php', (int) $application['id'], $selectedCycleId) : 'students.php';
|
||||
$pageTitle = $application ? 'تنزيل شهادات الإتمام: ' . (string) ($application['center_name'] ?? '') : 'تنزيل شهادات الإتمام';
|
||||
$pageDescription = 'صفحة مجمعة لطباعة أو حفظ جميع شهادات الإتمام والتكريم كملف PDF واحد للمركز والدورة المختارة.';
|
||||
|
||||
render_page_start($pageTitle, 'approved', $pageDescription);
|
||||
render_flash($flash);
|
||||
?>
|
||||
<section class="student-certificate-page completion-certificate-page completion-batch-page py-4 py-lg-5">
|
||||
<div class="container-xl">
|
||||
<div class="certificate-toolbar">
|
||||
<div>
|
||||
<div class="section-title">جميع شهادات الإتمام والتكريم</div>
|
||||
<div class="section-subtle"><?= e((string) count($certificateItems)) ?> شهادة<?= $search !== '' ? ' — نتائج البحث الحالية' : '' ?>. سيتم فتح نافذة الطباعة لتتمكن من الحفظ كملف PDF واحد.</div>
|
||||
</div>
|
||||
<div class="certificate-toolbar-actions">
|
||||
<a class="btn btn-outline-secondary" href="<?= e($studentsUrl) ?>">العودة إلى الطلاب</a>
|
||||
<?php if ($certificateItems !== []): ?>
|
||||
<button type="button" class="btn btn-primary" onclick="window.print()">تنزيل PDF / طباعة</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!$application): ?>
|
||||
<div class="app-card text-center py-5">
|
||||
<div class="empty-title mb-2">المركز غير موجود</div>
|
||||
<p class="text-muted mb-3">تحقق من الرابط ثم أعد المحاولة من صفحة الطلاب.</p>
|
||||
<a class="btn btn-primary" href="applications.php?status=approved">المراكز المعتمدة</a>
|
||||
</div>
|
||||
<?php elseif (!$isApprovedSchool): ?>
|
||||
<div class="app-card text-center py-5">
|
||||
<div class="empty-title mb-2">الشهادات غير متاحة حالياً</div>
|
||||
<p class="text-muted mb-0">يمكن إصدار شهادات الإتمام للمراكز المعتمدة فقط.</p>
|
||||
</div>
|
||||
<?php elseif ($selectedCycleId <= 0): ?>
|
||||
<div class="app-card text-center py-5">
|
||||
<div class="empty-title mb-2">لا توجد دورة مختارة</div>
|
||||
<p class="text-muted mb-3">اختر دورة صحيحة من صفحة الطلاب ثم أعد فتح تنزيل الشهادات.</p>
|
||||
<a class="btn btn-primary" href="<?= e($studentsUrl) ?>">العودة إلى سجل الطلاب</a>
|
||||
</div>
|
||||
<?php elseif ($certificateItems === []): ?>
|
||||
<div class="app-card text-center py-5">
|
||||
<div class="empty-title mb-2">لا توجد شهادات مطابقة حالياً</div>
|
||||
<p class="text-muted mb-3">قد تكون الفلاتر الحالية لا تُظهر أي طالب، أو لا توجد سجلات في هذه الدورة بعد.</p>
|
||||
<a class="btn btn-primary" href="<?= e($studentsUrl) ?>">العودة إلى سجل الطلاب</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="batch-certificate-stack">
|
||||
<?php foreach ($certificateItems as $item): ?>
|
||||
<?php
|
||||
$student = $item['student'];
|
||||
$certificate = $item['certificate'];
|
||||
$performance = $item['performance'];
|
||||
$honor = $item['honor'];
|
||||
?>
|
||||
<article class="completion-certificate-card completion-batch-item completion-template-<?= e((string) $item['template']) ?>" aria-labelledby="completion-certificate-title-<?= e((string) ($student['id'] ?? 0)) ?>">
|
||||
<div class="completion-certificate-layer completion-certificate-layer-one" aria-hidden="true"></div>
|
||||
<div class="completion-certificate-layer completion-certificate-layer-two" aria-hidden="true"></div>
|
||||
|
||||
<div class="completion-certificate-inner">
|
||||
<header class="completion-certificate-header">
|
||||
<div class="completion-branding">
|
||||
<?php if ((string) $item['center_logo'] !== ''): ?>
|
||||
<img src="<?= e(asset_url((string) $item['center_logo'])) ?>" alt="شعار <?= e((string) $item['center_name']) ?>" class="completion-brand-logo" width="96" height="96">
|
||||
<?php else: ?>
|
||||
<div class="completion-brand-logo completion-brand-badge" aria-hidden="true"><?= e(mb_substr((string) $item['center_name'], 0, 1)) ?></div>
|
||||
<?php endif; ?>
|
||||
<div>
|
||||
<div class="completion-overline">Certificate of Completion</div>
|
||||
<h1 id="completion-certificate-title-<?= e((string) ($student['id'] ?? 0)) ?>" class="completion-certificate-title"><?= e((string) $item['tagline']) ?></h1>
|
||||
<p class="completion-certificate-center mb-0"><?= e((string) $item['center_name']) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="completion-certificate-stamps">
|
||||
<span class="completion-stamp"><?= e($cycleLabel) ?></span>
|
||||
<span class="completion-stamp completion-stamp-accent"><?= e((string) ($honor['title_ar'] ?? 'بنجاح')) ?></span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="completion-certificate-content">
|
||||
<p class="completion-intro mb-2">تُمنح هذه الشهادة إلى</p>
|
||||
<div class="completion-student-name"><?= e((string) ($student['full_name'] ?? '')) ?></div>
|
||||
<?php if (!empty($student['student_code'])): ?>
|
||||
<div class="completion-student-code">رقم الطالب: <?= e((string) $student['student_code']) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<p class="completion-message"><?= e((string) $item['body_message']) ?></p>
|
||||
<p class="completion-honor-line mb-0"><?= e((string) ($honor['completion_line_ar'] ?? '')) ?></p>
|
||||
</div>
|
||||
|
||||
<div class="completion-certificate-grid">
|
||||
<section class="completion-summary-card">
|
||||
<span class="completion-summary-label">التقدير النهائي</span>
|
||||
<div class="performance-pill performance-<?= e((string) ($performance['key'] ?? 'good')) ?> completion-performance-pill">
|
||||
<?= e((string) ($performance['label_ar'] ?? 'مميز')) ?>
|
||||
</div>
|
||||
<div class="completion-honor-title"><?= e((string) ($honor['title_ar'] ?? 'بنجاح')) ?></div>
|
||||
<div class="completion-honor-subtitle"><?= e((string) ($honor['title'] ?? 'Successful Completion')) ?></div>
|
||||
</section>
|
||||
|
||||
<section class="completion-meta-grid" aria-label="بيانات الشهادة">
|
||||
<div class="completion-meta-item">
|
||||
<strong>الدورة</strong>
|
||||
<span><?= e($cycleLabel) ?></span>
|
||||
</div>
|
||||
<div class="completion-meta-item">
|
||||
<strong>تاريخ الإصدار</strong>
|
||||
<span><?= e((string) $item['issue_date_label']) ?></span>
|
||||
</div>
|
||||
<div class="completion-meta-item">
|
||||
<strong>نسبة الأداء</strong>
|
||||
<span><?= e((string) $item['percentage_label']) ?></span>
|
||||
</div>
|
||||
<div class="completion-meta-item">
|
||||
<strong>التقييمات المكتملة</strong>
|
||||
<span><?= e((string) ((int) ($certificate['completed_assessments'] ?? 0))) ?></span>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<?php if (empty($item['has_results'])): ?>
|
||||
<div class="completion-note">
|
||||
لا توجد تقييمات مرصودة لهذا الطالب بعد، لذلك تم إصدار شهادة إتمام مختصرة بدون مرتبة أداء رقمية.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<footer class="completion-signature-row">
|
||||
<div class="completion-signature-block">
|
||||
<strong>مدير/ة المركز</strong>
|
||||
<span><?= e((string) ($application['director_name'] ?? $item['center_name'])) ?></span>
|
||||
</div>
|
||||
<div class="completion-signature-block">
|
||||
<strong>اعتماد الشهادة</strong>
|
||||
<span><?= e((string) ($honor['title_ar'] ?? 'إتمام ناجح')) ?></span>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php if ($autoprint === 1 && $certificateItems !== []): ?>
|
||||
<script>
|
||||
window.addEventListener('load', function () {
|
||||
window.setTimeout(function () {
|
||||
window.print();
|
||||
}, 250);
|
||||
});
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
<?php render_page_end(); ?>
|
||||
17
students.php
17
students.php
@ -96,6 +96,18 @@ $metrics = $isApprovedSchool && $selectedCycleId > 0 ? school_student_metrics_by
|
||||
|
||||
$expectedCapacity = $application ? (int) ($application['expected_students'] ?? 0) : 0;
|
||||
$remainingSeats = max(0, $expectedCapacity - $metrics['total']);
|
||||
$bulkCertificateParams = ['autoprint' => '1'];
|
||||
if ($search !== '') {
|
||||
$bulkCertificateParams['search'] = $search;
|
||||
}
|
||||
foreach ($filters as $filterKey => $filterValue) {
|
||||
if ($filterValue !== '') {
|
||||
$bulkCertificateParams[$filterKey] = $filterValue;
|
||||
}
|
||||
}
|
||||
$bulkCompletionCertificatesUrl = $application && $selectedCycleId > 0
|
||||
? school_page_url('student_completion_certificates.php', (int) $application['id'], $selectedCycleId) . '&' . http_build_query($bulkCertificateParams)
|
||||
: '#';
|
||||
$pageTitle = $application ? 'تسجيل الطلاب: ' . (string) $application['center_name'] . ($selectedCycle ? ' — ' . $cycleLabel : '') : 'تسجيل الطلاب';
|
||||
$pageDescription = 'صفحة مستقلة لتسجيل الطلاب وإدارة كشف المدرسة بعد الاعتماد، مع ربط كل البيانات بالدورة الموسمية النشطة أو المؤرشفة.';
|
||||
$approvedSchoolUrl = $application ? school_page_url('approved_school.php', (int) $application['id'], $selectedCycleId) : 'approved_school.php';
|
||||
@ -231,8 +243,11 @@ render_flash($flash);
|
||||
<div class="section-title">كشف المدرسة</div>
|
||||
<div class="section-copy">الطلاب المسجلون حالياً في هذه المدرسة فقط.</div>
|
||||
</div>
|
||||
<div class="d-flex gap-2">
|
||||
<div class="d-flex gap-2 flex-wrap">
|
||||
<span class="header-chip"><?= e((string) $metrics['boys']) ?> طلاب / <?= e((string) $metrics['girls']) ?> طالبات</span>
|
||||
<?php if ($selectedCycleId > 0 && $totalStudents > 0): ?>
|
||||
<a class="btn btn-outline-primary btn-sm" href="<?= e($bulkCompletionCertificatesUrl) ?>" target="_blank" rel="noopener">تنزيل كل الشهادات PDF</a>
|
||||
<?php endif; ?>
|
||||
<?php if (!$isCycleReadOnly): ?>
|
||||
<button type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#studentModal" onclick="resetStudentModal()">
|
||||
+ إضافة طالب
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user