2 declare(strict_types=1);
3 namespace wcf\system\condition\user\trophy;
4 use wcf\data\trophy\category\TrophyCategoryCache;
5 use wcf\data\user\trophy\UserTrophyList;
6 use wcf\data\DatabaseObjectList;
7 use wcf\system\condition\AbstractMultiSelectCondition;
8 use wcf\system\condition\IObjectListCondition;
11 * Condition implementation for the excluded trophies.
13 * @author Joshua Ruesweg
14 * @copyright 2001-2018 WoltLab GmbH
15 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
16 * @package WoltLabSuite\Core\System\Condition\User\Trophy
19 class UserTrophyExcludedTrophyCategoriesCondition extends AbstractMultiSelectCondition implements IObjectListCondition {
23 protected $description = 'wcf.global.multiSelect';
28 protected $fieldName = 'userTrophyExcludedTrophyCategories';
33 protected $label = 'wcf.user.trophy.condition.excludedTrophyCategories';
38 public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
39 if (!($objectList instanceof UserTrophyList)) {
40 throw new \InvalidArgumentException("Object list is no instance of '".UserTrophyList::class."', instance of '".get_class($objectList)."' given.");
43 $objectList->getConditionBuilder()->add('user_trophy.category NOT IN (?)', [$conditionData[$this->fieldName]]);
49 public function getOptions() {
50 $categories = TrophyCategoryCache::getInstance()->getCategories();
53 foreach ($categories as $category) {
54 $options[$category->categoryID] = $category->getTitle();