pool/web/yaamp/modules/site/results/found_results.php
Tanguy Pruvot 6d52259c11 history: prefer block algo field in case of algo change
will not be used in normal cases, but you can temporary display 2 coin algos with that :

in web/yaamp/modules/site/results/found_results.php
@@ -19,6 +19,10 @@ WriteBoxHeader("Last $count Blocks ($algo)");
 $criteria->condition .= " AND IFNULL(coin.visible,1)=1"; // ifnull for rental
+if($algo == 'phi2') {
+       $criteria->condition .= " AND t.algo IN(:algo,'phi')";
+       $criteria->params = array(':algo'=>$algo);
+} else
 if($algo != 'all') {
2018-06-11 03:56:34 +02:00

127 lines
3.8 KiB
PHP

<?php
function WriteBoxHeader($title)
{
echo "<div class='main-left-box'>";
echo "<div class='main-left-title'>$title</div>";
echo "<div class='main-left-inner'>";
}
$showrental = (bool) YAAMP_RENTAL;
$algo = user()->getState('yaamp-algo');
$count = getparam('count');
$count = $count? $count: 50;
WriteBoxHeader("Last $count Blocks ($algo)");
$criteria = new CDbCriteria();
$criteria->condition = "t.category NOT IN ('stake','generated')";
$criteria->condition .= " AND IFNULL(coin.visible,1)=1"; // ifnull for rental
if($algo != 'all') {
$criteria->condition .= " AND t.algo=:algo";
$criteria->params = array(':algo'=>$algo);
}
$criteria->limit = $count;
$criteria->order = 't.time DESC';
$db_blocks = getdbolistWith('db_blocks', 'coin', $criteria);
echo <<<EOT
<style type="text/css">
span.block { padding: 2px; display: inline-block; text-align: center; min-width: 75px; border-radius: 3px; }
span.block.new { color: white; background-color: #ad4ef0; }
span.block.orphan { color: white; background-color: #d9534f; }
span.block.immature { color: white; background-color: #f0ad4e; }
span.block.confirmed { color: white; background-color: #5cb85c; }
b.row a { font-size: 10pt; }
.ssrow td.row { font-size: .8em; }
td.right { text-align: right; }
</style>
<table class="dataGrid2">
<thead>
<tr>
<td></td>
<th>Name</th>
<th align="right">Amount</th>
<th align="right">Difficulty</th>
<th align="right">Block</th>
<th align="right">Time</th>
<th align="right">Status</th>
</tr>
</thead>
EOT;
foreach($db_blocks as $db_block)
{
$d = datetoa2($db_block->time);
if(!$db_block->coin_id)
{
if (!$showrental)
continue;
$reward = bitcoinvaluetoa($db_block->amount);
echo '<tr class="ssrow">';
echo '<td width="18px"><img width="16px" src="/images/btc.png"/></td>';
echo '<td class="row"><b>Rental</b> ('.$db_block->algo.')</td>';
echo '<td class="row right"><b>'.$reward.' BTC</b></td>';
echo '<td class="row right"></td>';
echo '<td class="row right"></td>';
echo '<td class="row right">'.$d.' ago</td>';
echo '<td class="row right">';
echo '<span class="block confirmed">Confirmed</span>';
echo '</td>';
echo '</tr>';
continue;
}
$reward = round($db_block->amount, 3);
$coin = $db_block->coin ? $db_block->coin : getdbo('db_coins', $db_block->coin_id);
$difficulty = Itoa2($db_block->difficulty, 3);
$height = number_format($db_block->height, 0, '.', ' ');
$link = $coin->createExplorerLink($coin->name, array('hash'=>$db_block->blockhash));
$flags = $db_block->segwit ? '&nbsp;<img src="/images/ui/segwit.png" height="8px" valign="center" title="segwit"/>' : '';
echo '<tr class="ssrow">';
echo '<td width="18px"><img width="16px" src="'.$coin->image.'"></td>';
echo '<td class="row"><b class="row">'.$link.'</b> ('.$db_block->algo.')'.$flags.'</td>';
echo '<td class="row right"><b>'.$reward.' '.$coin->symbol_show.'</b></td>';
echo '<td class="row right" title="found '.$db_block->difficulty_user.'">'.$difficulty.'</td>';
echo '<td class="row right">'.$height.'</td>';
echo '<td class="row right">'.$d.' ago</td>';
echo '<td class="row right">';
if($db_block->category == 'orphan')
echo '<span class="block orphan">Orphan</span>';
else if($db_block->category == 'immature') {
$eta = '';
if ($coin->block_time && $coin->mature_blocks) {
$t = (int) ($coin->mature_blocks - $db_block->confirmations) * $coin->block_time;
$eta = "ETA: ".sprintf('%dh %02dmn', ($t/3600), ($t/60)%60);
}
echo '<span class="block immature" title="'.$eta.'">Immature ('.$db_block->confirmations.')</span>';
}
else if($db_block->category == 'generate')
echo '<span class="block confirmed">Confirmed</span>';
else if($db_block->category == 'new')
echo '<span class="block new">New</span>';
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo "<br></div></div><br>";