fetchArray('SELECT created_at, options, (SELECT name FROM zz_emails WHERE id = id_email) AS email, (SELECT username FROM zz_users WHERE id = id_utente) AS user FROM zz_operations WHERE id_record = '.prepare($options['id_record']).' AND id_module = '.prepare($options['id_module'])." AND op = 'send-email' AND id_email IS NOT NULL ORDER BY created_at DESC");
if (empty($operations)) {
return ' ';
}
// Codice HTML
$result = '
';
foreach ($operations as $operation) {
$options = json_decode($operation['options'], true);
$receivers = $options['receivers'];
$prints = [];
foreach ($options['prints'] as $print) {
$print = Prints::get($print);
$prints[] = $print['title'];
}
$attachments = [];
foreach ($options['attachments'] as $attachment) {
$attachment = $database->selectOne('zz_files', '*', ['id' => $attachment]);
$attachments[] = $attachment['name'];
}
$result .= '
-
'.tr('Email "_EMAIL_" inviata il _DATE_ alle _HOUR_ da _USER_', [
'_EMAIL_' => $operation['email'],
'_DATE_' => Translator::dateToLocale($operation['created_at']),
'_HOUR_' => Translator::timeToLocale($operation['created_at']),
'_USER_' => $operation['user'],
]).'.
- '.tr('Destinatari').': '.implode(', ', $receivers).'.
';
if (!empty($prints)) {
$result .= '
- '.tr('Stampe').': '.implode(', ', $prints).'.
';
}
if (!empty($attachments)) {
$result .= '
- '.tr('Allegati').': '.implode(', ', $attachments).'.
';
}
$result .= '
';
}
$result .= '
';
return $result;
}
}