<?php if ($voted || $poll->active == 0) { echo Template::moduleView('poll', 'views.pollResults', array('poll' => $poll, 'total_votes' => PollVotesModel::where('poll_id', $poll->id)->count())); } else { echo Template::moduleView('poll', 'views.pollItem', array('poll' => $poll)); } ?> <?php if ($polls) { ?> <div class="hr_grey"></div> <p class="e_sond"><?php echo varlang('alte-sondaje'); ?> </p> <ul class="a_n"> <?php foreach ($polls as $item) { ?> <li> <a href="<?php echo $page_url; ?> ?item=<?php echo $item->id; ?> "> <span> <?php echo date('d-m-Y', strtotime($item->date_created));
public static function ivoted($poll_id) { $ck_voted = Cookie::get('voted_id_' . $poll_id); $ip_voted = PollVotesModel::where('ip', Request::getClientIp())->where('poll_id', $poll_id)->count(); return $ck_voted || $ip_voted > 20; }
public function pollShortcode($params) { $wdata['poll'] = PollModel::getWithVotes($params['id']); if (!$wdata['poll']) { throw new Exception("Poll not found #{$params['id']}"); } if (PollModel::ivoted($params['id'])) { $wdata['total_votes'] = \PollVotesModel::where('poll_id', $wdata['poll']->id)->count(); return Template::moduleView($this->module_name, 'views.pollResults', $wdata); } else { return Template::moduleView($this->module_name, 'views.pollItem', $wdata); } }