public function getTagListRows($rawTag, $offset, $rows = NUM_ROWS, $filter = null) { global $wgUser; $db = WAPDB::getInstance($this->dbType); $orderBy = 'ct_rank'; $filter = intVal($filter); // Don't pass in a filter, will filter below $vars['articles'] = $db->getArticlesByTagName($rawTag, 0, self::MAX_NUM_ROWS, WAPArticleTagDB::ARTICLE_UNASSIGNED, '', $orderBy); if (!empty($filter)) { foreach ($vars['articles'] as $i => $a) { // bitwise filter by category if (!($a->getCatInfo() & $filter)) { unset($vars['articles'][$i]); } } } $vars['u'] = BabelfishUser::newFromUserObject($wgUser, $this->dbType); $vars['numrows'] = $rows; $vars['tag'] = $rawTag; $config = WAPDB::getInstance($this->dbType)->getWAPConfig(); $linkerClass = $config->getLinkerClassName(); $vars['linker'] = new $linkerClass($this->dbType); $tmpl = new WAPTemplate($this->dbType); $html = $tmpl->getHtml('tag_list_pager_rows.tmpl.php', $vars); return $html; }
public function completeTranslatedArticles(&$articles, $lang) { if (!empty($articles)) { $defaultUserText = $this->getWAPConfig()->getDefaultUserName(); $urls = array(); $userAidMap = array(); foreach ($articles as $a) { // Don't complete again if it's already been completed if (!$a->isCompleted()) { $userText = $a->getUserText(); $userText = empty($userText) ? $defaultUserText : $userText; $userText = strtolower($userText); $userAidMap[$userText][] = $a->getPageId(); } } foreach ($userAidMap as $userText => $aids) { $u = BabelfishUser::newFromName($userText, $this->dbType); $this->completeArticles($aids, $lang, $u); } } }