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