FIle - /trunk/views/php/admin/communicate/broadcast_email.php
/trunk/views/php/admin/communicate/broadcast_email.php
|
|
1,546 bytes
|
|
January 20, 2025 at 08:22
|
|
<?php
declare(strict_types = 1);
namespace Views\admin\communicate;
use Apex\Svc\{View, App};
use App\Webapp\AdminProfiles;
use App\Webapp\Notifications\Broadcaster;
use App\Users\Helpers\UserNotifications;
/**
* Render the template.
*/
class broadcast_email
{
/**
* Render
*/
public function render(View $view, App $app, AdminProfiles $admin_profiles):void
{
// Create options
$view->assign('admin_options', $admin_profiles->createSelectOptions());
}
/**
* Post
*/
public function post(View $view, App $app, Broadcaster $broadcaster):void
{
// Test e-mail
if ($app->getAction() == 'send_test') {
$broadcaster->sendTestEmail($app->post('test_email'));
$view->addCallout("Successfully sent test e-mail to " . $app->post('test_email'));
return;
}
// Set condition
$condition = [
'group_id' => $app->post('group_id'),
'is_active' => $app->post('is_active'),
'is_deleted' => $app->post('is_deleted'),
'email_verified' => $app->post('email_verified'),
'phone_verified' => $app->post('phone_verified')
];
// Add to queue
$broadcaster->queue(UserNotifications::class, $condition);
// Callout
$view->addCallout('Successfully queued the message to be sent, and it will send within minutes. If the message does not send, check to ensure the crontab job on your server is correctly added.');
}
}