You are here

function _advpoll_check_settings in Advanced Poll 6.3

2 calls to _advpoll_check_settings()
advpoll_view in ./advpoll.module
Implementation of hook_view().
_advpoll_vote_response in ./advpoll.module

File

./advpoll.module, line 1849
Advanced Poll - a sophisticated polling module for voting, elections, and group decision-making.

Code

function _advpoll_check_settings($node) {

  // function to check against admin settings only.
  $advpollSettings = variable_get('advpoll_settings', array());
  $votingMode = !empty($advpollSettings['voting_mode']) ? $advpollSettings['voting_mode'] : '0';
  $showResults = !empty($advpollSettings['show_results']) ? $advpollSettings['show_results'] : 'aftervote';
  if ($showResults === 'afterclose') {
    if (!$node->active) {
      return true;
    }
    else {
      return false;
    }
  }

  // if admin configuration has selected cookies to track vote availability
  // then force display of results while cookie is alive.
  if ($votingMode == 1 && isset($_COOKIE['advpollvote' . $node->nid])) {
    return true;
  }
  if (!$votingMode && $node->voted) {
    return true;
  }
  return false;
}