added all query parameter for address transactions
This commit is contained in:
parent
c9c7197b0e
commit
d4cb27dca7
2 changed files with 18 additions and 8 deletions
|
@ -443,15 +443,24 @@ class MainController extends AppController {
|
|||
$stmt = $conn->execute('SELECT COUNT(TransactionId) AS Total FROM TransactionsAddresses WHERE AddressId = ?', [$addressId]);
|
||||
$count = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$numTransactions = $count->Total;
|
||||
$numPages = ceil($numTransactions / $pageLimit);
|
||||
if ($page < 1) {
|
||||
$all = $this->request->query('all');
|
||||
if ($all === 'true') {
|
||||
$offset = 0;
|
||||
$pageLimit = $numTransactions;
|
||||
$numPages = 1;
|
||||
$page = 1;
|
||||
}
|
||||
if ($page > $numPages) {
|
||||
$page = $numPages;
|
||||
} else {
|
||||
$numPages = ceil($numTransactions / $pageLimit);
|
||||
if ($page < 1) {
|
||||
$page = 1;
|
||||
}
|
||||
if ($page > $numPages) {
|
||||
$page = $numPages;
|
||||
}
|
||||
|
||||
$offset = ($page - 1) * $pageLimit;
|
||||
}
|
||||
|
||||
$offset = ($page - 1) * $pageLimit;
|
||||
$stmt = $conn->execute('SELECT A.TotalReceived, A.TotalSent FROM Addresses A WHERE A.Id = ?', [$address->Id]);
|
||||
$totals = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
|
||||
|
@ -481,6 +490,7 @@ class MainController extends AppController {
|
|||
$this->set('numTransactions', $numTransactions);
|
||||
$this->set('numPages', $numPages);
|
||||
$this->set('currentPage', $page);
|
||||
$this->set('pageLimit', $pageLimit);
|
||||
}
|
||||
|
||||
public function qr($data = null) {
|
||||
|
|
|
@ -150,9 +150,9 @@
|
|||
<h3>Recent Transactions</h3>
|
||||
<div class="results-meta">
|
||||
<?php if ($numTransactions > 0):
|
||||
$begin = ($currentPage - 1) * 50 + 1;
|
||||
$begin = ($currentPage - 1) * $pageLimit + 1;
|
||||
?>
|
||||
Showing <?php echo number_format($begin, 0, '', ',') ?> - <?php echo number_format(min($numTransactions, ($begin + 50) - 1), 0, '', ','); ?> of <?php echo number_format($numTransactions, 0, '', ','); ?> result<?php echo $numTransactions == 1 ? '' : 's' ?>
|
||||
Showing <?php echo number_format($begin, 0, '', ',') ?> - <?php echo number_format(min($numTransactions, ($begin + $pageLimit) - 1), 0, '', ','); ?> of <?php echo number_format($numTransactions, 0, '', ','); ?> result<?php echo $numTransactions == 1 ? '' : 's' ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue