You are here

function contact_category_list in Contact 6.2

Same name and namespace in other branches
  1. 7.2 contact.admin.inc \contact_category_list()

Categories/list tab.

1 string reference to 'contact_category_list'
contact_menu in ./contact.module
Implements hook_menu().

File

./contact.admin.inc, line 11
Admin page callbacks for the contact module.

Code

function contact_category_list() {
  $header = array(
    t('Category'),
    t('Recipients'),
    t('Selected'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $rows = array();

  // Get all the contact categories from the database.
  $query = db_query('SELECT cid, category, recipients, selected FROM {contact} ORDER BY weight, category');

  // Loop through the categories and add them to the table.
  while ($category = db_fetch_object($query)) {
    $rows[] = array(
      check_plain($category->category),
      check_plain($category->recipients),
      $category->selected ? t('Yes') : t('No'),
      l(t('Edit'), 'admin/build/contact/edit/' . $category->cid),
      l(t('Delete'), 'admin/build/contact/delete/' . $category->cid),
    );
  }
  if (!$rows) {
    $rows[] = array(
      array(
        'data' => t('No categories available.'),
        'colspan' => 5,
      ),
    );
  }
  return theme('table', $header, $rows);
}