rename some variables
This commit is contained in:
parent
d0c153943a
commit
512b00550e
3 changed files with 14 additions and 14 deletions
|
@ -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, [
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue