Beispiel #1
0
 public function show_active_poll()
 {
     $poll = new poll($this->db, $this->output);
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $poll->vote($_POST["vote"]);
     }
     $poll->to_output();
 }
Beispiel #2
0
 public function execute()
 {
     $this->output->title = "Poll demo";
     $poll = new poll($this->db, $this->output);
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $poll->vote($_POST["vote"]);
     }
     $poll->to_output();
 }
Beispiel #3
0
     //
     //Show the active polls
     //
 //
 //Show the active polls
 //
 default:
     $smarty->assign('main_layout', $config->get('poll', 'main-layout'));
     if (isset($_POST['inactive'])) {
         if ($poll->existsPoll($_POST['inactive'])) {
             $inactive = $poll->switchActive($_POST['inactive']);
         }
     }
     if (isset($_POST['send']) && $_POST['send'] == 1 && !$poll->hasAllreadyVoted($login->currentUserID(), $_POST['poll'])) {
         if (isset($_POST['question' . $_POST['poll']]) && is_array($_POST['question' . $_POST['poll']]) && $_POST['question' . $_POST['poll']] != null) {
             $voted = $poll->vote($login->currentUserID(), $_POST['poll'], $_POST['question' . $_POST['poll']]);
         }
     }
     // show a single poll
     if (isset($_GET['pollid'])) {
         if (isset($_POST['send_comment'])) {
             $comments->add('poll', $login->currentUserId(), $_POST['message'], $_GET['pollid']);
         }
         $poll_comments = $comments->get('poll', $_GET['pollid']);
         $poll_final_comments = array();
         foreach ($poll_comments as $poll_comment) {
             $poll_comment['nickname'] = makeHtmlUrl($poll_comment['nickname'], makeUrl('profile', array('userid' => $poll_comment['userid'])));
             $poll_comment['date'] = date("d.m.Y H:i:s", $poll_comment['timestamp']);
             $poll_final_comments[] = $poll_comment;
         }
         $smarty->assign('all_comments', $poll_final_comments);