From a83d788ae9f95569a625865eb4448568d868346d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Sat, 29 Jul 2017 16:08:24 +0200 Subject: [PATCH] Add special trophies See #2315 --- com.woltlab.wcf/templates/messageSidebar.tpl | 10 ++++ com.woltlab.wcf/templates/settings.tpl | 30 +++++++++++ com.woltlab.wcf/templates/user.tpl | 9 ++++ .../templates/userProfilePreview.tpl | 10 ++++ com.woltlab.wcf/userGroupOption.xml | 9 ++++ .../lib/acp/form/TrophyEditForm.class.php | 6 +++ .../lib/data/trophy/TrophyAction.class.php | 22 +++++++- .../files/lib/data/user/UserProfile.class.php | 49 +++++++++++++++++ .../lib/data/user/UserProfileAction.class.php | 30 +++++++++++ .../user/trophy/UserTrophyAction.class.php | 30 ++++++++++- .../files/lib/form/SettingsForm.class.php | 51 +++++++++++++++++- wcfsetup/install/files/style/ui/trophy.scss | 52 +++++++++++++++++++ wcfsetup/install/lang/de.xml | 7 +++ wcfsetup/install/lang/en.xml | 7 +++ wcfsetup/setup/db/install.sql | 10 ++++ 15 files changed, 328 insertions(+), 4 deletions(-) diff --git a/com.woltlab.wcf/templates/messageSidebar.tpl b/com.woltlab.wcf/templates/messageSidebar.tpl index 004553e22c..ded7ae5baf 100644 --- a/com.woltlab.wcf/templates/messageSidebar.tpl +++ b/com.woltlab.wcf/templates/messageSidebar.tpl @@ -44,6 +44,16 @@
{@$userProfile->getRank()->getImage()}
{/if} {/if} + + {if MODULE_TROPHY && $__wcf->session->getPermission('user.profile.trophy.canSeeTrophies') && ($userProfile->isAccessible('canViewTrophies') || $userProfile->userID == $__wcf->session->userID) && $userProfile->getSpecialTrophies()|count} +
+ +
+ {/if} {else}
{if $userProfile->username} diff --git a/com.woltlab.wcf/templates/settings.tpl b/com.woltlab.wcf/templates/settings.tpl index c807aaa292..b8ee04b883 100644 --- a/com.woltlab.wcf/templates/settings.tpl +++ b/com.woltlab.wcf/templates/settings.tpl @@ -82,6 +82,36 @@ {event name='styleFields'} {/if} + + {if MODULE_TROPHY && $__wcf->getSession()->getPermission('user.profile.trophy.maxUserSpecialTrophies') > 0 && $availableTrophies|count} +
+

{lang}wcf.user.trophy.trophies{/lang}

+ +
{lang}wcf.user.trophy.specialTrophies{/lang}
+
+
    + {if $__wcf->getSession()->getPermission('user.profile.trophy.maxUserSpecialTrophies') == 1} + {foreach from=$availableTrophies item=trophy} +
  • + {/foreach} + {else} + {foreach from=$availableTrophies item=trophy} +
  • + {/foreach} + {/if} +
+ {if $errorField == 'specialTrophies'} + + {lang}wcf.user.trophy.specialTrophies.error.{$errorType}{/lang} + + {/if} + {lang}wcf.user.trophy.specialTrophies.description{/lang} +
+ + + {event name='trophyFields'} +
+ {/if} {/if} {if !$optionTree|empty} diff --git a/com.woltlab.wcf/templates/user.tpl b/com.woltlab.wcf/templates/user.tpl index 40b2f50785..2dac794e66 100644 --- a/com.woltlab.wcf/templates/user.tpl +++ b/com.woltlab.wcf/templates/user.tpl @@ -172,6 +172,15 @@
+ {if MODULE_TROPHY && $__wcf->session->getPermission('user.profile.trophy.canSeeTrophies') && ($user->isAccessible('canViewTrophies') || $user->userID == $__wcf->session->userID) && $user->getSpecialTrophies()|count} +
+ +
+ {/if}
    {if !$user->isProtected()} {if $user->isVisibleOption('gender') && $user->gender}
  • {lang}wcf.user.gender.{if $user->gender == 1}male{else}female{/if}{/lang}
  • {/if} diff --git a/com.woltlab.wcf/templates/userProfilePreview.tpl b/com.woltlab.wcf/templates/userProfilePreview.tpl index 9366018be7..a115d09221 100644 --- a/com.woltlab.wcf/templates/userProfilePreview.tpl +++ b/com.woltlab.wcf/templates/userProfilePreview.tpl @@ -10,6 +10,16 @@
    {include file='userInformation'} + + {if MODULE_TROPHY && $__wcf->session->getPermission('user.profile.trophy.canSeeTrophies') && ($user->isAccessible('canViewTrophies') || $user->userID == $__wcf->session->userID) && $user->getSpecialTrophies()|count} +
    + +
    + {/if} {if $user->canViewOnlineStatus() && $user->getLastActivityTime()}
    diff --git a/com.woltlab.wcf/userGroupOption.xml b/com.woltlab.wcf/userGroupOption.xml index b67b60dd9e..c24c47a514 100644 --- a/com.woltlab.wcf/userGroupOption.xml +++ b/com.woltlab.wcf/userGroupOption.xml @@ -740,6 +740,15 @@ png 1 module_trophy +