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");
		}
	}
 public function getHTML()
 {
     wfProfileIn(__METHOD__);
     if ($this->isVisible()) {
         $ownerName = $this->ownerUser->getName();
         $tmplData = array();
         $tmplData['ownerBadges'] = $this->getBadgesAnnotated();
         $tmplData['challengesBadges'] = $this->getChallengesAnnotated();
         $tmplData['title_no'] = wfMsg('achievements-profile-title-no', $ownerName);
         $tmplData['title'] = wfMsgExt('achievements-profile-title', array('parsemag'), $ownerName, $this->owner->getBadgesCount());
         $tmplData['title_challenges'] = wfMsg('achievements-profile-title-challenges', $ownerName);
         $tmplData['leaderboard_url'] = Skin::makeSpecialUrl("Leaderboard");
         if ($this->owner->getBadgesCount() > 0) {
             $rankingService = new AchRankingService();
             $tmplData['user_rank'] = $rankingService->getUserRankingPosition($this->ownerUser);
         }
         if ($this->viewerUser->isAllowed('editinterface')) {
             $tmplData['customize_url'] = Skin::makeSpecialUrl("AchievementsCustomize");
         }
         $template = new EasyTemplate(dirname(__FILE__) . '/../templates');
         $template->set_vars($tmplData);
         $out = $template->render('ProfileBox');
     } else {
         $out = '';
     }
     wfProfileOut(__METHOD__);
     return $out;
 }
 public function getHTML()
 {
     wfProfileIn(__METHOD__);
     global $wgTitle, $wgUser;
     //fix #10881, get correct username from user namespace subpages
     $this->mUserOwner = F::build('User', array(UserPagesHeaderController::getUserName($wgTitle, BodyController::getUserPagesNamespaces())), 'newFromName');
     if (in_array(strtolower(RequestContext::getMain()->getSkin()->getSkinName()), array('oasis')) && $this->mUserOwner && AchAwardingService::canEarnBadges($this->mUserOwner) && $this->mUserOwner->isLoggedIn() && !($wgUser->getId() == $this->mUserOwner->getId() && $wgUser->getOption('hidepersonalachievements'))) {
         $this->mUserViewer = $wgUser;
         if ($this->mUserViewer->isLoggedIn() && $this->mUserViewer->getId() != $this->mUserOwner->getId()) {
             $this->loadViewerBadges();
             $this->loadViewerCounters();
         }
         $this->loadOwnerBadges();
         $this->loadOwnerCounters();
         $this->prepareChallenges();
         $tmplData = array();
         $tmplData['ownerBadges'] = $this->mOwnerBadgesSimple;
         $tmplData['challengesBadges'] = $this->mChallengesBadges;
         $tmplData['title_no'] = wfMsg('achievements-profile-title-no', $this->mUserOwner->getName());
         $tmplData['title'] = wfMsgExt('achievements-profile-title', array('parsemag'), $this->mUserOwner->getName(), count($this->mOwnerBadgesSimple));
         $tmplData['title_challenges'] = wfMsg('achievements-profile-title-challenges', $this->mUserOwner->getName());
         $tmplData['leaderboard_url'] = Skin::makeSpecialUrl("Leaderboard");
         if (count($this->mOwnerBadgesExtended) > 0) {
             $rankingService = new AchRankingService();
             $tmplData['user_rank'] = $rankingService->getUserRankingPosition($this->mUserOwner);
         }
         if ($this->mUserViewer->isAllowed('editinterface')) {
             $tmplData['customize_url'] = Skin::makeSpecialUrl("AchievementsCustomize");
         }
         $template = new EasyTemplate(dirname(__FILE__) . '/../templates');
         $template->set_vars($tmplData);
         $out = $template->render('ProfileBox');
     } else {
         $out = '';
     }
     wfProfileOut(__METHOD__);
     return $out;
 }
 public function executeIndex()
 {
     global $wgContLang;
     wfProfileIn(__METHOD__);
     $userProfileService = new AchUserProfileService();
     if (!$userProfileService->isVisible()) {
         $this->skipRendering();
         wfProfileOut(__METHOD__);
         return;
     }
     // add CSS and JS for this module
     $this->response->addAsset('achievements_css');
     $this->response->addAsset('achievements_js');
     $rankingService = new AchRankingService();
     // get achievement lists
     $this->ownerName = $userProfileService->getOwnerUser()->getName();
     $this->ownerBadgesCount = $userProfileService->getBadgesCount();
     $this->ownerBadges = $userProfileService->getBadgesAnnotated(0);
     $this->ownerCounters = $userProfileService->getCounters();
     $this->ownerRank = $rankingService->getUserRankingPosition($userProfileService->getOwnerUser());
     $this->ownerScore = $wgContLang->formatNum($rankingService->getUserScore($userProfileService->getOwnerUser()->getId()));
     // if user is viewing their own page
     if ($userProfileService->getViewerUser() && !$userProfileService->getViewerUser()->isAnon() && $userProfileService->getViewerUser()->getId() == $userProfileService->getOwnerUser()->getId()) {
         $this->viewer_is_owner = true;
         $challengesBadges = $userProfileService->getChallengesAnnotated();
         // Let's prune the challengesBadges list to the correct length before passing it to the template
         if ($this->max_challenges != "all") {
             $challengesBadges = array_slice($challengesBadges, 0, $this->max_challenges);
         }
         $this->challengesBadges = $challengesBadges;
     }
     // UI elements
     $this->leaderboard_url = Skin::makeSpecialUrl("Leaderboard");
     if ($userProfileService->getViewerUser() && $userProfileService->getViewerUser()->isAllowed('editinterface')) {
         $this->customize_url = Skin::makeSpecialUrl("AchievementsCustomize");
     }
     wfProfileOut(__METHOD__);
 }