proper allow back/forth on blocks
This commit is contained in:
parent
ab6a4f57d3
commit
d4ce764d77
@ -29,12 +29,12 @@ class RoundStats {
|
||||
/**
|
||||
* Get next block for round stats
|
||||
**/
|
||||
public function getNextBlockDesc($iHeight=0) {
|
||||
public function getNextBlock($iHeight=0) {
|
||||
$stmt = $this->mysqli->prepare("
|
||||
SELECT height
|
||||
FROM $this->tableBlocks
|
||||
WHERE height < ?
|
||||
ORDER BY height DESC
|
||||
WHERE height > ?
|
||||
ORDER BY height ASC
|
||||
LIMIT 1");
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iHeight) && $stmt->execute() && $result = $stmt->get_result())
|
||||
return $result->fetch_object()->height;
|
||||
@ -44,12 +44,12 @@ class RoundStats {
|
||||
/**
|
||||
* Get prev block for round stats
|
||||
**/
|
||||
public function getNextBlockAsc($iHeight=0) {
|
||||
public function getPreviousBlock($iHeight=0) {
|
||||
$stmt = $this->mysqli->prepare("
|
||||
SELECT height
|
||||
FROM $this->tableBlocks
|
||||
WHERE height > ?
|
||||
ORDER BY height ASC
|
||||
WHERE height < ?
|
||||
ORDER BY height DESC
|
||||
LIMIT 1");
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iHeight) && $stmt->execute() && $result = $stmt->get_result())
|
||||
return $result->fetch_object()->height;
|
||||
|
||||
@ -7,19 +7,19 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
||||
$debug->append('No cached version available, fetching from backend', 3);
|
||||
|
||||
if (@$_REQUEST['next'] && !empty($_REQUEST['height'])) {
|
||||
$_REQUEST['height'] = $roundstats->getNextBlockDesc($_REQUEST['height']);
|
||||
$iKey = $roundstats->getNextBlock($_REQUEST['height']);
|
||||
} else if (@$_REQUEST['prev'] && !empty($_REQUEST['height'])) {
|
||||
$_REQUEST['height'] = $roundstats->getNextBlockAsc($_REQUEST['height']);
|
||||
}
|
||||
$iKey = $roundstats->getPreviousBlock($_REQUEST['height']);
|
||||
} else {
|
||||
|
||||
if (empty($_REQUEST['height'])) {
|
||||
$iBlock = $block->getLast();
|
||||
$iKey = $iBlock['height'];
|
||||
$_REQUEST['height'] = $iKey;
|
||||
} else {
|
||||
$iKey = $_REQUEST['height'];
|
||||
}
|
||||
|
||||
}
|
||||
echo $iKey;
|
||||
$aDetailsForBlockHeight = $roundstats->getDetailsForBlockHeight($iKey, $user->isAdmin($_SESSION['USERDATA']['id']));
|
||||
$aRoundShareStats = $roundstats->getRoundStatsForAccounts($iKey, $user->isAdmin($_SESSION['USERDATA']['id']));
|
||||
|
||||
|
||||
@ -47,18 +47,18 @@
|
||||
</tbody>
|
||||
</table></td>
|
||||
<td class="right">
|
||||
<form action="{$smarty.server.PHP_SELF}" method="POST" id='tx_key'>
|
||||
<form action="{$smarty.server.PHP_SELF}" method="POST" id='height'>
|
||||
<input type="hidden" name="page" value="{$smarty.request.page}">
|
||||
<input type="hidden" name="action" value="{$smarty.request.action}">
|
||||
<input type="text" class="pin" name="tx_key" value="{$smarty.request.tx_key|default:"%"}">
|
||||
<input type="text" class="pin" name="height" value="{$smarty.request.height|default:"%"}">
|
||||
<input type="submit" class="submit small" value="Search">
|
||||
</form></td></tr>
|
||||
<tr>
|
||||
<td class="left">
|
||||
<a href="{$smarty.server.PHP_SELF}?page={$smarty.request.page}&action={$smarty.request.action}&tx_key={$BLOCKDETAILS.height}&prev=1"><img src="{$PATH}/images/prev.png" /></a>
|
||||
<a href="{$smarty.server.PHP_SELF}?page={$smarty.request.page}&action={$smarty.request.action}&height={$BLOCKDETAILS.height}&prev=1"><img src="{$PATH}/images/prev.png" /></a>
|
||||
</td>
|
||||
<td class="right">
|
||||
<a href="{$smarty.server.PHP_SELF}?page={$smarty.request.page}&action={$smarty.request.action}&tx_key={$BLOCKDETAILS.height}&next=1"><img src="{$PATH}/images/next.png" /></a>
|
||||
<a href="{$smarty.server.PHP_SELF}?page={$smarty.request.page}&action={$smarty.request.action}&height={$BLOCKDETAILS.height}&next=1"><img src="{$PATH}/images/next.png" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user