Beispiel #1
0
 function getHome()
 {
     $poll = new Axon('tbl_poll');
     $latest_polls = $poll->find('published_date is not null and is_archive="n" and expiry_date > now() and private="n" ', 'created_date desc limit 5');
     $latest = $recent = $top = array();
     foreach ($latest_polls as $latestPolls) {
         $latest[$latestPolls->id] = $latestPolls->question;
     }
     // var_dump($latest_polls );die;
     $this->set('polls', $latest);
     //recent activity
     $poll->def('date', 'select date from tbl_vote where tbl_poll.id=tbl_vote.poll_id order by date desc limit 1');
     $recent_activity = $poll->find('published_date is not null and is_archive="n" and expiry_date>now() and private="n"', 'date desc limit 3');
     foreach ($recent_activity as $recentActivity) {
         $recent[$recentActivity->id] = $recentActivity->question;
     }
     $this->set('recent', $recent);
     $poll->def('hits', 'SELECT COUNT(date) FROM tbl_vote WHERE tbl_poll.id=tbl_vote.poll_id');
     $top_polls = $poll->find('published_date is not null and is_archive="n" and expiry_date >now() and private="n"', 'hits desc limit 2');
     foreach ($top_polls as $topPolls) {
         $top[$topPolls->id] = $topPolls->question;
     }
     $this->set('top', $top);
     $this->set('title', 'home');
     $this->set('template', 'home');
     echo Template::serve("template/layout.htm");
 }
Beispiel #2
0
 function all()
 {
     $poll = new Axon('tbl_poll');
     //  echo 123;die;
     // $this->set('title', 'Quizzes');
     $poll->def('fullname', 'SELECT fullname FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id');
     $poll->def('image', 'SELECT image FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id');
     $poll->def('hits', 'SELECT COUNT(date) FROM tbl_vote WHERE tbl_poll.id=tbl_vote.poll_id');
     $q = $poll->find('published_date IS NOT NULL AND is_archive="n" AND expiry_date>now() AND private="n"');
     $polls = array();
     foreach ($q as $qu) {
         $polls[$qu->id] = array(strtoupper($qu->keyword), $qu->question, '<img src="' . $qu->image . '" width="20px" height="20px" /> ' . $qu->fullname);
     }
     $this->set('title', 'All polls');
     $this->set('pollList', $polls);
     $this->set('template', 'all');
     echo Template::serve("template/layout.htm");
 }
Beispiel #3
0
 function allPoll()
 {
     if (!F3::get('SESSION.asid')) {
         F3:
         reroute('/admin');
     }
     $poll = new Axon("tbl_poll");
     $poll->def('fullname', 'SELECT fullname FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id');
     $poll->def('image', 'SELECT image FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id');
     $poll->def('hits', 'SELECT COUNT(date) FROM tbl_vote WHERE tbl_poll.id=tbl_vote.poll_id');
     $q = $poll->find();
     $users = array();
     foreach ($q as $qu) {
         $polls[$qu->id] = array(strtoupper($qu->keyword), $qu->question, '<img src="' . $qu->image . '" width="20px" height="20px" />' . $qu->fullname, date_create("now") >= date_create($qu->expiry_date) ? "Yes" : "No", $qu->published_date ? "Yes" : "No", $qu->published_date && date_create("now") < date_create($qu->expiry_date) && $qu->is_archive == "n" ? "Yes" : "No", $qu->private == 'y' ? "Private" : "Public", $qu->hits);
         if (!in_array($qu->fullname, $users)) {
             $users[] = $qu->fullname;
         }
     }
     F3::set('pollList', $polls);
     F3::set('users', $users);
     F3::set('template', 'poll');
     echo Template::Serve('template/admin/layout.htm');
 }
Beispiel #4
0
 function lst()
 {
     $user = new Axon('tbl_user');
     $report = array();
     $user->def("hits", "SELECT COUNT(date) FROM tbl_vote, tbl_poll WHERE date between '" . F3::get("POST.from") . "' and '" . F3::get("POST.to") . "'" . (F3::get("POST.telco") ? " and telco='" . F3::get("POST.telco") . "'" : "") . " and tbl_poll.id=tbl_vote.poll_id and tbl_poll.user_id=tbl_user.id group by tbl_user.id");
     if ($user->found() > 0) {
         $report_list = $user->find();
         foreach ($report_list as $rl) {
             $report[] = array('<img src="' . $rl->image . '" width="20px" height="20px" /> ' . $rl->fullname, $rl->hits ? $rl->hits : 0);
         }
     }
     $this->set('report', $report);
     echo Template::serve("template/admin/report_list.htm");
 }