You are here

function theme_pay_activity_list in Pay 7

Same name and namespace in other branches
  1. 6 theme/pay.theme.inc \theme_pay_activity_list()

Theme function for default money format.

1 theme call to theme_pay_activity_list()
template_preprocess_pay_transaction in theme/pay.theme.inc
A preprocess function for theme('pay_transaction').

File

theme/pay.theme.inc, line 184
Theme hooks and callbacks for the Payment API.

Code

function theme_pay_activity_list($variables) {
  $activity_list = $variables['activity'];
  $hdrs = array(
    t('Date'),
    t('User'),
    t('Method'),
    t('Total'),
    t('Balance'),
    t('Comment'),
  );
  $rows = array();
  foreach ($activity_list as $activity) {
    $account = $activity
      ->user();
    $currency = $activity
      ->pay_transaction()->currency;
    if ($activity->result) {
      $comment = t('Success');
    }
    else {
      $comment = t('Failed');
    }
    $row = array(
      format_date($activity->timestamp, 'short'),
      $account->uid ? l($account->name, 'user/' . $account->uid) : '-',
      $activity
        ->pay_method()
        ->title(),
      theme('pay_money', array(
        'value' => $activity->total,
        'currency' => $currency,
      )),
      theme('pay_money', array(
        'value' => $activity
          ->balance(),
        'currency' => $currency,
      )),
      $comment,
    );
    $rows[] = $row;
  }
  return theme('table', array(
    'header' => $hdrs,
    'rows' => $rows,
  ));
}