private function getBadgesData() { global $wgContLang; // get achievement lists $rankingService = new AchRankingService(); $userProfileService = new AchUserProfileService(); $userProfileService->getHTML(); // have to call this because it creates our data as a side effect $this->ownerName = $userProfileService->mUserOwner->getName(); $this->ownerBadges = $userProfileService->mOwnerBadgesSimple; $this->ownerCounters = $userProfileService->mOwnerCounters; $this->ownerRank = $rankingService->getUserRankingPosition($userProfileService->mUserOwner); $this->ownerScore = $wgContLang->formatNum($rankingService->getUserScore($userProfileService->mUserOwner->getId())); if($userProfileService->mUserViewer && $userProfileService->mUserViewer->isLoggedIn() && $userProfileService->mUserViewer->getId() == $userProfileService->mUserOwner->getId()) { $this->viewer_is_owner = true; $challengesBadges = $userProfileService->mChallengesBadges; // Let's prune the challengesBadges list to the correct length before passing it to the template if ($this->max_challenges != "all") { while (count($challengesBadges) > $this->max_challenges) array_pop($challengesBadges); } $this->challengesBadges = $challengesBadges; } // UI elements $this->leaderboard_url = Skin::makeSpecialUrl("Leaderboard"); if($userProfileService->mUserViewer && $userProfileService->mUserViewer->isAllowed('editinterface')) { $this->customize_url = Skin::makeSpecialUrl("AchievementsCustomize"); } }
function Ach_AddToUserProfile(&$out) { global $wgOut, $wgScriptPath; $userProfileService = new AchUserProfileService(); $html = $userProfileService->getHTML(); if ($html) { $out['achievementsII'] = $html; // TODO: use CDN path $wgOut->addStyle('../..' . $wgScriptPath . '/extensions/wikia/AchievementsII/css/achievements_sidebar.css'); } return true; }