poll_view_results

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/poll/poll.module, строка 636

Версии
5 – 6
poll_view_results(&$node, $teaser, $page, $block)

Generates a graphical representation of the results of a poll.

Код

<?php
function poll_view_results(&$node, $teaser, $page, $block) {
  // Count the votes and find the maximum
  $total_votes = 0;
  $max_votes = 0;
  foreach ($node->choice as $choice) {
    if (isset($choice['chvotes'])) {
      $total_votes += $choice['chvotes'];
      $max_votes = max($max_votes, $choice['chvotes']);
    }
  }

  $poll_results = '';
  foreach ($node->choice as $i => $choice) {
    if (!empty($choice['chtext'])) {
      $chvotes = isset($choice['chvotes']) ? $choice['chvotes'] : NULL;
      $poll_results .= theme('poll_bar', $choice['chtext'], $chvotes, $total_votes, isset($node->vote) && $node->vote == $i, $block);
    }
  }

  return theme('poll_results', $node->title, $poll_results, $total_votes, isset($node->links) ? $node->links : array(), $block, $node->nid, isset($node->vote) ? $node->vote : NULL);
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему