Exemplo n.º 1
0
 /**
  * Generates information about transaction amount.
  *
  * @param object $item
  * @param Crowdfunding\Amount $amount
  * @param Crowdfunding\Currencies $currencies
  *
  * @return string
  */
 public static function transactionAmount($item, $amount, $currencies)
 {
     $item->txn_amount = floatval($item->txn_amount);
     $item->fee = floatval($item->fee);
     $currency = null;
     if ($currencies instanceof Crowdfunding\Currencies) {
         $currency = $currencies->getCurrencyByCode($item->txn_currency);
     }
     if ($currency instanceof Crowdfunding\Currency) {
         $amount->setCurrency($currency);
         $output = $amount->setValue($item->txn_amount)->formatCurrency();
     } else {
         $output = $item->txn_amount;
     }
     if (!empty($item->fee)) {
         $fee = $currency instanceof Crowdfunding\Currency ? $amount->setValue($item->fee)->formatCurrency() : $item->fee;
         // Prepare project owner amount.
         $projectOwnerAmount = round($item->txn_amount - $item->fee, 2);
         $projectOwnerAmount = !empty($currency) ? $amount->setValue($projectOwnerAmount)->formatCurrency() : $projectOwnerAmount;
         $title = JText::sprintf("COM_CROWDFUNDING_TRANSACTION_AMOUNT_FEE", $projectOwnerAmount, $fee);
         $output .= '<a class="btn btn-micro hasTooltip" href="javascript:void(0);" title="' . addslashes($title) . '">';
         $output .= '<i class="icon-question"></i>';
         $output .= '</a>';
     }
     return $output;
 }