Exemplo n.º 1
0
 private function templatePolls()
 {
     $ipp = 25;
     $t = GDO::table('GWF_VoteMulti');
     $user = GWF_Session::getUser();
     $conditions = GWF_VoteMulti::permqueryRead($user);
     $nItems = $t->countRows($conditions);
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp(intval(Common::getGet('page')), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $by = Common::getGet('by', 'vm_date');
     $dir = Common::getGet('dir', 'DESC');
     $orderby = $t->getMultiOrderby($by, $dir);
     $polls = $t->selectObjects('*', $conditions, $orderby, $ipp, $from);
     foreach ($polls as $poll) {
         $poll instanceof GWF_VoteMulti;
         $poll->loadVoteOptions();
     }
     $tVars = array('page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'poll_overview/by/' . urlencode($by) . '/' . urlencode($dir) . '/page-%PAGE%'), 'polls' => $polls, 'sort_url' => GWF_WEB_ROOT . 'poll_overview/by/%BY%/%DIR%/page-1', 'may_add_poll' => Module_Votes::mayAddPoll($user), 'href_add_poll' => GWF_WEB_ROOT . 'poll/add');
     return $this->module->templatePHP('polls.php', $tVars);
 }