function mass_contact_admin_categories in Mass Contact 7
Same name and namespace in other branches
- 5.2 mass_contact.module \mass_contact_admin_categories()
- 5 mass_contact.module \mass_contact_admin_categories()
- 6 mass_contact.module \mass_contact_admin_categories()
Displays a list of all existing categories.
Return value
array The themed page listing all current categories.
1 string reference to 'mass_contact_admin_categories'
- mass_contact_menu in ./
mass_contact.module - Implements hook_menu().
File
- ./
mass_contact.admin.inc, line 14 - The administrative settings pages.
Code
function mass_contact_admin_categories() {
$rows = array();
$results = db_select('mass_contact', 'mc')
->fields('mc', array(
'cid',
'category',
'recipients',
'selected',
))
->orderBy('category', 'ASC')
->execute();
foreach ($results as $category) {
// Prepare the string for the Recipients column.
ctools_include('plugins');
// Get the information about all plugins that implemnent this type of
// plugin.
$plugins = ctools_get_plugins('mass_contact', 'grouping_method');
$recipients = array();
foreach ($plugins as $plugin) {
// Get the admin categories function name for this particular
// implementation.
$function = ctools_plugin_get_function($plugin, 'mass_contact_categories');
// Call the plugin function to get the list of categories.
$recipients[] = $function(unserialize($category->recipients));
}
$rows[] = array(
check_plain($category->category),
implode('<br/>', array_filter($recipients)),
$category->selected ? t('Yes') : t('No'),
l(t('edit'), 'admin/config/system/mass_contact/edit/' . $category->cid),
l(t('delete'), 'admin/config/system/mass_contact/delete/' . $category->cid),
);
}
$header = array(
t('Category'),
t('Recipients'),
t('Selected'),
array(
'data' => t('Operations'),
'colspan' => 2,
),
);
return theme('table', array(
'header' => $header,
'rows' => $rows,
));
}