Enhance newsletter HTML in index.php and wiki.php by updating article count messages to include date ranges. Added logic to calculate and display the date range of articles, improving clarity for recipients.
This commit is contained in:
25
wiki.php
25
wiki.php
@@ -344,8 +344,26 @@ function buildNewsletterHtml(array $config, array $articles, string $periodLabel
|
||||
$replyEmail = trim((string)($config['reply_to'] ?: $config['from_email']));
|
||||
$replyHref = 'mailto:' . $replyEmail;
|
||||
$summaryText = $count === 1
|
||||
? 'Im ' . h($periodLabel) . ' wurde 1 neuer Wiki-Artikel veröffentlicht.'
|
||||
: 'Im ' . h($periodLabel) . ' wurden ' . $count . ' neue Wiki-Artikel veröffentlicht.';
|
||||
? 'Im Zeitraum ' . h($periodLabel) . ' wurde 1 neuer Wiki-Artikel veröffentlicht.'
|
||||
: 'Im Zeitraum ' . h($periodLabel) . ' wurden ' . $count . ' neue Wiki-Artikel veröffentlicht.';
|
||||
|
||||
$dateRangeText = 'für den Zeitraum ' . h($periodLabel);
|
||||
if (!empty($articles)) {
|
||||
$timestamps = [];
|
||||
foreach ($articles as $article) {
|
||||
$date = DateTimeImmutable::createFromFormat('Y-m-d', (string)($article['date'] ?? ''));
|
||||
if ($date instanceof DateTimeImmutable) {
|
||||
$timestamps[] = $date->getTimestamp();
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($timestamps)) {
|
||||
sort($timestamps);
|
||||
$from = (new DateTimeImmutable('@' . (string)$timestamps[0]))->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$to = (new DateTimeImmutable('@' . (string)$timestamps[count($timestamps) - 1]))->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$dateRangeText = 'vom ' . $from->format('d.m.Y') . ' bis ' . $to->format('d.m.Y');
|
||||
}
|
||||
}
|
||||
|
||||
$articleRows = '';
|
||||
if ($count === 0) {
|
||||
@@ -470,10 +488,11 @@ function buildNewsletterHtml(array $config, array $articles, string $periodLabel
|
||||
<tr>
|
||||
<td class="mobile-intro" style="font-family:Arial,Helvetica,sans-serif;font-size:17px;line-height:27px;color:#1e2530;">
|
||||
Guten Tag,<br><br>
|
||||
hier ist Ihre aktuelle Übersicht aus dem Thomas-Krenn-Wiki.<br>
|
||||
hier erhalten Sie Ihre aktuelle Übersicht aus dem Thomas-Krenn-Wiki, ' . $dateRangeText . '.<br>
|
||||
' . $summaryText . '<br><br>
|
||||
Viel Spaß beim Lesen wünscht<br>Ihr Team von Thomas-Krenn
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user