Files
alrahma_sunday_school/app/Views/emails/status_payment_pending.php
T
2026-02-10 22:11:06 -05:00

101 lines
3.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?= $this->extend('layout/email_layout') ?>
<?= $this->section('content') ?>
<div style="font-size:16px; line-height:1.5;">
<?php
// Normalize $studentName into an array of names (accept array or a label like "A, B, and C")
$names = [];
if (isset($studentName)) {
if (is_array($studentName)) {
$names = array_values(array_filter(
array_map(static fn($n) => trim((string)$n), $studentName),
static fn($n) => $n !== ''
));
} else {
$s = trim((string)$studentName);
if ($s !== '') {
$parts = preg_split('/\s*,\s*|\s*,?\s+and\s+/i', $s);
if ($parts !== false) {
$names = array_values(array_filter(array_map('trim', $parts), static fn($x) => $x !== ''));
}
}
}
}
$count = count($names);
// Non-possessive label: "A", "A and B", "A, B, and C"
if ($count === 0) {
$label = 'your student';
} elseif ($count === 1) {
$label = $names[0];
} elseif ($count === 2) {
$label = "{$names[0]} and {$names[1]}";
} else {
$label = implode(', ', array_slice($names, 0, -1)) . ', and ' . $names[$count - 1];
}
// Possessive label with possessive only on the last item: "A and Bs", "A, B, and Cs"
$labelPoss = ($count === 0)
? 'your student&#8217;s'
: ($count === 1
? $names[0] . '&#8217;s'
: $label . '&#8217;s');
$verb = ($count > 1) ? 'have' : 'has';
?>
<p>Dear <?= esc($parentName ?? 'Parent') ?>,</p>
<?php if ($count > 1): ?>
<p>
Congratulations! We are pleased to inform you that the following students have been accepted
for admission to our school:
</p>
<!-- Bullet list via table for email-client reliability -->
<!-- left indent spacer -->
<td>
<table role="presentation" cellpadding="0" cellspacing="0" style="border-collapse:collapse; padding-left:0;">
<?php foreach ($names as $n): ?>
<tr>
<td style="width:24px; font-size:0; line-height:0;">&nbsp;</td>
<td style="font-size:16px; line-height:1.5; padding:0 8px 2px 0; vertical-align:top;">&bull;</td>
<td style="font-size:16px; line-height:1.5; padding:0 0 2px 0; vertical-align:top;"><?= esc($n) ?></td>
</tr>
<?php endforeach; ?>
</table>
<p>
We are excited to welcome your family to our community and look forward to supporting
your children's growth in both faith and learning.
</p>
<?php elseif ($count === 1): ?>
<p>
Congratulations! We are pleased to inform you that <?= esc($names[0]) ?> <?= $verb ?> been
accepted for admission to our school.
</p>
<p>
We are excited to welcome your family to our community and look forward to supporting
your child's growth in both faith and learning.
</p>
<?php endif; ?>
<p>
<strong>Next steps:</strong> Please log in to the parent portal and visit the <em>Invoice</em> tab
to review your invoice details. The balance must be paid in person on the first day of school
to complete the enrollment process.
</p>
<p style="margin:16px 0;">
<a href="<?= base_url() ?>" target="_blank" rel="noopener"
style="display:inline-block; padding:10px 16px; text-decoration:none; border-radius:6px;
background:#198754; color:#ffffff; font-weight:600; font-size:16px;">
Access My Account
</a>
</p>
<p>Best regards,<br>Admissions Committee</p>
</div>
<?= $this->endSection() ?>