コード例 #1
0
 public function formatRow($row)
 {
     $css = $quality = $underReview = '';
     $title = Title::newFromRow($row);
     $stxt = ChangesList::showCharacterDifference($row->rev_len, $row->page_len);
     # Page links...
     $link = Linker::link($title);
     $hist = Linker::linkKnown($title, wfMsgHtml('hist'), array(), 'action=history');
     $review = Linker::linkKnown($title, wfMsg('pendingchanges-diff'), array(), array('diff' => 'cur', 'oldid' => $row->stable) + FlaggedRevs::diffOnlyCGI());
     # Show quality level if there are several
     if (FlaggedRevs::qualityVersions()) {
         $quality = $row->quality ? wfMsgHtml('revreview-lev-quality') : wfMsgHtml('revreview-lev-basic');
         $quality = " <b>[{$quality}]</b>";
     }
     # Is anybody watching?
     if (!$this->including() && $this->getUser()->isAllowed('unreviewedpages')) {
         $uw = FRUserActivity::numUsersWatchingPage($title);
         $watching = $uw ? wfMsgExt('pendingchanges-watched', 'parsemag', $this->getLang()->formatNum($uw)) : wfMsgHtml('pendingchanges-unwatched');
         $watching = " {$watching}";
     } else {
         $uw = -1;
         $watching = '';
         // leave out data
     }
     # Get how long the first unreviewed edit has been waiting...
     if ($row->pending_since) {
         $firstPendingTime = wfTimestamp(TS_UNIX, $row->pending_since);
         $hours = ($this->currentUnixTS - $firstPendingTime) / 3600;
         // After three days, just use days
         if ($hours > 3 * 24) {
             $days = round($hours / 24, 0);
             $age = wfMsgExt('pendingchanges-days', 'parsemag', $this->getLang()->formatNum($days));
             // If one or more hours, use hours
         } elseif ($hours >= 1) {
             $hours = round($hours, 0);
             $age = wfMsgExt('pendingchanges-hours', 'parsemag', $this->getLang()->formatNum($hours));
         } else {
             $age = wfMsg('pendingchanges-recent');
             // hot off the press :)
         }
         // Oh-noes!
         $css = self::getLineClass($hours, $uw);
         $css = $css ? " class='{$css}'" : "";
     } else {
         $age = "";
         // wtf?
     }
     # Show if a user is looking at this page
     list($u, $ts) = FRUserActivity::getUserReviewingDiff($row->stable, $row->page_latest);
     if ($u !== null) {
         $underReview = ' <span class="fr-under-review">' . wfMsgHtml('pendingchanges-viewing') . '</span>';
     }
     return "<li{$css}>{$link} ({$hist}) {$stxt} ({$review}) <i>{$age}</i>" . "{$quality}{$watching}{$underReview}</li>";
 }
コード例 #2
0
 public function formatRow($row)
 {
     $title = Title::newFromRow($row);
     $stxt = $underReview = $watching = '';
     $link = Linker::link($title, null, array(), 'redirect=no');
     $dirmark = $this->getLanguage()->getDirMark();
     $hist = Linker::linkKnown($title, $this->msg('hist')->escaped(), array(), array('action' => 'history'));
     if (!is_null($size = $row->page_len)) {
         $stxt = $size == 0 ? $this->msg('historyempty')->escaped() : $this->msg('historysize')->numParams($size)->escaped();
         $stxt = " <small>{$stxt}</small>";
     }
     # Get how long the first unreviewed edit has been waiting...
     $firstPendingTime = wfTimestamp(TS_UNIX, $row->creation);
     $hours = ($this->currentUnixTS - $firstPendingTime) / 3600;
     // After three days, just use days
     if ($hours > 3 * 24) {
         $days = round($hours / 24, 0);
         $age = ' ' . $this->msg('unreviewedpages-days')->numParams($days)->escaped();
         // If one or more hours, use hours
     } elseif ($hours >= 1) {
         $hours = round($hours, 0);
         $age = ' ' . $this->msg('unreviewedpages-hours')->numParams($hours)->escaped();
     } else {
         $age = ' ' . $this->msg('unreviewedpages-recent')->escaped();
         // hot off the press :)
     }
     if ($this->getUser()->isAllowed('unwatchedpages')) {
         $uw = FRUserActivity::numUsersWatchingPage($title);
         $watching = $uw ? $this->msg('unreviewedpages-watched')->numParams($uw)->escaped() : $this->msg('unreviewedpages-unwatched')->escaped();
         $watching = " {$watching}";
         // Oh-noes!
     } else {
         $uw = -1;
     }
     $css = self::getLineClass($hours, $uw);
     $css = $css ? " class='{$css}'" : "";
     # Show if a user is looking at this page
     list($u, $ts) = FRUserActivity::getUserReviewingPage($row->page_id);
     if ($u !== null) {
         $underReview = " <span class='fr-under-review'>" . $this->msg('unreviewedpages-viewing')->escaped() . '</span>';
     }
     return "<li{$css}>{$link} {$dirmark} {$stxt} ({$hist})" . "{$age}{$watching}{$underReview}</li>";
 }