/** * * Returns the html for the box at the * top of NFD Guardian which contains * information about the current * article being voted on. * */ function getArticleInfoBox() { global $wgOut; //first find out who the author was $articleInfo = $this->getArticleInfo(); if (intval($articleInfo->fe_user) > 0) { $u = User::newFromId($articleInfo->fe_user); $userLink = $u->getUserPage()->getInternalURL(); $userName = $u->getName(); $cp = new ContribsPager(ContextSource::getContext(), array($userName)); $uEdits = $cp->getNumRows(); } else { $u = User::newFromName($articleInfo->fe_user_text); $userLink = "/User:"******"") { $t = Title::newFromText($nfdReason['article']); if ($t) { $nfdLongReason .= " with [[" . $t->getText() . "]]"; } } //finally check the number of discussion items for this //article. We ask for confirmation for articles //with a lot of discussion items. $t = Title::newFromID($this->mResult->nfd_page); if ($t) { $a = new Article($t); // $pageHistory = new PageHistory($a); // $pager = new PageHistoryPager( $pageHistory ); // $edits = $pager->getNumRows(); $pageHistory = new HistoryPage($a); $items = $pageHistory->fetchRevisions(100000, 0, 1); $edits = $items->numRows(); $discussionTitle = Title::newFromText($t->getText(), NS_TALK); if ($discussionTitle) { $discussionArticle = new Article($discussionTitle); // $pageHistory = new PageHistory($discussionArticle); // $pager = new PageHistoryPager( $pageHistory ); // $discussion = $pager->getNumRows(); $pageHistory = new HistoryPage($discussionArticle); $items = $pageHistory->fetchRevisions(100000, 0, 1); $discussion = $items->numRows(); } else { $discussion = 0; } } $articleInfo = $this->getArticleInfo(); $tmpl = new EasyTemplate(dirname(__FILE__)); $tmpl->set_vars(array('age' => wfTimeAgo($this->mResult->nfd_fe_timestamp), 'authorUrl' => $userLink, 'authorName' => $userName, 'views' => $articleInfo->page_counter, 'nfd' => $wgOut->parse($nfdLongReason), 'edits' => $edits, 'userEdits' => $uEdits, 'nfdVotes' => $this->getTotalVotes($this->mResult->nfd_id), 'discussion' => $discussion)); $html = $tmpl->execute('NFDinfo.tmpl.php'); return $html; }