</dl>
{/if}
+ <dl{if $errorField == 'hideTitle'} class="formError"{/if}>
+ <dt></dt>
+ <dd>
+ <label><input type="checkbox" id="hideTitle" name="hideTitle" value="1"{if $hideTitle} checked{/if}> {lang}wcf.acp.user.rank.hideTitle{/lang}</label>
+ {if $errorField == 'hideTitle'}
+ <small class="innerError">
+ {lang}wcf.acp.user.rank.hideTitle.error.{@$errorType}{/lang}
+ </small>
+ {/if}
+ <small>{lang}wcf.acp.user.rank.hideTitle.description{/lang}</small>
+ </dd>
+ </dl>
+
{event name='imageFields'}
</section>
*/
public $requiredGender = 0;
+ /**
+ * hide generic user title
+ * @var integer
+ */
+ public $hideTitle = 0;
+
/**
* list of pre-defined css class names
* @var string[]
if (isset($_POST['rankImage'])) $this->rankImage = StringUtil::trim($_POST['rankImage']);
if (isset($_POST['repeatImage'])) $this->repeatImage = intval($_POST['repeatImage']);
if (isset($_POST['requiredGender'])) $this->requiredGender = intval($_POST['requiredGender']);
+ if (isset($_POST['hideTitle'])) $this->hideTitle = intval($_POST['hideTitle']);
}
/**
if ($this->requiredGender < 0 || $this->requiredGender > 2) {
$this->requiredGender = 0;
}
+
+ if ($this->hideTitle && !$this->rankImage) {
+ throw new UserInputException('hideTitle', 'rankImage');
+ }
}
/**
'requiredPoints' => $this->requiredPoints,
'rankImage' => $this->rankImage,
'repeatImage' => $this->repeatImage,
- 'requiredGender' => $this->requiredGender
+ 'requiredGender' => $this->requiredGender,
+ 'hideTitle' => ($this->hideTitle ? 1 : 0)
])]);
$this->objectAction->executeAction();
// reset values
$this->rankTitle = $this->cssClassName = $this->customCssClassName = $this->rankImage = '';
- $this->groupID = $this->requiredPoints = $this->requiredGender = 0;
+ $this->groupID = $this->requiredPoints = $this->requiredGender = $this->hideTitle = 0;
$this->repeatImage = 1;
I18nHandler::getInstance()->reset();
'requiredPoints' => $this->requiredPoints,
'rankImage' => $this->rankImage,
'repeatImage' => $this->repeatImage,
- 'requiredGender' => $this->requiredGender
+ 'requiredGender' => $this->requiredGender,
+ 'hideTitle' => $this->hideTitle
]);
}
}
'requiredPoints' => $this->requiredPoints,
'rankImage' => $this->rankImage,
'repeatImage' => $this->repeatImage,
- 'requiredGender' => $this->requiredGender
+ 'requiredGender' => $this->requiredGender,
+ 'hideTitle' => $this->hideTitle
])]);
$this->objectAction->executeAction();
$this->saved();
$this->requiredGender = $this->rank->requiredGender;
$this->repeatImage = $this->rank->repeatImage;
$this->rankImage = $this->rank->rankImage;
+ $this->hideTitle = $this->rank->hideTitle;
}
}
*/
public function getUserTitle() {
if ($this->userTitle) return $this->userTitle;
- if ($this->getRank()) return WCF::getLanguage()->get($this->getRank()->rankTitle);
+ if ($this->getRank() && $this->getRank()->showTitle()) return WCF::getLanguage()->get($this->getRank()->rankTitle);
return '';
}
'cssClassName' => $this->cssClassName,
'rankImage' => $this->rankImage,
'repeatImage' => $this->repeatImage,
- 'requiredGender' => $this->requiredGender
+ 'requiredGender' => $this->requiredGender,
+ 'hideTitle' => $this->hideTitle
]);
}
else {
* @property-read string $rankImage (WCF relative) path to the image displayed next to the rank or empty if no rank image exists
* @property-read integer $repeatImage number of times the rank image is displayed
* @property-read integer $requiredGender numeric representation of the user's gender required for the user rank (see `UserProfile::GENDER_*` constants) or 0 if no specific gender is required
+ * @property-read integer $hideTitle hides the generic title of the rank, but not custom titles, `0` to show the title at all times
*/
class UserRank extends DatabaseObject {
/**
return '';
}
+
+ /**
+ * Returns true if the generic rank title should be displayed.
+ *
+ * @return boolean
+ */
+ public function showTitle() {
+ return !$this->rankImage || !$this->hideTitle;
+ }
}
<item name="wcf.acp.user.rank.currentImage"><![CDATA[Aktuelle Ranggrafik]]></item>
<item name="wcf.acp.user.rank.delete.sure"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} den Benutzerrang <span class="confirmationObject">{$userRank->rankTitle|language}</span> wirklich löschen?]]></item>
<item name="wcf.acp.user.rank.edit"><![CDATA[Benutzerrang bearbeiten]]></item>
+ <item name="wcf.acp.user.rank.hideTitle"><![CDATA[Rangbezeichnung ausblenden]]></item>
+ <item name="wcf.acp.user.rank.hideTitle.description"><![CDATA[Es wird nur die Ranggrafik angezeigt. Dies gilt nicht, wenn der Benutzer einen individuellen Titel eingestellt hat.]]></item>
+ <item name="wcf.acp.user.rank.hideTitle.error.rankImage"><![CDATA[Diese Option erfordert eine gültige Ranggrafik.]]></item>
<item name="wcf.acp.user.rank.image"><![CDATA[Ranggrafik]]></item>
<item name="wcf.acp.user.rank.list"><![CDATA[Benutzerränge]]></item>
<item name="wcf.acp.user.rank.rankImage.description"><![CDATA[Der Pfad zur Ranggrafik kann relativ zum WCF-Verzeichnis oder absolut angegeben werden.]]></item>
<item name="wcf.acp.user.rank.currentImage"><![CDATA[Current Rank Image]]></item>
<item name="wcf.acp.user.rank.delete.sure"><![CDATA[Do you really want to delete the user rank <span class="confirmationObject">{$userRank->rankTitle|language}</span>?]]></item>
<item name="wcf.acp.user.rank.edit"><![CDATA[Edit User Rank]]></item>
+ <item name="wcf.acp.user.rank.hideTitle"><![CDATA[Hide title]]></item>
+ <item name="wcf.acp.user.rank.hideTitle.description"><![CDATA[Hides the title of this rank. Does not work for users that have an individual title set.]]></item>
+ <item name="wcf.acp.user.rank.hideTitle.error.rankImage"><![CDATA[This option requires a valid rank image.]]></item>
<item name="wcf.acp.user.rank.image"><![CDATA[Rank Image]]></item>
<item name="wcf.acp.user.rank.list"><![CDATA[User Ranks]]></item>
<item name="wcf.acp.user.rank.rankImage.description"><![CDATA[The path must be either relative to WCF’s directory or absolute.]]></item>
cssClassName VARCHAR(255) NOT NULL DEFAULT '',
rankImage VARCHAR(255) NOT NULL DEFAULT '',
repeatImage TINYINT(3) NOT NULL DEFAULT 1,
- requiredGender TINYINT(1) NOT NULL DEFAULT 0
+ requiredGender TINYINT(1) NOT NULL DEFAULT 0,
+ hideTitle TINYINT(1) NOT NULL DEFAULT 0
);
DROP TABLE IF EXISTS wcf1_user_storage;