<options>module_trophy</options>
<icon>fa-plus</icon>
</acpmenuitem>
+ <acpmenuitem name="wcf.acp.menu.link.userTrophy.list">
+ <controller>wcf\acp\page\UserTrophyListPage</controller>
+ <parent>wcf.acp.menu.link.trophy</parent>
+ <permissions>admin.trophy.canAwardTrophy</permissions>
+ <options>module_trophy</options>
+ </acpmenuitem>
<!-- /trophy -->
<!-- /user -->
--- /dev/null
+{include file='header' pageTitle='wcf.acp.menu.link.userTrophy.list'}
+
+<script data-relocate="true">
+ //<![CDATA[
+ $(function() {
+ new WCF.Search.User('#username');
+ new WCF.Action.Delete('wcf\\data\\user\\trophy\\UserTrophyAction', '.userTrophyRow');
+ });
+ //]]>
+</script>
+
+<header class="contentHeader">
+ <div class="contentHeaderTitle">
+ <h1 class="contentTitle">{lang}wcf.acp.menu.link.userTrophy.list{/lang}</h1>
+ </div>
+
+ <nav class="contentHeaderNavigation">
+ <ul>
+ <li><a href="{link controller='UserTrophyAdd'}{/link}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.menu.link.userTrophy.add{/lang}</span></a></li>
+
+ {event name='contentHeaderNavigation'}
+ </ul>
+ </nav>
+</header>
+
+<form method="post" action="{link controller='UserTrophyList'}{/link}">
+ <section class="section">
+ <h2 class="sectionTitle">{lang}wcf.global.filter{/lang}</h2>
+
+ <div class="row rowColGap formGrid">
+ <dl class="col-xs-12 col-md-6">
+ <dt></dt>
+ <dd>
+ <select name="trophyID" id="trophyID" class="long">
+ <option value="0">{lang}wcf.global.noSelection{/lang}</option>
+
+ {foreach from=$trophyCategories item=category}
+ <option value="0" disabled>{$category->getTitle()}</option>
+ {foreach from=$category->getTrophies(true) item=trophy}
+ <option value="{@$trophy->trophyID}"{if $trophy->trophyID == $trophyID} selected{/if}> {$trophy->getTitle()}</option>
+ {/foreach}
+ {/foreach}
+ </select>
+ </dd>
+ </dl>
+
+ <dl class="col-xs-12 col-md-6">
+ <dt></dt>
+ <dd>
+ <input type="text" id="username" name="username" value="{$username}" placeholder="{lang}wcf.user.username{/lang}" class="long">
+ </dd>
+ </dl>
+
+ {event name='filterFields'}
+ </div>
+
+ <div class="formSubmit">
+ <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
+
+ {@SECURITY_TOKEN_INPUT_TAG}
+ </div>
+ </section>
+</form>
+
+{hascontent}
+ <div class="paginationTop">
+ {content}
+ {assign var='linkParameters' value=''}
+ {if $trophyID}{capture append=linkParameters}&trophyID={@$trophyID|rawurlencode}{/capture}{/if}
+ {if $username}{capture append=linkParameters}&username={@$username|rawurlencode}{/capture}{/if}
+
+ {pages print=true assign=pagesLinks controller='UserTrophyList' link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder$linkParameters"}
+ {/content}
+ </div>
+{/hascontent}
+
+{if $objects|count}
+ <div class="section tabularBox">
+
+ <table class="table">
+ <thead>
+ <tr>
+ <th class="columnID columnUserTrophyID{if $sortField == 'userTrophyID'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='UserTrophyList'}pageNo={@$pageNo}&sortField=userTrophyID&sortOrder={if $sortField == 'userTrophyID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
+ <th class="columnText columnUsername{if $sortField == 'userID'} active {@$sortOrder}{/if}"><a href="{link controller='UserTrophyList'}pageNo={@$pageNo}&sortField=userID&sortOrder={if $sortField == 'userID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.user.username{/lang}</a></th>
+ <th class="columnTitle columnTrophy{if $sortField == 'trophyID'} active {@$sortOrder}{/if}"><a href="{link controller='UserTrophyList'}pageNo={@$pageNo}&sortField=trophyID&sortOrder={if $sortField == 'trophyID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.acp.trophy{/lang}</a></th>
+ <th class="columnDate columnUserTrophyTime{if $sortField == 'time'} active {@$sortOrder}{/if}"><a href="{link controller='UserTrophyList'}pageNo={@$pageNo}&sortField=time&sortOrder={if $sortField == 'time' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.global.date{/lang}</a></th>
+
+ {event name='columnHeads'}
+ </tr>
+ </thead>
+
+ <tbody>
+ {foreach from=$objects item=userTrophy}
+ <tr class="userTrophyRow">
+ <td class="columnIcon">
+ <a href="{link controller='UserTrophyEdit' id=$userTrophy->userTrophyID}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 fa-pencil"></span></a>
+ <span class="icon icon16 fa-times pointer jsDeleteButton jsTooltip" data-confirm-message-html="{lang __encode="true"}wcf.acp.trophy.userTrophy.delete.confirmMessage{/lang}" data-object-id="{@$userTrophy->getObjectID()}" title="{lang}wcf.global.button.delete{/lang}"></span>
+ </td>
+ <td class="columnID columnUserTrophyID">{@$userTrophy->userTrophyID}</td>
+ <td class="columnText columnUsername"><a href="{link controller='UserEdit' id=$userTrophy->userID}{/link}" title="{lang}wcf.acp.user.edit{/lang}">{$userTrophy->getUserProfile()->username}</a></td>
+ <td class="columnTitle columnTrophy">{$userTrophy->getTrophy()->getTitle()}</td>
+ <td class="columnDate columnUserTrophyTime">{@$userTrophy->time|time}</td>
+
+ {event name='columns'}
+ </tr>
+ {/foreach}
+ </tbody>
+ </table>
+
+ </div>
+
+
+ <footer class="contentFooter">
+ {hascontent}
+ <div class="paginationBottom">
+ {content}{@$pagesLinks}{/content}
+ </div>
+ {/hascontent}
+
+ <nav class="contentFooterNavigation">
+ <ul>
+ <li><a href="{link controller='UserTrophyAdd'}{/link}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.menu.link.userTrophy.add{/lang}</span></a></li>
+
+ {event name='contentHeaderNavigation'}
+ </ul>
+ </nav>
+ </footer>
+{else}
+ <p class="info">{lang}wcf.global.noItems{/lang}</p>
+{/if}
+
+{include file='footer'}
--- /dev/null
+<?php
+namespace wcf\acp\page;
+use wcf\data\trophy\category\TrophyCategoryCache;
+use wcf\data\trophy\Trophy;
+use wcf\data\user\trophy\UserTrophyList;
+use wcf\page\SortablePage;
+use wcf\system\WCF;
+use wcf\util\StringUtil;
+
+/**
+ * User trophy list page.
+ *
+ * @author Joshua Ruesweg
+ * @copyright 2001-2017 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Acp\Page
+ * @since 3.1
+ */
+class UserTrophyListPage extends SortablePage {
+ /**
+ * @inheritDoc
+ */
+ public $activeMenuItem = 'wcf.acp.menu.link.userTrophy.list';
+
+ /**
+ * @inheritDoc
+ */
+ public $neededModules = ['MODULE_TROPHY'];
+
+ /**
+ * @inheritDoc
+ */
+ public $neededPermissions = ['admin.trophy.canAwardTrophy'];
+
+ /**
+ * @inheritDoc
+ */
+ public $defaultSortField = 'time';
+
+ /**
+ * @inheritDoc
+ */
+ public $defaultSortOrder = 'DESC';
+
+ /**
+ * @inheritDoc
+ */
+ public $objectListClassName = UserTrophyList::class;
+
+ /**
+ * @inheritDoc
+ */
+ public $validSortFields = ['userTrophyID', 'trophyID', 'userID', 'time'];
+
+ /**
+ * The filter value for the username search.
+ * @var string
+ */
+ public $username = '';
+
+ /**
+ * The filter value for the trophy id.
+ * @var integer
+ */
+ public $trophyID = 0;
+
+ /**
+ * The trophy instance for the filter value.
+ * @var Trophy
+ */
+ public $trophy = null;
+
+ /**
+ * @inheritdoc
+ */
+ public function readParameters() {
+ parent::readParameters();
+
+ if (isset($_REQUEST['username'])) $this->username = StringUtil::trim($_REQUEST['username']);
+ if (isset($_REQUEST['trophyID'])) {
+ $this->trophyID = intval($_REQUEST['trophyID']);
+ $this->trophy = new Trophy($this->trophyID);
+
+ if (!$this->trophy->getObjectID()) {
+ $this->trophyID = 0;
+ }
+ }
+ }
+
+ /**
+ * @inheritdoc
+ */
+ protected function initObjectList() {
+ parent::initObjectList();
+
+ if ($this->trophyID) {
+ $this->objectList->getConditionBuilder()->add('user_trophy.trophyID = ?', [$this->trophyID]);
+ }
+
+ if ($this->username) {
+ $this->objectList->getConditionBuilder()->add('user_trophy.userID IN (SELECT userID FROM wcf' . WCF_N . '_user WHERE username LIKE ?)', ['%' . $this->username . '%']);
+ }
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function assignVariables() {
+ parent::assignVariables();
+
+ WCF::getTPL()->assign([
+ 'trophyID' => $this->trophyID,
+ 'username' => $this->username,
+ 'trophyCategories' => TrophyCategoryCache::getInstance()->getCategories(),
+ ]);
+
+ }
+}
foreach ($updateUserTrophies as $userID => $count) {
(new UserAction([$userID], 'update', [
'counters' => [
- 'trophies' => $count
+ 'trophyPoints' => $count
]
]))->executeAction();
}
<item name="wcf.acp.menu.link.trophy.list"><![CDATA[Trophäen]]></item>
<item name="wcf.acp.menu.link.trophy.add"><![CDATA[Trophäe hinzufügen]]></item>
<item name="wcf.acp.menu.link.trophy.edit"><![CDATA[Trophäe bearbeiten]]></item>
+ <item name="wcf.acp.menu.link.userTrophy.list"><![CDATA[Vergebene Trophäen]]></item>
+ <item name="wcf.acp.menu.link.userTrophy.edit"><![CDATA[Vergebene Trophäe bearbeiten]]></item>
<item name="wcf.acp.menu.link.devtools"><![CDATA[Entwickler-Werkzeuge]]></item>
<item name="wcf.acp.menu.link.devtools.project.list"><![CDATA[Projekte auflisten]]></item>
</category>
</category>
<category name="wcf.acp.trophy">
+ <item name="wcf.acp.trophy"><![CDATA[Trophäe]]></item>
<item name="wcf.acp.trophy.description"><![CDATA[Beschreibung]]></item>
<item name="wcf.acp.trophy.category"><![CDATA[Kategorie]]></item>
<item name="wcf.acp.trophy.isDisabled"><![CDATA[Trophäe deaktivieren]]></item>
<item name="wcf.acp.trophy.conditions.description"><![CDATA[Der aktive Benutzer muss die folgenden Bedingungen erfüllen, damit der die Trophäe vergeben wird.]]></item>
<item name="wcf.acp.trophy.conditions.error.noConditions"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} keine Bedingungen ausgewählt.]]></item>
<item name="wcf.acp.trophy.delete.confirmMessage"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} die Trophäe <span class="confirmationObject">{$trophy->getTitle()}</span> wirklich löschen?]]></item>
+ <item name="wcf.acp.trophy.userTrophy.delete.confirmMessage"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} die Trophäe <span class="confirmationObject">{$userTrophy->getTrophy()->getTitle()}</span> von <span class="confirmationObject">{$userTrophy->getUserProfile()->username}</span> wirklich löschen?]]></item>
</category>
<category name="wcf.user.usersOnline">
<item name="wcf.acp.menu.link.trophy.list"><![CDATA[Trophies]]></item>
<item name="wcf.acp.menu.link.trophy.add"><![CDATA[Add Trophy]]></item>
<item name="wcf.acp.menu.link.trophy.edit"><![CDATA[Edit Trophy]]></item>
+ <item name="wcf.acp.menu.link.userTrophy.list"><![CDATA[Assigned Trophies]]></item>
+ <item name="wcf.acp.menu.link.userTrophy.edit"><![CDATA[Edit assigned Trophy]]></item>
</category>
<category name="wcf.acp.notice">
</category>
<category name="wcf.acp.trophy">
+ <item name="wcf.acp.trophy"><![CDATA[Trophy]]></item>
<item name="wcf.acp.trophy.description"><![CDATA[Description]]></item>
<item name="wcf.acp.trophy.category"><![CDATA[Category]]></item>
<item name="wcf.acp.trophy.isDisabled"><![CDATA[Disable Trophy]]></item>
<item name="wcf.acp.trophy.conditions.description"><![CDATA[The users need to fulfill the following conditions to automatically be awarded with the trophy.]]></item>
<item name="wcf.acp.trophy.conditions.error.noConditions"><![CDATA[You have not provided any conditions yet.]]></item>
<item name="wcf.acp.trophy.delete.confirmMessage"><![CDATA[Do you really want to delete the trophy <span class="confirmationObject">{$trophy->getTitle()}</span>?]]></item>
+ <item name="wcf.acp.trophy.userTrophy.delete.confirmMessage"><![CDATA[Do you really want to delete the trophy <span class="confirmationObject">{$userTrophy->getTrophy()->getTitle()}</span> from <span class="confirmationObject">{$userTrophy->getUserProfile()->username}</span>?]]></item>
</category>
<category name="wcf.user.usersOnline">