function theme_currency_result in Currency 7
Same name and namespace in other branches
- 6 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 189 - This module provides currency exchange rates.
Code
function theme_currency_result($variables) {
$output = '';
$currency_from = $variables['currency_from'];
$currency_to = $variables['currency_to'];
$amount = $variables['amount'];
$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: @message', array(
'@message' => $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;
}