From 8c892ed331d3ebd424e95cb0d700b797b444b1d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Mon, 3 Jul 2017 22:00:54 +0200 Subject: [PATCH] Add trophy conditions See #2315 --- com.woltlab.wcf/objectType.xml | 73 +++++++++++++++++++ com.woltlab.wcf/objectTypeDefinition.xml | 5 ++ .../TrophyConditionHandler.class.php | 54 ++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/trophy/condition/TrophyConditionHandler.class.php diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index c6ecef933c..4b22900906 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -591,6 +591,79 @@ + + + com.woltlab.wcf.username + com.woltlab.wcf.condition.trophy + wcf\system\condition\UserUsernameCondition + general + + + com.woltlab.wcf.email + com.woltlab.wcf.condition.trophy + wcf\system\condition\UserEmailCondition + general + + + com.woltlab.wcf.userGroup + com.woltlab.wcf.condition.trophy + wcf\system\condition\UserGroupCondition + general + + + com.woltlab.wcf.languages + com.woltlab.wcf.condition.trophy + wcf\system\condition\UserLanguageCondition + general + + + com.woltlab.wcf.registrationDate + com.woltlab.wcf.condition.trophy + wcf\system\condition\UserRegistrationDateCondition + general + + + com.woltlab.wcf.registrationDateInterval + com.woltlab.wcf.condition.trophy + wcf\system\condition\UserRegistrationDateIntervalCondition + general + + + com.woltlab.wcf.avatar + com.woltlab.wcf.condition.trophy + wcf\system\condition\UserAvatarCondition + general + + + com.woltlab.wcf.state + com.woltlab.wcf.condition.trophy + wcf\system\condition\UserStateCondition + general + + + com.woltlab.wcf.activityPoints + com.woltlab.wcf.condition.trophy + wcf\system\condition\UserIntegerPropertyCondition + contents + activityPoints + 0 + + + com.woltlab.wcf.likesReceived + com.woltlab.wcf.condition.trophy + wcf\system\condition\UserIntegerPropertyCondition + contents + likesReceived + 0 + + + com.woltlab.wcf.userOptions + com.woltlab.wcf.condition.trophy + wcf\system\condition\UserOptionsCondition + userOptions + + + com.woltlab.wcf.page diff --git a/com.woltlab.wcf/objectTypeDefinition.xml b/com.woltlab.wcf/objectTypeDefinition.xml index 44b1c54a92..7e0f705d1b 100644 --- a/com.woltlab.wcf/objectTypeDefinition.xml +++ b/com.woltlab.wcf/objectTypeDefinition.xml @@ -154,6 +154,11 @@ wcf\system\condition\IUserCondition + + com.woltlab.wcf.condition.trophy + wcf\system\condition\IUserCondition + + com.woltlab.wcf.condition.notice wcf\system\condition\IContentCondition diff --git a/wcfsetup/install/files/lib/system/trophy/condition/TrophyConditionHandler.class.php b/wcfsetup/install/files/lib/system/trophy/condition/TrophyConditionHandler.class.php new file mode 100644 index 0000000000..b9d65916cb --- /dev/null +++ b/wcfsetup/install/files/lib/system/trophy/condition/TrophyConditionHandler.class.php @@ -0,0 +1,54 @@ + + * @package WoltLabSuite\Core\System\Trophy\Condition + * @since 3.1 + */ +class TrophyConditionHandler extends SingletonFactory { + /** + * definition name for trophy conditions + * @var string + */ + const CONDITION_DEFINITION_NAME = 'com.woltlab.wcf.condition.trophy'; + + /** + * list of grouped trophy condition object types + * @var ObjectType[][] + */ + protected $groupedObjectTypes = []; + + /** + * @inheritDoc + */ + protected function init() { + $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes(self::CONDITION_DEFINITION_NAME); + + foreach ($objectTypes as $objectType) { + if (!$objectType->conditiongroup) continue; + + if (!isset($this->groupedObjectTypes[$objectType->conditiongroup])) { + $this->groupedObjectTypes[$objectType->conditiongroup] = []; + } + + $this->groupedObjectTypes[$objectType->conditiongroup][$objectType->objectTypeID] = $objectType; + } + } + + /** + * Returns the list of grouped trophy condition object types. + * + * @return ObjectType[][] + */ + public function getGroupedObjectTypes() { + return $this->groupedObjectTypes; + } +} -- 2.20.1