[FIX] Pagination for Block Stats

This commit is contained in:
Sebastian Grewe 2014-03-01 22:27:59 +01:00
parent 1fa5d3b23e
commit 429ef80430
2 changed files with 17 additions and 12 deletions

View File

@ -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;
}

View File

@ -44,6 +44,8 @@ $(function () {
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-body">
<a href="{$smarty.server.SCRIPT_NAME}?page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&height={if is_array($BLOCKSFOUND) && count($BLOCKSFOUND) > ($BLOCKLIMIT - 1)}{$BLOCKSFOUND[$BLOCKLIMIT - 1].height}{/if}&prev=1"><i class="fa fa-chevron-left"></i></a>
<a href="{$smarty.server.SCRIPT_NAME}?page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&height={if is_array($BLOCKSFOUND) && count($BLOCKSFOUND) > 0}{$BLOCKSFOUND[0].height}{/if}&next=1"><i class="fa fa-chevron-right pull-right"></i></a>
<div class="flot-chart">
<div id="block-area-chart"></div>
</div>