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 */
|
/** @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 */
|
/** @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 */
|
/** @var int The determined start item of the current page */
|
||||||
protected static $start;
|
protected static $firstItemNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collects all notifies from the backend
|
* Collects all notifies from the backend
|
||||||
|
@ -69,8 +69,8 @@ abstract class BaseNotifications extends BaseModule
|
||||||
|
|
||||||
$page = ($_REQUEST['page'] ?? 0) ?: 1;
|
$page = ($_REQUEST['page'] ?? 0) ?: 1;
|
||||||
|
|
||||||
self::$start = ($page * self::PER_PAGE) - self::PER_PAGE;
|
self::$firstItemNum = ($page * self::ITEMS_PER_PAGE) - self::ITEMS_PER_PAGE;
|
||||||
self::$show = ($_REQUEST['show'] ?? '') === 'all';
|
self::$showAll = ($_REQUEST['show'] ?? '') === 'all';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
|
@ -125,7 +125,7 @@ abstract class BaseNotifications extends BaseModule
|
||||||
$tabs = self::getTabs();
|
$tabs = self::getTabs();
|
||||||
|
|
||||||
// Set the pager
|
// 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');
|
$notif_tpl = Renderer::getMarkupTemplate('notifications.tpl');
|
||||||
return Renderer::replaceMacros($notif_tpl, [
|
return Renderer::replaceMacros($notif_tpl, [
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Introductions extends BaseNotifications
|
||||||
$id = (int)DI::args()->get(2, 0);
|
$id = (int)DI::args()->get(2, 0);
|
||||||
$all = DI::args()->get(2) == 'all';
|
$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 [
|
return [
|
||||||
'header' => DI::l10n()->t('Notifications'),
|
'header' => DI::l10n()->t('Notifications'),
|
||||||
|
|
|
@ -29,29 +29,29 @@ class Notifications extends BaseNotifications
|
||||||
// Get the network notifications
|
// Get the network notifications
|
||||||
if ((DI::args()->get(1) == 'network')) {
|
if ((DI::args()->get(1) == 'network')) {
|
||||||
$notif_header = DI::l10n()->t('Network Notifications');
|
$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
|
// Get the system notifications
|
||||||
} elseif ((DI::args()->get(1) == 'system')) {
|
} elseif ((DI::args()->get(1) == 'system')) {
|
||||||
$notif_header = DI::l10n()->t('System Notifications');
|
$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
|
// Get the personal notifications
|
||||||
} elseif ((DI::args()->get(1) == 'personal')) {
|
} elseif ((DI::args()->get(1) == 'personal')) {
|
||||||
$notif_header = DI::l10n()->t('Personal Notifications');
|
$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
|
// Get the home notifications
|
||||||
} elseif ((DI::args()->get(1) == 'home')) {
|
} elseif ((DI::args()->get(1) == 'home')) {
|
||||||
$notif_header = DI::l10n()->t('Home Notifications');
|
$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
|
// fallback - redirect to main page
|
||||||
} else {
|
} else {
|
||||||
DI::baseUrl()->redirect('notifications');
|
DI::baseUrl()->redirect('notifications');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the pager
|
// 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)
|
// Add additional informations (needed for json output)
|
||||||
$notifs['items_page'] = $pager->getItemsPerPage();
|
$notifs['items_page'] = $pager->getItemsPerPage();
|
||||||
|
@ -109,8 +109,8 @@ class Notifications extends BaseNotifications
|
||||||
}
|
}
|
||||||
|
|
||||||
$notif_show_lnk = [
|
$notif_show_lnk = [
|
||||||
'href' => (self::$show ? 'notifications/' . $notifs['ident'] : 'notifications/' . $notifs['ident'] . '?show=all'),
|
'href' => (self::$showAll ? 'notifications/' . $notifs['ident'] : 'notifications/' . $notifs['ident'] . '?show=all'),
|
||||||
'text' => (self::$show ? DI::l10n()->t('Show unread') : DI::l10n()->t('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);
|
return self::printContent($notif_header, $notif_content, $notif_nocontent, $notif_show_lnk);
|
||||||
|
|
Loading…
Reference in a new issue