You are here

function poll_view in Drupal 4

Same name and namespace in other branches
  1. 5 modules/poll/poll.module \poll_view()
  2. 6 modules/poll/poll.module \poll_view()
  3. 7 modules/poll/poll.module \poll_view()

Implementation of hook_view().

Parameters

$block: An extra parameter that adapts the hook to display a block-ready rendering of the poll.

1 call to poll_view()
poll_block in modules/poll.module
Implementation of hook_block().

File

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

Code

function poll_view(&$node, $teaser = FALSE, $page = FALSE, $block = FALSE) {
  global $user;
  $output = '';

  // Special display for side-block
  if ($block) {

    // No 'read more' link
    $node->body = $node->teaser = '';
    $links = module_invoke_all('link', 'node', $node, 1);
    $links[] = l(t('older polls'), 'poll', array(
      'title' => t('View the list of polls on this site.'),
    ));
    if ($node->allowvotes && $block) {
      $links[] = l(t('results'), 'node/' . $node->nid . '/results', array(
        'title' => t('View the current poll results.'),
      ));
    }
    $node->links = $links;
  }
  if ($node->allowvotes && ($block || arg(2) != 'results')) {
    $output .= poll_view_voting($node, $teaser, $page, $block);
  }
  else {
    $output .= poll_view_results($node, $teaser, $page, $block);
  }
  $node->body = $node->teaser = $output;
}