[UPDATE] showing accounts with balance and address

This commit is contained in:
iAmShorty 2014-02-13 16:29:33 +01:00
parent 81b8b976d1
commit 224af2c9d3
2 changed files with 92 additions and 68 deletions

View File

@ -11,7 +11,16 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
$debug->append('No cached version available, fetching from backend', 3); $debug->append('No cached version available, fetching from backend', 3);
if ($bitcoin->can_connect() === true){ if ($bitcoin->can_connect() === true){
$dBalance = $bitcoin->getbalance(); $dBalance = $bitcoin->getbalance();
$dAddresses = $bitcoin->getaddressesbyaccount('');
$dWalletAccounts = $bitcoin->listaccounts();
$dAddressCount = count($dWalletAccounts);
$dAccountAddresses = array();
foreach($dWalletAccounts as $key => $value)
{
$dAccountAddresses[$key] = $bitcoin->getaddressesbyaccount($key);
}
$aGetInfo = $bitcoin->getinfo(); $aGetInfo = $bitcoin->getinfo();
if (is_array($aGetInfo) && array_key_exists('newmint', $aGetInfo)) { if (is_array($aGetInfo) && array_key_exists('newmint', $aGetInfo)) {
$dNewmint = $aGetInfo['newmint']; $dNewmint = $aGetInfo['newmint'];
@ -38,7 +47,9 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
if (! $dColdCoins = $setting->getValue('wallet_cold_coins')) $dColdCoins = 0; if (! $dColdCoins = $setting->getValue('wallet_cold_coins')) $dColdCoins = 0;
$smarty->assign("UNCONFIRMED", $dBlocksUnconfirmedBalance); $smarty->assign("UNCONFIRMED", $dBlocksUnconfirmedBalance);
$smarty->assign("BALANCE", $dBalance); $smarty->assign("BALANCE", $dBalance);
$smarty->assign("ADDRESSES", $dAddresses); $smarty->assign("ADDRESSCOUNT", $dAddressCount);
$smarty->assign("ACCOUNTADDRESSES", $dAccountAddresses);
$smarty->assign("ACCOUNTS", $dWalletAccounts);
$smarty->assign("COLDCOINS", $dColdCoins); $smarty->assign("COLDCOINS", $dColdCoins);
$smarty->assign("LOCKED", $dLockedBalance); $smarty->assign("LOCKED", $dLockedBalance);
$smarty->assign("NEWMINT", $dNewmint); $smarty->assign("NEWMINT", $dNewmint);

View File

@ -1,3 +1,6 @@
<article class="module width_full">
<header><h3>Wallet Information - Number of Accounts in Wallet: {$ADDRESSCOUNT|default:"0"}</h3></header>
<article class="module width_quarter"> <article class="module width_quarter">
<header><h3>Balance Summary</h3></header> <header><h3>Balance Summary</h3></header>
<table width="25%" class="tablesorter" cellspacing="0"> <table width="25%" class="tablesorter" cellspacing="0">
@ -27,7 +30,7 @@
</article> </article>
<article class="module width_3_quarter"> <article class="module width_3_quarter">
<header><h3>Wallet Information</h3></header> <header><h3>Network Information</h3></header>
<table class="tablesorter" cellspacing="0"> <table class="tablesorter" cellspacing="0">
<thead> <thead>
<th align="center">Version</th> <th align="center">Version</th>
@ -46,31 +49,41 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</article>
</article> </article>
<article class="width_half"> {foreach key=NAME item=VALUE from=$ACCOUNTS}
<!-- <article class="module width_half">
needed for showing below balance summary, because those modules are pretty dumb and auto-align <header><h3>Account: {$NAME|default:"Default"}</h3></header>
--> <article class="module width_half">
<br /><br /><br /><br /><br /><br /> <header><h3>Balance Info</h3></header>
</article> <table width="40%" class="tablesorter" cellspacing="0">
<article class="module width_quarter">
<header><h3>Addresses assigned to Default Wallet</h3></header>
<table class="tablesorter" cellspacing="0">
<thead>
<th align="center">#</th>
<th align="left">Address</th>
</thead>
<tbody>
{assign var=rank value=1}
{section address $ADDRESSES}
<tr> <tr>
<td align="center">{$rank++}</td> <td align="left">Balance</td>
<td align="left" style="padding-right: 25px;">{$ADDRESSES[address]}</td> <td align="left">{$VALUE|number_format:"8"}</td>
</tr> </tr>
{/section} </table>
</article>
{foreach key=ACCOUNT item=ADDRESS from=$ACCOUNTADDRESSES}
{if $ACCOUNT == $NAME}
<article class="module width_3_quarter">
<header><h3>Addresses assigned to Account {$ACCOUNT|default:"Default"}</h3></header>
<table class="tablesorter" cellspacing="0">
<tbody>
{foreach from=$ACCOUNTADDRESSES[$ACCOUNT] key=ACCOUNT1 item=ADDRESS1}
<tr>
<td align="left" style="padding-right: 25px;">{$ADDRESS1}</td>
</tr>
{/foreach}
</tbody> </tbody>
</table> </table>
</article> </article>
{/if}
{/foreach}
</article>
{/foreach}