From 4909b2bd30de0cfcaf6a57ed85f93e6548d7c1f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Mon, 9 Apr 2018 20:32:42 +0200 Subject: [PATCH] Add basic reaction type database objects See #2508 --- .../data/reaction/type/ReactionType.class.php | 62 +++++++++++++++++++ .../type/ReactionTypeAction.class.php | 18 ++++++ .../type/ReactionTypeEditor.class.php | 30 +++++++++ .../reaction/type/ReactionTypeList.class.php | 20 ++++++ 4 files changed, 130 insertions(+) create mode 100644 wcfsetup/install/files/lib/data/reaction/type/ReactionType.class.php create mode 100644 wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php create mode 100644 wcfsetup/install/files/lib/data/reaction/type/ReactionTypeEditor.class.php create mode 100644 wcfsetup/install/files/lib/data/reaction/type/ReactionTypeList.class.php diff --git a/wcfsetup/install/files/lib/data/reaction/type/ReactionType.class.php b/wcfsetup/install/files/lib/data/reaction/type/ReactionType.class.php new file mode 100644 index 0000000000..9d443dff79 --- /dev/null +++ b/wcfsetup/install/files/lib/data/reaction/type/ReactionType.class.php @@ -0,0 +1,62 @@ + + * @package WoltLabSuite\Core\Data\Reaction\Type + * @since 3.2 + * + * @property-read integer $reactionTypeID unique id of the reaction type + * @property-read string $reactionTitle + * @property-read integer $type type of the reaction (1 is positive, 2 is neutral and 3 is negative) + * @property-read integer $showOrder position of the reaction type in relation to the other reaction types + * @property-read integer $iconType the icon type of the reaction + * @property-read string $iconFile the file location of the icon + * @property-read string $iconName the icon name + * @property-read string $iconColor the icon color + * @property-read integer $isDisabled is `1` if the ad is disabled and thus not shown, otherwise `0` + */ +class ReactionType extends DatabaseObject { + /** + * The type value, if this reaction type is a positive reaction. + * @var integer + */ + const REACTION_TYPE_POSITIVE = 1; + + /** + * The type value, if this reaction type is a neutral reaction. + * @var integer + */ + const REACTION_TYPE_NEUTRAL = 0; + + /** + * The type value, if this reaction type is a negative reaction. + * @var integer + */ + const REACTION_TYPE_NEGATIVE = -1; + + /** + * The iconType value, if this reaction type is an image. + * @var integer + */ + const ICON_TYPE_IMAGE = 1; + + /** + * The iconType value, if this reaction type is a font icon. + * @var integer + */ + const ICON_TYPE_ICON = 2; + + /** + * @inheritDoc + */ + public function getTitle() { + return WCF::getLanguage()->get($this->reactionTitle); + } +} diff --git a/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php new file mode 100644 index 0000000000..5a2f3eece4 --- /dev/null +++ b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php @@ -0,0 +1,18 @@ + + * @package WoltLabSuite\Core\Data\Reaction\Type + * @since 3.2 + * + * @method ReactionTypeEditor[] getObjects() + * @method ReactionTypeEditor getSingleObject() + */ +class ReactionTypeAction extends AbstractDatabaseObjectAction {} diff --git a/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeEditor.class.php b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeEditor.class.php new file mode 100644 index 0000000000..b026a6bece --- /dev/null +++ b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeEditor.class.php @@ -0,0 +1,30 @@ + + * @package WoltLabSuite\Core\Data\Reaction\Type + * @since 3.2 + * + * @mixin ReactionType + */ +class ReactionTypeEditor extends DatabaseObjectEditor implements IEditableCachedObject { + /** + * @inheritDoc + */ + protected static $baseClass = ReactionType::class; + + /** + * @inheritDoc + */ + public static function resetCache() { + // @TODO + } +} diff --git a/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeList.class.php b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeList.class.php new file mode 100644 index 0000000000..85e4ba9e61 --- /dev/null +++ b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeList.class.php @@ -0,0 +1,20 @@ + + * @package WoltLabSuite\Core\Data\Reaction\Type + * @since 3.2 + * + * @method ReactionType current() + * @method ReactionType[] getObjects() + * @method ReactionType|null search($objectID) + * @property ReactionType[] $objects + */ +class ReactionTypeList extends DatabaseObjectList {} -- 2.20.1