rules->all($ctx->daUser->username());
$ok = [];
$status = $ctx->query('status');
if ($status === 'created') { $ok[] = $ctx->t('Rule created.'); }
if ($status === 'updated') { $ok[] = $ctx->t('Rule updated.'); }
if ($status === 'deleted') { $ok[] = $ctx->t('Rule deleted.'); }
if ($status === 'toggled') { $ok[] = $ctx->t('Rule status changed.'); }
if ($rules === []) {
$body = '
' . AppContext::e($ctx->t('No global autoresponders')) . '
' .
'
' . AppContext::e($ctx->t('All valid POP/IMAP mailboxes in this account')) . '
';
$ctx->render('Global autoresponders', $body, $ok);
return;
}
$rows = '';
foreach ($rules as $rule) {
$id = (string)$rule['id'];
$enabled = !empty($rule['enabled']);
$subjectPrefix = (string)($rule['subject_prefix'] ?? $rule['subject'] ?? '');
$rows .= '| ' . AppContext::e($ctx->t($enabled ? 'Enabled' : 'Disabled')) . ' | ';
$rows .= '' . AppContext::e($subjectPrefix) . ' ' . date('Y-m-d H:i', (int)($rule['updated_at'] ?? time())) . ' | ';
$rows .= '' . AppContext::e(date('Y-m-d H:i', (int)$rule['start_ts'])) . ' ' . AppContext::e($ctx->t('To')) . ' ' . AppContext::e(date('Y-m-d H:i', (int)$rule['end_ts'])) . ' | ';
$rows .= '';
$rows .= '' . AppContext::e($ctx->t('Edit')) . '';
$rows .= '' . AppContext::e($ctx->t('Preview')) . '';
$rows .= '';
$rows .= '' . AppContext::e($ctx->t('Delete')) . '';
$rows .= ' |
';
}
$body = '' . AppContext::e($ctx->t('Global autoresponders')) . '
' . AppContext::e($ctx->t('All valid POP/IMAP mailboxes in this account')) . '
' .
'
| ' . AppContext::e($ctx->t('Status')) . ' | ' . AppContext::e($ctx->t('Subject prefix')) . ' | ' . AppContext::e($ctx->t('Sending period')) . ' | ' . AppContext::e($ctx->t('Actions')) . ' |
' . $rows . '
';
$ctx->render('Global autoresponders', $body, $ok);
};