Esempio n. 1
0
 private function templateRanking()
 {
     require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteCats.php';
     $tag = Common::getGet('tag', self::DEFAULT_TAG);
     if (0 === ($bit = WC_SiteCats::getBitForCat($tag))) {
         $bit = 1;
         $tag = $_GET['tag'] = WC_SiteCats::getCatForBit($bit);
     }
     $ipp = 50;
     $nItems = $this->countItems($bit);
     list($page, $hlrank) = $this->getPageNum($ipp, $bit);
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp($page, 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $rank = ($page - 1) * $ipp + 1;
     $data = $bit === 0 ? array() : $this->selectPage($bit, $from, $ipp);
     $dtag = GWF_HTML::display($tag);
     GWF_Website::setPageTitle($this->module->lang('pt_tagrank', array($dtag)));
     GWF_Website::setMetaTags($this->module->lang('mt_tagrank', array($dtag, $dtag)));
     GWF_Website::setMetaDescr($this->module->lang('md_tagrank', array($dtag, $page, $nPages)));
     $tVars = array('rank' => $rank, 'hlrank' => $hlrank, 'sites' => WC_Site::getSimilarSitesS($bit, true), 'data' => $data, 'tag' => $dtag, 'form_action' => GWF_WEB_ROOT . 'category_ranking', 'page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . sprintf('category_ranking/%s/page-%%PAGE%%', urlencode($tag))), 'select' => $this->getTagSelect());
     return $this->module->templatePHP('ranking_tag.php', $tVars);
 }