Diff
Index: notifications.php
--- notifications.php (nonexistent)
+++ notifications.php (revision 4)
@@ -0,0 +1,42 @@
+<?php
+declare(strict_types = 1);
+
+namespace Views\admin\settings;
+
+use Apex\Svc{App, View};
+use Apex\App\Base\Implementors;
+use App\Webapp\Notifications\NotificationsConfig;
+use Apex\App\Interfaces\EmailNotificationControllerInterface;
+
+/**
+ * Render the template.
+ */
+class notifications
+{
+
+ /**
+ * Render
+ */
+ public function render(View $view, App $app, Implementors $implementors, NotificationsConfig $config):void
+ {
+
+ // Create notification
+ if ($app->getAction() == 'create') {
+ if ($email = $config->create()) {
+ $view->addCallout(tr("Successfully created e-mail notification with subject, %s", $email->subject));
+ }
+ } elseif ($app->getAction() == 'update') {
+ if ($email = $config->create([], (int) $app->post('notification_id'))) {
+ $view->addCallout(tr("Successfully updated e-mail notification with subject, %s", $email->subject));
+ }
+ }
+
+ // Create select options
+ $options = $implementors->createSelectOptions(EmailNotificationControllerInterface::class, 'title');
+ $view->assign('controller_options', $options);
+
+ }
+
+}
+
+
Full Code
<?php
declare(strict_types = 1);
namespace Views\admin\settings;
use Apex\Svc{App, View};
use Apex\App\Base\Implementors;
use App\Webapp\Notifications\NotificationsConfig;
use Apex\App\Interfaces\EmailNotificationControllerInterface;
/**
* Render the template.
*/
class notifications
{
/**
* Render
*/
public function render(View $view, App $app, Implementors $implementors, NotificationsConfig $config):void
{
// Create notification
if ($app->getAction() == 'create') {
if ($email = $config->create()) {
$view->addCallout(tr("Successfully created e-mail notification with subject, %s", $email->subject));
}
} elseif ($app->getAction() == 'update') {
if ($email = $config->create([], (int) $app->post('notification_id'))) {
$view->addCallout(tr("Successfully updated e-mail notification with subject, %s", $email->subject));
}
}
// Create select options
$options = $implementors->createSelectOptions(EmailNotificationControllerInterface::class, 'title');
$view->assign('controller_options', $options);
}
}