Merge pull request #57 from TheSerapher/block-stats

adding block status page for past 30 blocks, no graphs yet
This commit is contained in:
Sebastian Grewe 2013-05-24 06:57:43 -07:00
commit 7b8aec1699
4 changed files with 27 additions and 3 deletions

View File

@ -0,0 +1,22 @@
<?php
// Make sure we are called from index.php
if (!defined('SECURITY'))
die('Hacking attempt');
// Grab the last blocks found
$iLimit = 30;
$aBlocksFoundData = $statistics->getBlocksFound($iLimit);
$aBlockData = $aBlocksFoundData[0];
// Propagate content our template
$smarty->assign("BLOCKSFOUND", $aBlocksFoundData);
$smarty->assign("BLOCKLIMIT", $iLimit);
if ($_SESSION['AUTHENTICATED']) {
$smarty->assign("CONTENT", "blocks_found.tpl");
} else {
$smarty->assign("CONTENT", "default.tpl");
}
?>

View File

@ -27,7 +27,8 @@ $aContributorsShares = $statistics->getTopContributors('shares', 15);
$aContributorsHashes = $statistics->getTopContributors('hashes', 15);
// Grab the last 10 blocks found
$aBlocksFoundData = $statistics->getBlocksFound(10);
$iLimit = 10;
$aBlocksFoundData = $statistics->getBlocksFound($iLimit);
$aBlockData = $aBlocksFoundData[0];
// Estimated time to find the next block
@ -47,6 +48,7 @@ if (!empty($aBlockData)) {
$smarty->assign("ESTTIME", $iEstTime);
$smarty->assign("TIMESINCELAST", $dTimeSinceLast);
$smarty->assign("BLOCKSFOUND", $aBlocksFoundData);
$smarty->assign("BLOCKLIMIT", $iLimit);
$smarty->assign("CONTRIBSHARES", $aContributorsShares);
$smarty->assign("CONTRIBHASHES", $aContributorsHashes);
$smarty->assign("CURRENTBLOCK", $iBlock);

View File

@ -14,7 +14,7 @@
<li><a href="{$smarty.server.PHP_SELF}?page=statistics">Statistics</a>
<ul>
<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=pool">Pool Stats</a></li>
{if $smarty.session.AUTHENTICATED}<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=block">Block Stats</a></li>{/if}
{if $smarty.session.AUTHENTICATED}<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=blocks">Block Stats</a></li>{/if}
</ul>
</li>
<li><a href="{$smarty.server.PHP_SELF}?page=gettingstarted">Getting Started</a></li>

View File

@ -1,4 +1,4 @@
{include file="global/block_header.tpl" BLOCK_HEADER="Last 10 Blocks Found" BLOCK_STYLE="clear:none;" BUTTONS=array(More)}
{include file="global/block_header.tpl" BLOCK_HEADER="Last $BLOCKLIMIT Blocks Found" BLOCK_STYLE="clear:none;" BUTTONS=array(More)}
<center>
<table class="stats_lastblocks" width="100%" style="font-size:13px;">
<thead>