--- /dev/null
+<span
+ class="icon icon{$size} fa-{$trophy->iconName} trophyIcon jsTooltip"
+ style="color: {$trophy->iconColor}; background-color: {$trophy->badgeColor}"
+ data-trophy-id="{$trophy->trophyID}"
+ title="{$trophy->getTitle()}"
+></span>
* @property-read string $title the trophy title
* @property-read integer $description the trophy description
* @property-read integer $categoryID the categoryID of the trophy
- * @property-read integer $sidebarSize the trophy size in the message sidebar
* @property-read integer $type the trophy type
* @property-read string $iconFile the file location of the icon
* @property-read string $iconName the icon name
* @property-read string $iconColor the icon color
- * @property-read string $badgeName the icon badge name
* @property-read string $badgeColor the icon badge color
- * @property-read string $customClassName a custom class for the icon
* @property-read integer $isDisabled `1` if the trophy is disabled
* @property-read integer $awardAutomatically `1` if the trophy is awarded automatically
*/
const TYPE_IMAGE = 1;
/**
- * The type value, if this trophy is a icon trophy (based on CSS icons).
+ * The type value, if this trophy is a badge trophy (based on CSS icons).
* @var integer
*/
- const TYPE_FA = 2;
+ const TYPE_BADGE = 2;
+
+ /**
+ * The default icon size.
+ */
+ const DEFAULT_SIZE = 32;
/**
* @inheritDoc
* @param integer $size
* @return string
*/
- public function renderTrophy($size = null) {
- if ($size === null) {
- $size = $this->sidebarSize;
- }
+ public function renderTrophy($size = self::DEFAULT_SIZE) {
switch ($this->type) {
case self::TYPE_IMAGE: {
break;
}
- case self::TYPE_FA:
- // @TODO
+ case self::TYPE_BADGE:
+ return WCF::getTPL()->fetch('trophyBadge', 'wcf', [
+ 'size' => $size,
+ 'trophy' => $this
+ ], true);
break;
default:
title VARCHAR(255),
description MEDIUMTEXT,
categoryID INT(10) NOT NULL,
- sidebarSize SMALLINT(2),
type SMALLINT(1) DEFAULT 1,
iconFile MEDIUMTEXT,
iconName VARCHAR(255),
iconColor VARCHAR(255),
- badgeName VARCHAR(255),
badgeColor VARCHAR(255),
- customClassName VARCHAR(255),
isDisabled TINYINT(1) NOT NULL DEFAULT 0,
awardAutomatically TINYINT(1) NOT NULL DEFAULT 1,
KEY(categoryID)
--- /dev/null
+<span
+ class="icon icon{$size} fa-{$trophy->iconName} trophyIcon jsTooltip"
+ style="color: {$trophy->iconColor}; background-color: {$trophy->badgeColor}"
+ data-trophy-id="{$trophy->trophyID}"
+ title="{$trophy->getTitle()}"
+></span>