You are here

function mass_contact_admin_categories in Mass Contact 6

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

Displays a list of all existing categories.

Return value

The themed page listing all current categories.

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

File

./mass_contact.module, line 410
This is the main code file for the Mass Contact module. This module enables users to contact multiple users through 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(
      check_plain($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);
}