function advpoll_electoral_list_page in Advanced Poll 6.3
Same name and namespace in other branches
- 5 advpoll.module \advpoll_electoral_list_page()
- 6 advpoll.pages.inc \advpoll_electoral_list_page()
- 6.2 advpoll.pages.inc \advpoll_electoral_list_page()
- 7.3 includes/advpoll.pages.inc \advpoll_electoral_list_page()
- 7 includes/advpoll.pages.inc \advpoll_electoral_list_page()
- 7.2 includes/advpoll.pages.inc \advpoll_electoral_list_page()
Display the electoral list page.
1 string reference to 'advpoll_electoral_list_page'
- advpoll_menu in ./
advpoll.module - Implementation of hook_menu().
File
- ./
advpoll.pages.inc, line 28 - Page callbacks for the advpoll module.
Code
function advpoll_electoral_list_page($node) {
drupal_set_title(check_plain($node->title));
$output = '';
if (user_access('administer polls')) {
$output .= drupal_get_form('advpoll_electoral_list_form', $node->nid);
}
$output .= '<p>' . t('This table lists all the eligible voters for this poll.') . '</p>';
$header[] = array(
'data' => t('Voter'),
'field' => 'u.name',
);
$result = pager_query("SELECT u.uid, u.name FROM {advpoll_electoral_list} el LEFT JOIN {users} u ON el.uid = u.uid WHERE el.nid = %d" . tablesort_sql($header), 20, 0, NULL, $node->nid);
$table_rows = array();
while ($voter = db_fetch_object($result)) {
$row = array(
theme('username', $voter),
);
if (user_access('administer polls')) {
$row[] = l(t('remove'), 'node/' . $node->nid . '/remove/' . $voter->uid);
}
$table_rows[] = $row;
}
$output .= theme('table', $header, $table_rows);
$output .= theme('pager', NULL, 20, 0);
print theme('page', $output);
}