function uc_product_class_default in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_product/uc_product.admin.inc \uc_product_class_default()
- 7.3 uc_product/uc_product.admin.inc \uc_product_class_default()
Display a list of product classes.
1 string reference to 'uc_product_class_default'
- uc_product_menu in uc_product/
uc_product.module - Implementation of hook_menu().
File
- uc_product/
uc_product.module, line 2114 - The product module for Ubercart.
Code
function uc_product_class_default() {
$result = db_query("SELECT * FROM {uc_product_classes}");
$header = array(
t('Class ID'),
t('Name'),
t('Description'),
t('Operations'),
);
$rows = array();
while ($class = db_fetch_object($result)) {
$ops = array(
l(t('edit'), 'admin/store/products/classes/' . $class->pcid . '/edit'),
l(t('delete'), 'admin/store/products/classes/' . $class->pcid . '/delete'),
);
$rows[] = array(
$class->pcid,
$class->name,
$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;
}