You are here

function mass_contact_admin_categories in Mass Contact 5

Same name and namespace in other branches
  1. 5.2 mass_contact.module \mass_contact_admin_categories()
  2. 6 mass_contact.module \mass_contact_admin_categories()
  3. 7 mass_contact.admin.inc \mass_contact_admin_categories()

Categories/list tab.

1 string reference to 'mass_contact_admin_categories'
mass_contact_menu in ./mass_contact.module
Implementation of hook_menu().

File

./mass_contact.module, line 105
Enables mass contact form to selected roles.

Code

function mass_contact_admin_categories() {
  $result = db_query('SELECT cid, category, recipients, selected FROM {mass_contact}');
  $rows = array();
  while ($category = db_fetch_object($result)) {
    $rolenamesa = array();
    foreach (explode(',', $category->recipients) as $rid) {
      $namerole = db_fetch_object(db_query('SELECT name FROM {role} WHERE rid = %d', $rid));
      $rolenamesa[] = $namerole->name;
    }
    $rolenames = implode(', ', $rolenamesa);
    $rows[] = array(
      $category->category,
      $rolenames,
      $category->selected ? t('Yes') : t('No'),
      l(t('edit'), 'admin/build/mass_contact/edit/' . $category->cid),
      l(t('delete'), 'admin/build/mass_contact/delete/' . $category->cid),
    );
  }
  $header = array(
    t('Category'),
    t('Recipients'),
    t('Selected'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  return theme('table', $header, $rows);
}