From 7cedc501f7b40f230c830a88cd1fe84b8f0a6f5c Mon Sep 17 00:00:00 2001 From: Molkobain Date: Thu, 4 Jul 2024 23:59:39 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B07565=20-=20Add=20button=20in=20notificat?= =?UTF-8?q?ions=20center=20to=20access=20the=20"all=20news"=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../en.dictionary.itop.notifications-center.php | 1 + .../fr.dictionary.itop.notifications-center.php | 1 + .../Notifications/NotificationsCenterController.php | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/dictionaries/ui/pages/notifications-center/en.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/en.dictionary.itop.notifications-center.php index 44f9f33e2..22d4e844a 100644 --- a/dictionaries/ui/pages/notifications-center/en.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/en.dictionary.itop.notifications-center.php @@ -21,6 +21,7 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:NotificationsCenter:Page:Title' => 'Notifications center', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel', + 'UI:NotificationsCenter:Panel:Toolbar:ViewAllNews:Title' => 'View all my news', 'UI:NotificationsCenter:Panel:Table:Channels' => 'Channels', 'UI:NotificationsCenter:Unsubscribe:Success' => 'You have been successfully unsubscribed from the selected notifications.', 'UI:NotificationsCenter:Unsubscribe:Error' => 'An error occurred while unsubscribing from the selected notifications.', diff --git a/dictionaries/ui/pages/notifications-center/fr.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/fr.dictionary.itop.notifications-center.php index 6d6ce1b60..91ae18c59 100644 --- a/dictionaries/ui/pages/notifications-center/fr.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/fr.dictionary.itop.notifications-center.php @@ -14,6 +14,7 @@ Dict::Add('FR FR', 'French', 'Français', [ 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s sur %2$s', 'UI:NotificationsCenter:Page:Title' => 'Notifications', 'UI:NotificationsCenter:Panel:SubTitle' => 'Gérer les Notifications dont vous êtes destinataire : désinscrivez-vous ou limitez les à un seul canal', + 'UI:NotificationsCenter:Panel:Toolbar:ViewAllNews:Title' => 'Voir toutes mes news', 'UI:NotificationsCenter:Panel:Table:Channels' => 'Canaux', 'UI:NotificationsCenter:Panel:Title' => 'Notifications', 'UI:NotificationsCenter:Subscribe:Error' => 'Une erreur c\'est produite, lors de votre ré-inscription.', diff --git a/sources/Controller/Notifications/NotificationsCenterController.php b/sources/Controller/Notifications/NotificationsCenterController.php index 52ca628c3..bc227474a 100644 --- a/sources/Controller/Notifications/NotificationsCenterController.php +++ b/sources/Controller/Notifications/NotificationsCenterController.php @@ -3,6 +3,7 @@ namespace Combodo\iTop\Controller\Notifications; use ActionNotification; use Combodo\iTop\Application\TwigBase\Controller\Controller; +use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Html\Html; use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory; @@ -11,6 +12,7 @@ use Combodo\iTop\Application\UI\Base\Component\Input\Set\SetUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Panel\Panel; use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock; use Combodo\iTop\Application\WebPage\iTopWebPage; +use Combodo\iTop\Controller\Newsroom\iTopNewsroomController; use Combodo\iTop\Core\Trigger\Enum\SubscriptionPolicy; use Combodo\iTop\Renderer\BlockRenderer; use Combodo\iTop\Service\Notification\NotificationsRepository; @@ -65,6 +67,13 @@ class NotificationsCenterController extends Controller $sPictureUrl = UserRights::GetUserPictureAbsUrl(); $oNotificationsPanel->SetIcon($sPictureUrl,Panel::ENUM_ICON_COVER_METHOD_CONTAIN, true); + $oAllNewsPageButton = ButtonUIBlockFactory::MakeIconLink( + 'fas fa-bell', + Dict::S('UI:NotificationsCenter:Panel:Toolbar:ViewAllNews:Title'), + Router::GetInstance()->GenerateUrl(iTopNewsroomController::ROUTE_NAMESPACE.'.view_all'), + ); + $oNotificationsPanel->SetToolBlocks([$oAllNewsPageButton]); + $oNotificationsCenterTableColumns = [ 'trigger' => array('label' => MetaModel::GetName('Trigger')), 'trigger_class' => array('label' => MetaModel::GetAttributeDef('Trigger', 'finalclass')->GetLabel()),