Contributions API

Calling all Drupal developers!

Help us get this on the first page of Digg. DIGG NOW!

Modules in 6

i18npoll_view_results

Definition

i18npoll_view_results(&$node, $teaser, $page, $block)
contributions/i18n/i18npoll/i18npoll.module, line 127

Description

Generates a graphical representation of the results of a poll.

Code

<?php
function i18npoll_view_results(&$node, $teaser, $page, $block) {
  // Load the appropriate choices into the $poll object.
  $result = db_query("SELECT c.chorder, SUM(c.chvotes) AS votes FROM {poll_choices} c INNER JOIN {node} n ON c.nid = n.nid WHERE n.tnid = %d GROUP BY c.chorder", $node->tnid);
  while ($choice = db_fetch_object($result)) {
    // If this option not set for the source node, do not show
    if (isset($node->choice[$choice->chorder])) {
      $node->choice[$choice->chorder]['chvotes'] = $choice->votes;
    }
  }
  return poll_view_results($node, $teaser, $page, $block);
}
?>