function mailing_list_lists in Mailing List 6
Same name and namespace in other branches
- 7 mailing_list.admin.inc \mailing_list_lists()
Menu callback; displays all mailing lists in a table.
1 string reference to 'mailing_list_lists'
- mailing_list_menu in ./
mailing_list.module - Implementation of hook_menu().
File
- ./
mailing_list.admin.inc, line 11 - Mailing list admin UI.
Code
function mailing_list_lists() {
$header = array(
array(
'data' => t('Name'),
'field' => 'name',
'sort' => 'asc',
),
array(
'data' => t('Operations'),
'colspan' => '5',
),
);
$query = "SELECT * FROM {mailing_list}";
$result = db_query($query);
$rows = array();
$destination = drupal_get_destination();
while ($list = db_fetch_object($result)) {
$row = array(
l(check_plain($list->name), "admin/build/mailing-list/{$list->mlid}"),
l(t('list e-mails'), "admin/build/mailing-list/{$list->mlid}"),
l(t('import e-mails'), "admin/build/mailing-list/{$list->mlid}/import", array(
'query' => $destination,
)),
l(t('export list'), "admin/build/mailing-list/{$list->mlid}/export", array(
'query' => $destination,
)),
l(t('rename list'), "admin/build/mailing-list/{$list->mlid}/edit", array(
'query' => $destination,
)),
l(t('delete list'), "admin/build/mailing-list/{$list->mlid}/delete", array(
'query' => $destination,
)),
);
$rows[] = $row;
}
if (empty($rows)) {
$empty_message = t('No mailing lists found.');
$rows[] = array(
array(
'data' => $empty_message,
'colspan' => 6,
),
);
}
$output = theme('table', $header, $rows);
$output .= theme('pager', NULL, 50, 0);
return $output;
}