/** * Get the footer with user information (when joined, how * many edits/uploads, visit user page and talk page) * @return string */ protected function getUserFooterHtml() { $fromDate = $this->targetUser->getRegistration(); $ts = new MWTimestamp(wfTimestamp(TS_UNIX, $fromDate)); $diff = $ts->diff(new MWTimestamp()); if ($fromDate === null) { // User was registered in pre-historic times when registration wasn't recorded $msg = 'mobile-frontend-profile-footer-ancient'; $units = 0; $fromDate = '20010115000000'; // No users before that date } elseif ($diff->y) { $msg = 'mobile-frontend-profile-footer-years'; $units = $diff->y; } elseif ($diff->m) { $msg = 'mobile-frontend-profile-footer-months'; $units = $diff->m; } else { $msg = 'mobile-frontend-profile-footer-days'; $units = $diff->d; } $editCount = $this->targetUser->getEditCount(); $uploadCount = $this->userInfo->countRecentUploads($fromDate); // Ensure that the upload count is compatible with the i18n message if ($uploadCount > 500) { $uploadCount = 500; } $username = $this->targetUser->getName(); return Html::openElement('div', array('class' => 'footer')) . Html::openElement('div') . $this->msg($msg, $username)->numParams($units, $editCount, $uploadCount)->parse() . Html::closeElement('div') . Html::openElement('div') . Linker::link($this->targetUser->getUserPage(), $this->msg('mobile-frontend-profile-userpage-link', $username)->escaped()) . Html::closeElement('div') . $this->getTalkLink() . Html::closeElement('div'); }
public function getTemplateData($templateParser) { $data = $this->getUserFooterData(); $rev = $this->userInfo->getLastEdit(); $cards = array(); if ($rev) { $daysAgo = $this->getDaysAgo(new MWTimestamp(wfTimestamp(TS_UNIX, $rev->getTimestamp()))); $cards[] = $templateParser->processTemplate('userprofileCard', array('caption' => $this->msg('mobile-frontend-profile-last-edit', $rev->getTitle(), $daysAgo, $this->targetUser->getName())->parse())); } $thank = $this->userInfo->getLastThanking(); if ($thank) { $user = $thank['user']; $cards[] = $templateParser->processTemplate('userprofileCard', array('caption' => $this->msg('mobile-frontend-profile-last-thank', $user, $this->targetUser)->parse())); } Hooks::run('SpecialUserProfileCards', array(&$cards, $this->targetUser)); if (count($cards) > 0) { $data['hasActivity'] = true; $data['heading'] = $this->msg('mobile-frontend-profile-activity-heading')->text(); $data['cards'] = $cards; } return $data; }