/** * Display some statistics when a user clicks stats link (&action=stats) * * @param $blckid Int: ID number of the block */ private function showStatsList($blckid) { global $wgOut, $wgLang, $wgUser, $wgContLang; wfProfileIn(__METHOD__); $action = $this->mTitle->escapeLocalURL($this->makeListUrlParams(true)); $skin = $wgUser->getSkin(); $regexData = new RegexBlockData(); $this->numStatResults = $regexData->fetchNbrStatResults($blckid); $filter = 'action=stats&filter=' . urlencode($this->mFilter) . '&blckid=' . urlencode($blckid); $pager = wfViewPrevNext($this->mOffset, $this->mLimit, $wgContLang->specialpage('RegexBlock'), $filter, $this->numStatResults - $this->mOffset <= $this->mLimit); /* allow display by specific blockers only */ $blockInfo = $regexData->getRegexBlockById($blckid); $stats_list = array(); if (!empty($blockInfo) && is_object($blockInfo)) { $stats_list = $regexData->getStatsData($blckid, $this->mLimit, $this->mOffset); } $blocker_link = $skin->makeKnownLinkObj($this->mTitle, $blockInfo->blckby_blocker, 'filter=' . urlencode($blockInfo->blckby_blocker)); $blockername_link = $skin->makeKnownLinkObj($this->mTitle, $blockInfo->blckby_name, 'rfilter=' . urlencode($blockInfo->blckby_name)); $blockReason = $blockInfo->blckby_reason ? wfMsg('regexblock-form-reason') . $blockInfo->blckby_reason : wfMsg('regexblock-view-reason-default'); $wgOut->addHTML('<h5>' . wfMsg('regexblock-stats-title') . ' <strong> ' . $blockername_link . '</strong> (' . wfMsg('regexblock-view-block-by') . ' <b>' . $blocker_link . '</b>, <i>' . $blockReason . '</i>)</h5><br />'); if (!empty($stats_list)) { $wgOut->addHTML('<p>' . $pager . '</p><br /><ul>'); foreach ($stats_list as $id => $row) { $wgOut->addHTML('<li style="border-bottom:1px dashed #778899; padding-bottom:2px;font-size:11px"> ' . wfMsg('regexblock-match-stats-record', array($row->stats_match, $row->stats_user, htmlspecialchars($row->stats_dbname), $wgLang->timeanddate(wfTimestamp(TS_MW, $row->stats_timestamp), true), $row->stats_ip, $wgLang->date(wfTimestamp(TS_MW, $row->stats_timestamp), true), $wgLang->time(wfTimestamp(TS_MW, $row->stats_timestamp), true))) . ' </li>'); } $wgOut->addHTML('</ul><br /> <p>' . $pager . '</p>'); } else { $wgOut->addWikiMsg('regexblock-nodata-found'); } wfProfileOut(__METHOD__); }
private function showStatsList($blckid) { global $wgOut, $wgLang, $wgUser; global $wgContLang; wfProfileIn(__METHOD__); $titleObj = Title::makeTitle(NS_SPECIAL, 'RegexBlock'); $action = htmlspecialchars($titleObj->getLocalURL()) . "?" . $this->makeListUrlParams(true); $regexData = new RegexBlockData(); $this->numStatResults = $regexData->fetchNbrStatResults($blckid); $filter = 'action=stats&filter=' . urlencode($this->mFilter) . '&blckid=' . urlencode($blckid); $pager = $wgLang->viewPrevNext(SpecialPage::getTitleFor('RegexBlock'), $this->mOffset, $this->mLimit, wfCgiToArray($filter), $this->numStatResults - $this->mOffset <= $this->mLimit); /* allow display by specific blockers only */ $blockInfo = $regexData->getRegexBlockById($blckid); $stats_list = array(); if (!empty($blockInfo) && is_object($blockInfo)) { $stats_list = $regexData->getStatsData($blckid, $this->mLimit, $this->mOffset); } $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/"); $oTmpl->set_vars(array("pager" => $pager, "action" => $action, "stats_list" => $stats_list, "lang" => $wgLang, "skin" => RequestContext::getMain()->getSkin(), "blockInfo" => $blockInfo, "titleObj" => $titleObj)); $wgOut->addHTML($oTmpl->render("page-stats")); wfProfileOut(__METHOD__); }