</h2>
		<ul class="custom-badges">
			<?php 
    $badgesCount = count($badges);
    ?>
			<?php 
    foreach ($badges as $index => $badge) {
        ?>
				<li class="<?php 
        echo $index == $badgesCount - 1 ? ' last' : '';
        ?>
">
					<div class="content-form">
						<p class="input">
							<input class="c-message" type="text" name="msg_<?php 
        echo $badge->getTypeId();
        ?>
" value="<?php 
        echo htmlspecialchars($badge->getName());
        ?>
">
						</p>
						<p><?php 
        echo $config->getLevelName($badge->getLevel());
        ?>
 (<?php 
        echo wfMsg('achievements-points', $config->getLevelScore($badge->getLevel()));
        ?>
)</p>
						<p><?php 
        echo $badge->getGiveFor();
Example #2
0
 /**
  * When the notification to the user is called (at the bottom of the page), attach the
  * achievement-earning to our best guess at what the associated RecentChange is.
  *
  * To account for race-conditions between RecentChanges and Achievements: currently, this
  * is done by recording when an RC is saved. If it happens on this page before this
  * function is called, then this function will load that RC by id.  If this function gets
  * called before any RCs have been recorded, then a serialized copy of the badge is stored
  * and can be inserted later (when the RC actually does get saved).
  *
  * @param User $user
  * @param AchBadge $badge
  */
 public static function attachAchievementToRc($user, $badge)
 {
     global $wgWikiaForceAIAFdebug;
     wfProfileIn(__METHOD__);
     // If user has 'hidepersonalachievements' set, then they probably don't want to play.
     // Also, other users may see that someone won, then click the username and look around for a way to see what achievements a user has...
     // then when they can't find it (since users with this option won't have theirs displayed), they might assume that there is no way to see
     // achievements.  It would be better to do this check at display-time rather than save-time, but we don't have access to the badge's user
     // at that point.
     Wikia::log(__METHOD__, "", "Noticed an achievement", $wgWikiaForceAIAFdebug);
     if ($badge->getTypeId() != BADGE_WELCOME && !$user->getGlobalPreference('hidepersonalachievements')) {
         Wikia::log(__METHOD__, "", "Attaching badge to recent change...", $wgWikiaForceAIAFdebug);
         // Make sure this Achievement gets added to its corresponding RecentChange (whether that has
         // been saved already during this pageload or is still pending).
         global $wgARecentChangeHasBeenSaved, $wgAchievementToAddToRc;
         Wikia::log(__METHOD__, "", "About to see if there is an existing RC. RC: " . print_r($wgARecentChangeHasBeenSaved, true), $wgWikiaForceAIAFdebug);
         if (!empty($wgARecentChangeHasBeenSaved)) {
             // Due to slave-lag, instead of storing the rc_id and looking it up (which didn't always work, even with a retry-loop), store entire RC.
             Wikia::log(__METHOD__, "", "Attaching badge to existing RecentChange from earlier in pageload.", $wgWikiaForceAIAFdebug);
             $rc = $wgARecentChangeHasBeenSaved;
             if ($rc) {
                 Wikia::log(__METHOD__, "", "Found recent change to attach to.", $wgWikiaForceAIAFdebug);
                 // Add the (serialized) badge into the rc_params field.
                 $rc_data = array();
                 $rc_data['Badge'] = serialize($badge);
                 MyHome::storeAdditionalRcData($rc_data, $rc);
             }
         } else {
             // Spool this achievement for when its corresponding RecentChange shows up (later in this pageload).
             $wgAchievementToAddToRc = serialize($badge);
             Wikia::log(__METHOD__, "", "RecentChange hasn't been saved yet, storing the badge for later.", $wgWikiaForceAIAFdebug);
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }