2 namespace wcf\system\condition\user\activity\event;
3 use wcf\data\object\type\ObjectTypeCache;
4 use wcf\data\user\activity\event\UserActivityEventList;
5 use wcf\data\DatabaseObjectList;
6 use wcf\system\condition\AbstractMultiSelectCondition;
7 use wcf\system\condition\IObjectListCondition;
11 * Condition implementation for the excluded object types of user activity events.
13 * @author Matthias Schmidt
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\Activity\Event
19 class UserActivityEventExcludedObjectTypeCondition extends AbstractMultiSelectCondition implements IObjectListCondition {
23 protected $description = 'wcf.global.multiSelect';
28 protected $fieldName = 'userActivityEventExcludedObjectTypeID';
33 protected $label = 'wcf.user.recentActivity.condition.excludedObjectType';
38 public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
39 if (!($objectList instanceof UserActivityEventList)) {
40 throw new \InvalidArgumentException("Object list is no instance of '".UserActivityEventList::class."', instance of '".get_class($objectList)."' given.");
43 $objectList->getConditionBuilder()->add('user_activity_event.objectTypeID NOT IN (?)', [$conditionData[$this->fieldName]]);
49 public function getOptions() {
50 $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.user.recentActivityEvent');
53 foreach ($objectTypes as $objectType) {
54 $options[$objectType->objectTypeID] = WCF::getLanguage()->getDynamicVariable('wcf.user.recentActivity.' . $objectType->objectType);