function advpoll_get_votes in Advanced Poll 7.2
Same name and namespace in other branches
- 7.3 includes/advpoll_voteapi.inc \advpoll_get_votes()
- 7 includes/advpoll_voteapi.inc \advpoll_get_votes()
Get all votes related to a node by content type and node id.
Parameters
$nid: Node ID of an advanced poll.
$behavior: Behavior dictates how results are tabulated and displayed.
Return value
An array containing the key: 'choices' which matches the index of each choice with its tallied votes. 'total' which is the total of all votes
5 calls to advpoll_get_votes()
- advpoll_display_borda_results in advpoll_ranking/
advpoll_ranking.module - advpoll_display_results in ./
advpoll.module - _advpoll_clear_votes_access in ./
advpoll.module - Clear votes access callback.
- _advpoll_results_access in ./
advpoll.module - Results access callback.
- _advpoll_votes_access in ./
advpoll.module - Votes access callback.
File
- includes/
advpoll_voteapi.inc, line 21
Code
function advpoll_get_votes($nid, $behavior = 'approval') {
$criteria = array();
$criteria['entity_id'] = $nid;
$criteria['entity_type'] = 'advpoll';
$results = votingapi_select_votes($criteria);
if ($behavior === 'approval') {
$tabulated = advpoll_approval_vote($results);
}
elseif ($behavior === 'pool') {
$tabulated = advpoll_pooled_vote($results);
}
else {
$tabulated = advpoll_default_vote($results);
}
return $tabulated;
}