From 429ef8043006c1d81f6d9f190d5596a04a59975d Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 1 Mar 2014 22:27:59 +0100 Subject: [PATCH] [FIX] Pagination for Block Stats --- .../include/pages/statistics/blocks.inc.php | 27 ++++++++++--------- .../statistics/blocks/block_shares_graph.tpl | 2 ++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/public/include/pages/statistics/blocks.inc.php b/public/include/pages/statistics/blocks.inc.php index ccffdb3a..90ea8425 100644 --- a/public/include/pages/statistics/blocks.inc.php +++ b/public/include/pages/statistics/blocks.inc.php @@ -13,18 +13,21 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { } $iHeight = 0; - if (@$_REQUEST['next'] && !empty($_REQUEST['height']) && is_numeric($_REQUEST['height'])) { - $iHeight = @$roundstats->getNextBlockForStats($_REQUEST['height'], $iLimit); - if (!$iHeight) { - $iBlock = $block->getLast(); - $iHeight = $iBlock['height']; - } - } else if (@$_REQUEST['prev'] && !empty($_REQUEST['height']) && is_numeric($_REQUEST['height'])) { - $iHeight = $_REQUEST['height']; + if (@$_REQUEST['next'] && !empty($_REQUEST['height'])) { + $iHeight = @$roundstats->getNextBlock($_REQUEST['height']); + if (!$iHeight) { + $iBlock = $block->getLast(); + $iHeight = $iBlock['height']; + } + } else if (@$_REQUEST['prev'] && !empty($_REQUEST['height'])) { + $iHeight = $roundstats->getPreviousBlock($_REQUEST['height']); } else if (empty($_REQUEST['height'])) { - $aBlock = $block->getLast(); - $iHeight = $aBlock['height']; + $iBlock = $block->getLast(); + $iHeight = $iBlock['height']; + } else { + $iHeight = $_REQUEST['height']; } + $_REQUEST['height'] = $iHeight; $test = false; if (@$_REQUEST['test'] && $user->isAdmin($_SESSION['USERDATA']['id'])) { @@ -48,8 +51,8 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { } } } else if ($config['payout_system'] == 'prop' || $config['payout_system'] == 'pps') { - if ($setting->getValue('statistics_show_block_average') && !$test) { - foreach($aBlocksFoundData as $key => $aData) { + if ($setting->getValue('statistics_show_block_average') && !$test) { + foreach($aBlocksFoundData as $key => $aData) { $aBlocksFoundData[$key]['block_avg'] = round($block->getAvgBlockShares($aData['height'], $config['pplns']['blockavg']['blockcount'])); $use_average = true; } diff --git a/public/templates/bootstrap/statistics/blocks/block_shares_graph.tpl b/public/templates/bootstrap/statistics/blocks/block_shares_graph.tpl index 611b859a..9c768fb4 100644 --- a/public/templates/bootstrap/statistics/blocks/block_shares_graph.tpl +++ b/public/templates/bootstrap/statistics/blocks/block_shares_graph.tpl @@ -44,6 +44,8 @@ $(function () {
+ +