/**
  * Render the contributions of user to page
  * @param ResultWrapper $res
  */
 protected function showContributions(ResultWrapper $res)
 {
     $numRows = $res->numRows();
     $rev = null;
     $out = $this->getOutput();
     $revs = array();
     $prevRevs = array();
     foreach ($res as $row) {
         $rev = new Revision($row);
         $revs[] = $rev;
         if ($res->key() <= self::LIMIT + 1 && $rev->getParentId()) {
             $prevRevs[] = $rev->getParentId();
         }
     }
     $this->prevLengths = Revision::getParentLengths(wfGetDB(DB_SLAVE), $prevRevs);
     if ($numRows > 0) {
         $count = 0;
         foreach ($revs as $rev) {
             if ($count++ < self::LIMIT) {
                 $this->showContributionsRow($rev);
             }
         }
         $out->addHtml('</ul>');
         // Captured 1 more than we should have done so if the number of
         // results is greater than the limit there are more to show.
         if ($numRows > self::LIMIT) {
             $out->addHtml($this->getMoreButton($rev->getTimestamp()));
         }
     } else {
         // For users who exist but have not made any edits
         $out->addHtml(MobileUI::warningBox($this->msg('mobile-frontend-history-no-results')));
     }
 }
예제 #2
0
 public function key()
 {
     return $this->res ? $this->res->key() : 0;
 }