From 512b00550e65ec08ed863118503526ac873b3b12 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Wed, 22 Jan 2020 23:37:23 +0100 Subject: [PATCH] rename some variables --- src/Module/BaseNotifications.php | 12 ++++++------ src/Module/Notifications/Introductions.php | 2 +- src/Module/Notifications/Notifications.php | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Module/BaseNotifications.php b/src/Module/BaseNotifications.php index feec56aea3..f1321dfec3 100644 --- a/src/Module/BaseNotifications.php +++ b/src/Module/BaseNotifications.php @@ -46,12 +46,12 @@ abstract class BaseNotifications extends BaseModule ]; /** @var int The default count of items per page */ - const PER_PAGE = 20; + const ITEMS_PER_PAGE = 20; /** @var boolean True, if ALL entries should get shown */ - protected static $show; + protected static $showAll; /** @var int The determined start item of the current page */ - protected static $start; + protected static $firstItemNum; /** * Collects all notifies from the backend @@ -69,8 +69,8 @@ abstract class BaseNotifications extends BaseModule $page = ($_REQUEST['page'] ?? 0) ?: 1; - self::$start = ($page * self::PER_PAGE) - self::PER_PAGE; - self::$show = ($_REQUEST['show'] ?? '') === 'all'; + self::$firstItemNum = ($page * self::ITEMS_PER_PAGE) - self::ITEMS_PER_PAGE; + self::$showAll = ($_REQUEST['show'] ?? '') === 'all'; } public static function post(array $parameters = []) @@ -125,7 +125,7 @@ abstract class BaseNotifications extends BaseModule $tabs = self::getTabs(); // Set the pager - $pager = new Pager(DI::args()->getQueryString(), self::PER_PAGE); + $pager = new Pager(DI::args()->getQueryString(), self::ITEMS_PER_PAGE); $notif_tpl = Renderer::getMarkupTemplate('notifications.tpl'); return Renderer::replaceMacros($notif_tpl, [ diff --git a/src/Module/Notifications/Introductions.php b/src/Module/Notifications/Introductions.php index 7de1820362..b22df920bc 100644 --- a/src/Module/Notifications/Introductions.php +++ b/src/Module/Notifications/Introductions.php @@ -23,7 +23,7 @@ class Introductions extends BaseNotifications $id = (int)DI::args()->get(2, 0); $all = DI::args()->get(2) == 'all'; - $notifs = DI::notify()->getIntroList($all, self::$start, self::PER_PAGE, $id); + $notifs = DI::notify()->getIntroList($all, self::$firstItemNum, self::ITEMS_PER_PAGE, $id); return [ 'header' => DI::l10n()->t('Notifications'), diff --git a/src/Module/Notifications/Notifications.php b/src/Module/Notifications/Notifications.php index b15c7feca0..50995645c3 100644 --- a/src/Module/Notifications/Notifications.php +++ b/src/Module/Notifications/Notifications.php @@ -29,29 +29,29 @@ class Notifications extends BaseNotifications // Get the network notifications if ((DI::args()->get(1) == 'network')) { $notif_header = DI::l10n()->t('Network Notifications'); - $notifs = $nm->getNetworkList(self::$show, self::$start, self::PER_PAGE); + $notifs = $nm->getNetworkList(self::$showAll, self::$firstItemNum, self::ITEMS_PER_PAGE); // Get the system notifications } elseif ((DI::args()->get(1) == 'system')) { $notif_header = DI::l10n()->t('System Notifications'); - $notifs = $nm->getSystemList(self::$show, self::$start, self::PER_PAGE); + $notifs = $nm->getSystemList(self::$showAll, self::$firstItemNum, self::ITEMS_PER_PAGE); // Get the personal notifications } elseif ((DI::args()->get(1) == 'personal')) { $notif_header = DI::l10n()->t('Personal Notifications'); - $notifs = $nm->getPersonalList(self::$show, self::$start, self::PER_PAGE); + $notifs = $nm->getPersonalList(self::$showAll, self::$firstItemNum, self::ITEMS_PER_PAGE); // Get the home notifications } elseif ((DI::args()->get(1) == 'home')) { $notif_header = DI::l10n()->t('Home Notifications'); - $notifs = $nm->getHomeList(self::$show, self::$start, self::PER_PAGE); + $notifs = $nm->getHomeList(self::$showAll, self::$firstItemNum, self::ITEMS_PER_PAGE); // fallback - redirect to main page } else { DI::baseUrl()->redirect('notifications'); } // Set the pager - $pager = new Pager(DI::args()->getQueryString(), self::PER_PAGE); + $pager = new Pager(DI::args()->getQueryString(), self::ITEMS_PER_PAGE); // Add additional informations (needed for json output) $notifs['items_page'] = $pager->getItemsPerPage(); @@ -109,8 +109,8 @@ class Notifications extends BaseNotifications } $notif_show_lnk = [ - 'href' => (self::$show ? 'notifications/' . $notifs['ident'] : 'notifications/' . $notifs['ident'] . '?show=all'), - 'text' => (self::$show ? DI::l10n()->t('Show unread') : DI::l10n()->t('Show all')), + 'href' => (self::$showAll ? 'notifications/' . $notifs['ident'] : 'notifications/' . $notifs['ident'] . '?show=all'), + 'text' => (self::$showAll ? DI::l10n()->t('Show unread') : DI::l10n()->t('Show all')), ]; return self::printContent($notif_header, $notif_content, $notif_nocontent, $notif_show_lnk);