You are here

function uc_taxes_admin_settings in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_taxes/uc_taxes.module \uc_taxes_admin_settings()
  2. 6.2 uc_taxes/uc_taxes.admin.inc \uc_taxes_admin_settings()

Displays a list of tax rates.

1 string reference to 'uc_taxes_admin_settings'
uc_taxes_menu in uc_taxes/uc_taxes.module
Implements hook_menu().

File

uc_taxes/uc_taxes.admin.inc, line 11
Taxes administration menu items.

Code

function uc_taxes_admin_settings() {
  $header = array(
    t('Name'),
    t('Rate'),
    t('Taxed products'),
    t('Taxed product types'),
    t('Taxed line items'),
    t('Weight'),
    array(
      'data' => t('Operations'),
      'colspan' => 4,
    ),
  );
  $rows = array();
  $options = array(
    'query' => array(
      'token' => drupal_get_token('uc_taxes_clone'),
    ),
  );
  foreach (uc_taxes_rate_load() as $rate_id => $rate) {
    $rows[] = array(
      check_plain($rate->name),
      $rate->rate * 100 . '%',
      $rate->shippable ? t('Shippable products') : t('Any product'),
      implode(', ', $rate->taxed_product_types),
      implode(', ', $rate->taxed_line_items),
      $rate->weight,
      l(t('edit'), 'admin/store/settings/taxes/' . $rate_id . '/edit'),
      l(t('conditions'), 'admin/store/settings/taxes/manage/uc_taxes_' . $rate_id),
      l(t('clone'), 'admin/store/settings/taxes/' . $rate_id . '/clone', $options),
      l(t('delete'), 'admin/store/settings/taxes/' . $rate_id . '/delete'),
    );
  }
  $build['taxes'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No rates available.'),
  );
  return $build;
}