summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-02-05 19:26:21 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-02-05 19:26:21 +0000
commitbdd5fa186df4254792b79a0d2565e79876ef340f (patch)
tree1822b87063df7a34d18ec57cb12626bd03ac5500
parentf3ed3283db182dfbbf35f5db077ebce2bc368bfe (diff)
downloadbrdo-bdd5fa186df4254792b79a0d2565e79876ef340f.tar.gz
brdo-bdd5fa186df4254792b79a0d2565e79876ef340f.tar.bz2
#369653 by rszrama: Add 'No categories' message to Contact module when no categories exist.
-rw-r--r--modules/contact/contact.admin.inc22
1 files changed, 19 insertions, 3 deletions
diff --git a/modules/contact/contact.admin.inc b/modules/contact/contact.admin.inc
index e1b134ae7..f5ffe2e06 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);
}