/** * @desc Renders a table with wikis in visualization on corporate page plus pagination if needed * * @requestParam string $visualizationLang language code of wikis * @requestParam integer $page page number * @requestParam string $wikiHeadline a string filtering the list * * @return false if user does not have permissions */ public function renderWikiListPage() { $this->wf->ProfileIn(__METHOD__); if (!$this->checkAccess()) { return false; } //todo: move to __construct() the same in index() if (empty($this->visualizationLang)) { $visualizationLang = $this->request->getVal('visualizationLang', $this->wg->contLang->getCode()); } else { $visualizationLang = $this->visualizationLang; } $this->currentPage = $this->request->getVal('page', 1); //todo: new class for options $options = new stdClass(); $options->lang = $visualizationLang; $options->wikiHeadline = $this->request->getVal('wikiHeadline', ''); $count = $this->helper->getWikisCountForStaffTool($options); $options->limit = self::WHST_WIKIS_PER_PAGE; $options->offset = ($this->currentPage - 1) * self::WHST_WIKIS_PER_PAGE; $specialPage = F::build('Title', array('ManageWikiaHome', NS_SPECIAL), 'newFromText'); //todo: getLocalUrl(array('vl' => $visualizationLang, 'page' => '%s')) doesn't work here because % sign is being escaped $url = $specialPage->getLocalUrl() . '?vl=' . $visualizationLang . '&page=%s'; if ($count > self::WHST_WIKIS_PER_PAGE) { /** @var $paginator Paginator */ $paginator = F::build('Paginator', array(array_fill(0, $count, ''), self::WHST_WIKIS_PER_PAGE), 'newFromArray'); $paginator->setActivePage($this->currentPage - 1); $this->setVal('pagination', $paginator->getBarHTML($url)); } $this->list = $this->helper->getWikisForStaffTool($options); $this->wf->ProfileOut(__METHOD__); }
/** * @desc Renders a table with wikis in visualization on corporate page plus pagination if needed * * @requestParam string $visualizationLang language code of wikis * @requestParam integer $page page number * @requestParam string $wikiHeadline a string filtering the list * * @return false if user does not have permissions */ public function renderWikiListPage() { wfProfileIn(__METHOD__); if (!$this->checkAccess()) { wfProfileOut(__METHOD__); return false; } //todo: move to __construct() the same in index() if (empty($this->visualizationLang)) { $visualizationLang = $this->request->getVal('visualizationLang', $this->wg->contLang->getCode()); } else { $visualizationLang = $this->visualizationLang; } $filterOptions = $this->request->getVal('filterOptions', []); //todo: new class for options $currentPage = $this->request->getVal('page', 1); $options = $this->prepareFilterOptions($visualizationLang, $filterOptions, $currentPage); $count = $this->helper->getWikisCountForStaffTool($options); $options->limit = self::WHST_WIKIS_PER_PAGE; $options->offset = ($currentPage - 1) * self::WHST_WIKIS_PER_PAGE; $this->list = $this->helper->getWikisForStaffTool($options); $this->collections = $this->getWikiaCollectionsModel()->getList($visualizationLang); $this->verticals = $this->helper->getWikiVerticals(); if ($count > self::WHST_WIKIS_PER_PAGE) { /** @var $paginator Paginator */ $paginator = Paginator::newFromArray(array_fill(0, $count, ''), self::WHST_WIKIS_PER_PAGE); $paginator->setActivePage($currentPage - 1); $url = $this->getUrlWithAllParams($visualizationLang, $filterOptions); $this->setVal('pagination', $paginator->getBarHTML($url)); } wfProfileOut(__METHOD__); }