You are here

function uc_product_class_default in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_product/uc_product.module \uc_product_class_default()
  2. 7.3 uc_product/uc_product.admin.inc \uc_product_class_default()

Displays a list of product classes.

1 string reference to 'uc_product_class_default'
uc_product_menu in uc_product/uc_product.module
Implements hook_menu().

File

uc_product/uc_product.admin.inc, line 43
Product administration menu items.

Code

function uc_product_class_default() {
  $classes = uc_product_class_load();
  $header = array(
    t('Class ID'),
    t('Name'),
    t('Description'),
    t('Operations'),
  );
  $rows = array();
  foreach ($classes as $class) {
    $ops = array(
      l(t('edit'), 'admin/store/products/classes/' . $class->pcid . '/edit'),
    );
    if (empty($class->locked)) {
      $ops[] = l(t('delete'), 'admin/store/products/classes/' . $class->pcid . '/delete');
    }
    $rows[] = array(
      check_plain($class->pcid),
      check_plain($class->name),
      filter_xss_admin($class->description),
      implode(' ', $ops),
    );
  }
  if (count($rows) == 0) {
    $rows[] = array(
      array(
        'data' => t('No product classes have been defined yet.'),
        'colspan' => '5',
      ),
    );
  }
  $output = theme('table', $header, $rows);
  $output .= '<h2>' . t('Add a class') . '</h2>';
  $output .= drupal_get_form('uc_product_class_form');
  return $output;
}