You are here

function theme_currency_result in Currency 6

Same name and namespace in other branches
  1. 7 currency.module \theme_currency_result()

Theme implementation for currency exchange result.

1 theme call to theme_currency_result()
currency_form in ./currency.module
Currency exchange form.

File

./currency.module, line 180
This module provides currency exchange rates.

Code

function theme_currency_result($currency_from, $currency_to, $amount) {
  $output = '';
  $url = 'http://finance.yahoo.com/q?s=' . $currency_from . $currency_to . '=X';
  $ret = currency_api_convert($currency_from, $currency_to, $amount);
  if ($ret['status'] == FALSE) {
    $output .= t('Currency exchange error: ') . $ret['message'];
  }
  else {
    $output .= '<p class="result">';
    $output .= t('@amount @from = @value @to', array(
      '@amount' => $amount,
      '@from' => currency_api_get_desc($currency_from),
      '@value' => $ret['value'],
      '@to' => currency_api_get_desc($currency_to),
    ));
    $output .= '</p>';
    $output .= '<p class="detailed-history">' . l(t('Detailed history and chart'), $url) . '</p>';
  }
  $output = '<div class="currency-result">' . $output . '</div>';
  return $output;
}