function execute($par)
 {
     wfProfileIn(__METHOD__);
     global $wgOut, $wgExtensionsPath, $wgResourceBasePath, $wgJsMimeType, $wgUser;
     // set basic headers
     $this->setHeaders();
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         wfProfileOut(__METHOD__);
         return;
     }
     if (!$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         wfProfileOut(__METHOD__);
         return;
     }
     // include resources (css and js)
     $wgOut->addExtensionStyle("{$wgExtensionsPath}/wikia/AchievementsII/css/platinum.css\n");
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/AchievementsII/css/oasis.scss'));
     $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/wikia/AchievementsII/js/platinum.js\"></script>\n");
     $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgResourceBasePath}/resources/wikia/libraries/aim/jquery.aim.js\"></script>\n");
     // call service to get needed data
     $badges = AchPlatinumService::getList();
     // pass data to template
     $template = new EasyTemplate(dirname(__FILE__) . '/templates');
     $template->set_vars(array('badges' => $badges));
     // render template
     $wgOut->addHTML($template->render('SpecialPlatinum'));
     wfProfileOut(__METHOD__);
 }
 public static function getBadge($badgeTypeId)
 {
     wfProfileIn(__METHOD__);
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select('ach_custom_badges', array('id', 'enabled', 'sponsored', 'badge_tracking_url', 'hover_tracking_url', 'click_tracking_url'), array('id' => $badgeTypeId), __METHOD__);
     if ($row = $dbr->fetchObject($res)) {
         $badge = array();
         $image = wfFindFile(AchConfig::getInstance()->getBadgePictureName($row->id));
         if ($image) {
             $hoverImage = wfFindFile(AchConfig::getInstance()->getHoverPictureName($row->id));
             $badge['type_id'] = $row->id;
             $badge['enabled'] = $row->enabled;
             $badge['thumb_url'] = $image->createThumb(90);
             $badge['awarded_users'] = AchPlatinumService::getAwardedUserNames($row->id);
             $badge['is_sponsored'] = $row->sponsored;
             $badge['badge_tracking_url'] = $row->badge_tracking_url;
             $badge['hover_tracking_url'] = $row->hover_tracking_url;
             $badge['click_tracking_url'] = $row->click_tracking_url;
             $badge['hover_content_url'] = is_object($hoverImage) ? wfReplaceImageServer($hoverImage->getFullUrl()) : null;
             wfProfileOut(__METHOD__);
             return $badge;
         }
     }
     wfProfileOut(__METHOD__);
     return false;
 }
Example #3
0
					<input type="text" name="badge_impression_pixel_url"/>

					<label for="badge_redirect_url"><?php 
echo wfMsg('achievements-community-platinum-sponsored-badge-click-url-label');
?>
</label>
					<input type="text" name="badge_redirect_url"/>
				</div>
			</div>

			<div class="commands accent">
				<input type="submit" value="<?php 
echo wfMsg('achievements-community-platinum-create-badge');
?>
"/>
			</div>
		</fieldset>
	</form>

	<h2><?php 
echo wfMsg('achievements-community-platinum-current-badges');
?>
</h2>

	<?php 
foreach ($badges as $badge) {
    echo AchPlatinumService::getPlatinumForm($badge);
}
?>
</div>
 public static function resetPlatinumBadge()
 {
     global $wgRequest;
     $badge_type_id = (int) $wgRequest->getVal('type_id');
     $ret = null;
     if (!empty($badge_type_id)) {
         $ret = array('typeId' => $badge_type_id, 'output' => AchPlatinumService::getPlatinumForm(AchPlatinumService::getBadge($badge_type_id)));
     }
     return json_encode($ret);
 }