2 namespace wcf\system\condition\user\trophy;
3 use wcf\data\trophy\TrophyCache;
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-2019 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 UserTrophyExcludedTrophiesCondition extends AbstractMultiSelectCondition implements IObjectListCondition {
22 protected $description = 'wcf.global.multiSelect';
27 protected $fieldName = 'userTrophyExcludedTrophies';
32 protected $label = 'wcf.user.trophy.condition.excludedTrophies';
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.trophyID NOT IN (?)', [$conditionData[$this->fieldName]]);
48 public function getOptions() {
49 $trophies = TrophyCache::getInstance()->getTrophies();
52 foreach ($trophies as $trophy) {
53 $options[$trophy->trophyID] = $trophy->getTitle();