function i18npoll_view_results in Internationalization 6
Generates a graphical representation of the results of a poll.
2 calls to i18npoll_view_results()
- i18npoll_nodeapi in i18npoll/
i18npoll.module - Implementation of hook_nodeapi().
- i18npoll_view in i18npoll/
i18npoll.module - Implementation of hook_view().
File
- i18npoll/
i18npoll.module, line 140 - Multilingual poll - Aggregates poll results for all translations.
Code
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);
}