poll_view_voting

5 poll.module poll_view_voting($node, $block)
6 poll.module poll_view_voting(&$form_state, $node, $block)
7 poll.module poll_view_voting($form, &$form_state, $node, $block = FALSE)
8 poll.module poll_view_voting($form, &$form_state, $node, $block = FALSE)

Generates the voting form for a poll.

1 call to poll_view_voting()

File

modules/poll.module, line 302
Enables your site to capture votes on different topics in the form of multiple choice questions.

Code

function poll_view_voting(&$node, $teaser, $page, $block) {
  $output = '<div class="poll">';

  $form = '<div class="vote-form">';
  $form .= '<div class="choices">';
  if ($node->choice) {
    $list = array();
    foreach ($node->choice as $i => $choice) {
      $list[$i] = check_plain($choice['chtext']);
    }
    $form .= form_radios($page ? '' : check_plain($node->title), 'choice', -1, $list);
  }
  $form .= '</div>';
  $form .= form_hidden('nid', $node->nid);
  $form .= form_submit(t('Vote'), 'vote') . '</div>';

  $output .= form($form, 'post', url('poll/vote/' . $node->nid));
  $output .= '</div>';

  return $output;
}
Login or register to post comments