diff --git a/modules/contact/contact.admin.inc b/modules/contact/contact.admin.inc index e1b134ae70969dce31240894c0678b7cb7d6f299..f5ffe2e064aa4e5d84873ebd67606d8a856b24bc 100644 --- a/modules/contact/contact.admin.inc +++ b/modules/contact/contact.admin.inc @@ -10,12 +10,28 @@ * Categories/list tab. */ function contact_admin_categories() { - $result = db_query('SELECT cid, category, recipients, selected FROM {contact} ORDER BY weight, category'); $rows = array(); + + $header = array(t('Category'), t('Recipients'), t('Selected'), array('data' => t('Operations'), 'colspan' => 2)); + + // Get all the contact categories from the database. + $result = 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($result)) { - $rows[] = array($category->category, $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)); + $rows[] = array( + $category->category, + $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 no categories were found, let the user know. + if (empty($rows)) { + $rows[] = array(array('data' => t('No categories available.'), 'colspan' => 5)); } - $header = array(t('Category'), t('Recipients'), t('Selected'), array('data' => t('Operations'), 'colspan' => 2)); return theme('table', $header, $rows); }