File: /www/exchange2/exchange/admin/validator/report.php
<?php
function showErrorLink(ValidationData $object){
if(!$object->hasErrors()){
return;
}
return '<a href="#" title="'.addslashes(print_r($object->getErrors(),1)).'">Errors</a>';
}
function showSourceLink(Transaction $object){
return '<a href="#" title="'.addslashes($object->getSource()).'">Source</a>';
}
$lastTransaction = null;
?>
<style>
.transactionStart td{
border-top: 1px solid #ababab !important;
}
</style>
<h2>Results</h2>
<?php if($parser->hasErrors()):?>
<div class="alert alert-warning" role="alert"><strong>File error!</strong><pre><?php echo print_r($parser->getErrors(),1);?>
</pre></div>
<?php endif;?>
<table class="table table-striped">
<caption>Transactions</caption>
<tr>
<th>#</th>
<th width="20%">Amount</th>
<th>Currency</th>
<th>Batch</th>
<th>Raw</th>
<th>Errors</th>
</tr>
<?php foreach($parser->getTransactions() as $transaction): ?>
<tr class="<?php echo $transaction->hasErrors()?'danger':'success'?> <?php echo ($lastTransaction && $lastTransaction->getBatchNumber()!=$transaction->getBatchNumber())?'transactionStart':''?>">
<td><?php echo $transaction->getTransactionId()?></td>
<td><?php echo sprintf("%01.2f",$transaction->getAmount())?></td>
<td><?php echo $transaction->getCurrency()?></td>
<td><?php echo $transaction->getBatchNumber()?$transaction->getBatchNumber():'none'?></td>
<td><?php echo showSourceLink($transaction)?> </td>
<td><?php echo showErrorLink($transaction)?> </td>
</tr>
<?php
$lastTransaction = $transaction;
endforeach;
?>
</table>
<table class="table table-striped">
<caption>Batches</caption>
<tr>
<th>#</th>
<th>Count transactions</th>
<th>Errors</th>
</tr>
<?php foreach($parser->getBatches() as $batchId =>$batch): ?>
<tr class="<?php echo $batch->hasErrors()?'danger':'success'?>">
<td><?php echo $batchId?></td>
<td><?php echo count($batch->getTransactions())?></td>
<td><?php echo showErrorLink($batch)?> </td>
</tr>
<?php endforeach;?>
</table>