* Menu callback to provide a simple list of all polls available.
*/
functionpoll_page(){
// List all polls.
$sql="SELECT n.nid, n.title, p.active, n.created, SUM(c.chvotes) AS votes FROM {node} n INNER JOIN {poll} p ON n.nid = p.nid INNER JOIN {poll_choices} c ON n.nid = c.nid WHERE n.status = 1 GROUP BY n.nid, n.title, p.active, n.created ORDER BY n.created DESC";
// Count all polls for the pager.
$count_sql='SELECT COUNT(*) FROM {node} n INNER JOIN {poll} p ON n.nid = p.nid WHERE n.status = 1';
* Creates a simple teaser that lists all the choices.
*
...
...
@@ -624,37 +608,6 @@ function poll_cancel($form, &$form_state) {
db_query("UPDATE {poll_choices} SET chvotes = chvotes - 1 WHERE nid = %d AND chorder = %d",$node->nid,$node->vote);
}
/**
* Callback for the 'results' tab for polls you can vote on
*/
functionpoll_results($node){
drupal_set_title(check_plain($node->title));
$node->show_results=TRUE;
returnnode_show($node,0);
}
/**
* Callback for the 'votes' tab for polls you can see other votes on
*/
functionpoll_votes($node){
drupal_set_title(check_plain($node->title));
$output=t('This table lists all the recorded votes for this poll. If anonymous users are allowed to vote, they will be identified by the IP address of the computer they used when they voted.');
$result=pager_query("SELECT pv.chorder, pv.uid, pv.hostname, u.name FROM {poll_votes} pv LEFT JOIN {users} u ON pv.uid = u.uid WHERE pv.nid = %d".tablesort_sql($header),20,0,NULL,$node->nid);
* Menu callback to provide a simple list of all polls available.
*/
functionpoll_page(){
// List all polls.
$sql="SELECT n.nid, n.title, p.active, n.created, SUM(c.chvotes) AS votes FROM {node} n INNER JOIN {poll} p ON n.nid = p.nid INNER JOIN {poll_choices} c ON n.nid = c.nid WHERE n.status = 1 GROUP BY n.nid, n.title, p.active, n.created ORDER BY n.created DESC";
// Count all polls for the pager.
$count_sql='SELECT COUNT(*) FROM {node} n INNER JOIN {poll} p ON n.nid = p.nid WHERE n.status = 1';
* Callback for the 'votes' tab for polls you can see other votes on
*/
functionpoll_votes($node){
drupal_set_title(check_plain($node->title));
$output=t('This table lists all the recorded votes for this poll. If anonymous users are allowed to vote, they will be identified by the IP address of the computer they used when they voted.');
$result=pager_query("SELECT pv.chorder, pv.uid, pv.hostname, u.name FROM {poll_votes} pv LEFT JOIN {users} u ON pv.uid = u.uid WHERE pv.nid = %d".tablesort_sql($header),20,0,NULL,$node->nid);