function _advpoll_is_active in Advanced Poll 6
Same name and namespace in other branches
- 5 advpoll.module \_advpoll_is_active()
- 6.3 advpoll.module \_advpoll_is_active()
- 6.2 advpoll.module \_advpoll_is_active()
Helper function to check if a poll is active.
8 calls to _advpoll_is_active()
- advpoll_cancel in ./
advpoll.admin.inc - Callback for canceling a vote.
- advpoll_page in ./
advpoll.pages.inc - List all polls as a page.
- advpoll_view in ./
advpoll.module - Implementation of hook_view().
- advpoll_voting_binary_form_validate in modes/
binary.inc - Check if the submitted key exists, just to make sure the form is not bypassed.
- advpoll_voting_ranking_form_validate in modes/
ranking.inc - Implementation of the vote validation hook for the runoff module.
File
- ./
advpoll.module, line 1022 - Advanced Poll - a sophisticated polling module for voting, elections, and group decision-making.
Code
function _advpoll_is_active($node, $return_status = FALSE) {
$active = TRUE;
$status = 'open';
$start_date = $node->start_date;
$end_date = $node->end_date;
// Check if poll is closed.
if (!$node->active) {
$active = FALSE;
$status = 'closed';
}
if ($active && $start_date > 0) {
// Check that start date is in the past.
if (!($active = time() >= $start_date)) {
$status = 'pending';
}
}
if ($active && $end_date > 0) {
// Check that end date is in the future.
if (!($active = time() < $end_date)) {
$status = 'passed';
}
}
return $return_status ? $status : $active;
}