2 declare(strict_types=1);
3 namespace wcf\system\condition\user\activity\event;
4 use wcf\data\object\type\ObjectTypeCache;
5 use wcf\data\user\activity\event\UserActivityEventList;
6 use wcf\data\DatabaseObjectList;
7 use wcf\system\condition\AbstractMultiSelectCondition;
8 use wcf\system\condition\IObjectListCondition;
12 * Condition implementation for the excluded object types of user activity events.
14 * @author Matthias Schmidt
15 * @copyright 2001-2018 WoltLab GmbH
16 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
17 * @package WoltLabSuite\Core\System\Condition\User\Activity\Event
20 class UserActivityEventExcludedObjectTypeCondition extends AbstractMultiSelectCondition implements IObjectListCondition {
24 protected $description = 'wcf.global.multiSelect';
29 protected $fieldName = 'userActivityEventExcludedObjectTypeID';
34 protected $label = 'wcf.user.recentActivity.condition.excludedObjectType';
39 public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
40 if (!($objectList instanceof UserActivityEventList)) {
41 throw new \InvalidArgumentException("Object list is no instance of '".UserActivityEventList::class."', instance of '".get_class($objectList)."' given.");
44 $objectList->getConditionBuilder()->add('user_activity_event.objectTypeID NOT IN (?)', [$conditionData[$this->fieldName]]);
50 public function getOptions() {
51 $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.user.recentActivityEvent');
54 foreach ($objectTypes as $objectType) {
55 $options[$objectType->objectTypeID] = WCF::getLanguage()->getDynamicVariable('wcf.user.recentActivity.' . $objectType->objectType);