mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 22:46:13 +00:00
Create notification flag providers
This commit is contained in:
parent
c917c42789
commit
c9c565809a
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification\FlagProviders;
|
||||||
|
|
||||||
|
use Symfony\Component\Translation\TranslatableMessage;
|
||||||
|
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||||
|
|
||||||
|
class AccompanyingCourseNotificationFlagProvider implements NotificationFlagProviderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getFlag(): string
|
||||||
|
{
|
||||||
|
return 'acc-course-notif';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabel(): TranslatableInterface
|
||||||
|
{
|
||||||
|
return new TranslatableMessage('notification.flags.acc-course');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification\FlagProviders;
|
||||||
|
|
||||||
|
use Symfony\Component\Translation\TranslatableMessage;
|
||||||
|
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||||
|
|
||||||
|
class AccompanyingCourseWorkEvalNotificationFlagProvider implements NotificationFlagProviderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getFlag(): string
|
||||||
|
{
|
||||||
|
return 'acc-course-work-eval-notif';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabel(): TranslatableInterface
|
||||||
|
{
|
||||||
|
return new TranslatableMessage('notification.flags.acc-course-work-eval');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification\FlagProviders;
|
||||||
|
|
||||||
|
use Symfony\Component\Translation\TranslatableMessage;
|
||||||
|
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||||
|
|
||||||
|
class AccompanyingCourseWorkNotificationFlagProvider implements NotificationFlagProviderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getFlag(): string
|
||||||
|
{
|
||||||
|
return 'acc-course-work-notif';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabel(): TranslatableInterface
|
||||||
|
{
|
||||||
|
return new TranslatableMessage('notification.flags.acc-course-work');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification\FlagProviders;
|
||||||
|
|
||||||
|
use Symfony\Component\Translation\TranslatableMessage;
|
||||||
|
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||||
|
|
||||||
|
class ActivityNotificationFlagProvider implements NotificationFlagProviderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getFlag(): string
|
||||||
|
{
|
||||||
|
return 'activity-notif';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabel(): TranslatableInterface
|
||||||
|
{
|
||||||
|
return new TranslatableMessage('notification.flags.activity');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification\FlagProviders;
|
||||||
|
|
||||||
|
use Symfony\Component\Translation\TranslatableMessage;
|
||||||
|
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||||
|
|
||||||
|
class DesignatedReferrerNotificationFlagProvider implements NotificationFlagProviderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getFlag(): string
|
||||||
|
{
|
||||||
|
return 'referrer-acc-course-notif';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabel(): TranslatableInterface
|
||||||
|
{
|
||||||
|
return new TranslatableMessage('notification.flags.referrer-acc-course');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification\FlagProviders;
|
||||||
|
|
||||||
|
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
|
||||||
|
|
||||||
|
#[AutoconfigureTag('chill_main.notification_flag_provider')]
|
||||||
|
interface NotificationFlagProviderInterface
|
||||||
|
{
|
||||||
|
public function getFlag(): string;
|
||||||
|
|
||||||
|
public function getLabel(): TranslatableInterface;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification\FlagProviders;
|
||||||
|
|
||||||
|
use Symfony\Component\Translation\TranslatableMessage;
|
||||||
|
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||||
|
|
||||||
|
class PersonAddressMoveNotificationFlagProvider implements NotificationFlagProviderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getFlag(): string
|
||||||
|
{
|
||||||
|
return 'person-address-move-notif';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabel(): TranslatableInterface
|
||||||
|
{
|
||||||
|
return new TranslatableMessage('notification.flags.person-address-move');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification\FlagProviders;
|
||||||
|
|
||||||
|
use Symfony\Component\Translation\TranslatableMessage;
|
||||||
|
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||||
|
|
||||||
|
class PersonNotificationFlagProvider implements NotificationFlagProviderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getFlag(): string
|
||||||
|
{
|
||||||
|
return 'person-notif';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabel(): TranslatableInterface
|
||||||
|
{
|
||||||
|
return new TranslatableMessage('notification.flags.person');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification\FlagProviders;
|
||||||
|
|
||||||
|
use Symfony\Component\Translation\TranslatableMessage;
|
||||||
|
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||||
|
|
||||||
|
class WorkflowTransitionNotificationFlagProvider implements NotificationFlagProviderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getFlag(): string
|
||||||
|
{
|
||||||
|
return 'workflow-trans-notif';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabel(): TranslatableInterface
|
||||||
|
{
|
||||||
|
return new TranslatableMessage('notification.flags.workflow-trans');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Notification\FlagProviders\NotificationFlagProviderInterface;
|
||||||
|
|
||||||
|
final readonly class NotificationFlagManager
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var array<NotificationFlagProviderInterface>
|
||||||
|
*/
|
||||||
|
private array $notificationFlagProviders;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
iterable $notificaitonFlagProviders,
|
||||||
|
) {
|
||||||
|
$this->notificationFlagProviders = iterator_to_array($notificaitonFlagProviders);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllNotificationFlagProviders(): array
|
||||||
|
{
|
||||||
|
return $this->notificationFlagProviders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNotificationFlagProviderByLabel(string $label): ?NotificationFlagProviderInterface
|
||||||
|
{
|
||||||
|
foreach ($this->notificationFlagProviders as $provider) {
|
||||||
|
if ($provider->getLabel() == $label) {
|
||||||
|
return $provider;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,10 @@ services:
|
|||||||
arguments:
|
arguments:
|
||||||
$routeParameters: '%chill_main.notifications%'
|
$routeParameters: '%chill_main.notifications%'
|
||||||
|
|
||||||
|
Chill\MainBundle\Notification\NotificationFlagManager:
|
||||||
|
arguments:
|
||||||
|
$notificationFlagProviders: !tagged_iterator chill_main.notification_flag_provider
|
||||||
|
|
||||||
Chill\MainBundle\Notification\NotificationHandlerManager:
|
Chill\MainBundle\Notification\NotificationHandlerManager:
|
||||||
arguments:
|
arguments:
|
||||||
$handlers: !tagged_iterator chill_main.notification_handler
|
$handlers: !tagged_iterator chill_main.notification_handler
|
||||||
|
Loading…
x
Reference in New Issue
Block a user