2020-06-22 16:57:43 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
use Modules\Emails\Mail;
|
|
|
|
|
|
|
|
switch (post('op')) {
|
|
|
|
case 'delete-bulk':
|
|
|
|
$i = 0;
|
|
|
|
foreach ($id_records as $id_record) {
|
|
|
|
if (isset($id_record)) {
|
|
|
|
$mail = Mail::find($id_record);
|
|
|
|
if (empty($mail->sent_at)) {
|
|
|
|
$mail->delete();
|
2020-06-30 13:26:15 +02:00
|
|
|
++$i;
|
2020-06-22 16:57:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-30 13:26:15 +02:00
|
|
|
if ($i > 0) {
|
2020-07-30 14:22:22 +02:00
|
|
|
flash()->info(tr('Email rimosse dalla coda di invio'));
|
2020-06-30 13:26:15 +02:00
|
|
|
} else {
|
2020-07-30 14:22:22 +02:00
|
|
|
flash()->warning(tr('Nessuna email rimossa dalla coda di invio'));
|
2020-06-22 16:57:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$operations['delete-bulk'] = [
|
2020-07-30 14:22:22 +02:00
|
|
|
'text' => '<span><i class="fa fa-trash"></i> '.tr('Elimina email selezionate e non ancora inviate').'</span>',
|
2020-06-22 16:57:43 +02:00
|
|
|
'data' => [
|
|
|
|
'msg' => tr('Vuoi davvero eliminare dalla coda di invio le email selezionate?'),
|
|
|
|
'button' => tr('Procedi'),
|
|
|
|
'class' => 'btn btn-lg btn-danger',
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
2020-06-30 13:26:15 +02:00
|
|
|
return $operations;
|