extend('layout/email_layout') ?> section('content') ?> string, * 'invite_link' => string, * 'qr_src' => string (data-URI or public URL) * ] * Optional legacy: * - $sections, $links, $qrImageUrl * Optional: * - $teacherNames (array) * - $title */ $displayName = trim(($parent['firstname'] ?? '') . ' ' . ($parent['lastname'] ?? '')); $items = $items ?? []; $teacherNames = $teacherNames ?? []; $sections = $sections ?? []; $links = $links ?? []; $sectionNames = array_map(fn($s) => $s['class_section_name'] ?? '', $sections); $linkFallback = $links[0] ?? ($sections[0]['invite_link'] ?? '#'); $introSections = !empty($items) ? array_map(fn($i) => $i['class_section_name'] ?? 'Class', $items) : $sectionNames; /** * Closures instead of named functions (avoids redeclare): * - $formatSectionName: normalizes labels to "Grade X[-Y]" except KG/Youth or already "Grade ..." * - $joinWithAnd: joins items with "and" (no Oxford comma) */ $formatSectionName = function (string $section): string { $raw = trim($section); if ($raw === '') return 'Class'; // If already starts with "Grade", keep it (normalize spacing/casing lightly) if (preg_match('/^\s*grade\s+/i', $raw)) { // Capitalize "Grade" word only return 'Grade ' . trim(preg_replace('/^\s*grade\s+/i', '', $raw)); } // Normalize special groups $up = strtoupper($raw); if ($up === 'KG') return 'KG'; if ($up === 'YOUTH') return 'Youth'; // Common forms: "2-A", "5-B", "6", "3 a" -> make "Grade 3-A" or "Grade 6" // Keep hyphen part as uppercase if present. if (preg_match('/^\s*(\d{1,2})(?:\s*-\s*([A-Za-z]))?\s*$/', $raw, $m)) { $grade = (int)$m[1]; $sec = isset($m[2]) ? strtoupper($m[2]) : ''; return 'Grade ' . $grade . ($sec ? '-' . $sec : ''); } // Fallback: Title-case but prefix as Grade return 'Grade ' . ucfirst($raw); }; $joinWithAnd = function (array $arr): string { $arr = array_values(array_filter($arr, fn($v) => $v !== null && $v !== '')); $n = count($arr); if ($n === 0) return ''; if ($n === 1) return $arr[0]; if ($n === 2) return $arr[0] . ' and ' . $arr[1]; return implode(', ', array_slice($arr, 0, -1)) . ' and ' . $arr[$n - 1]; }; ?>

Assalamu Alaikum ,

We are excited to welcome you to this school year at Al Rahma Sunday School. As we approach our fourth week of learning, we ask Allah (SWT) to make this year successful and beneficial for all our children.

You have been identified as a parent or guardian of at least one child in this year. We are inviting you to join the WhatsApp group(s) that include other parents and your child’s instructors. The WhatsApp group(s) will be used to share important information about curriculum assignments and school events.

Additionally, by joining these groups, you automatically become part of the Al Rahma Sunday School Community, which hosts all grade groups within the school. Through this community, you will receive important alerts and messages from the school administration.

Your WhatsApp Group(s)

$it): $sectionLabel = $formatSectionName($it['class_section_name'] ?? 'Class'); $inviteLink = (string)($it['invite_link'] ?? '#'); $qrSrc = (string)($it['qr_src'] ?? ''); ?>
)
Join WhatsApp Group
QR for <?= esc($sectionLabel) ?>
QR unavailable
Join WhatsApp Group
WhatsApp QR Code
QR unavailable

Jazakum Allah Khair,
Al Rahma Sunday School Administration

endSection() ?>