poll_view_results
modules/poll/poll.module, строка 408
- Версии
- 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
foreach ($node->choice as $choice) {
$total_votes += $choice['chvotes'];
$max_votes = max($max_votes, $choice['chvotes']);
}
foreach ($node->choice as $i => $choice) {
if ($choice['chtext'] != '') {
$poll_results .= theme('poll_bar', check_plain($choice['chtext']), round($choice['chvotes'] * 100 / max($total_votes, 1)), format_plural($choice['chvotes'], '1 vote', '@count votes'), $block);
}
}
$output .= theme('poll_results', check_plain($node->title), $poll_results, $total_votes, $node->links, $block, $node->nid, $node->vote);
return $output;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии