<classname>wcf\system\user\notification\event\ExpiringPaidSubscriptionUserUserNotificationEvent</classname>
<options>module_paid_subscription</options>
</event>
+
+ <event>
+ <name>received</name>
+ <objecttype>com.woltlab.wcf.userTrophy.notification</objecttype>
+ <classname>wcf\system\user\notification\event\UserTrophyReceivedNotificationEvent</classname>
+ <preset>1</preset>
+ <options>module_trophy</options>
+ <permissions>user.profile.trophy.canSeeTrophies</permissions>
+ </event>
</import>
</data>
use wcf\data\user\UserAction;
use wcf\data\AbstractDatabaseObjectAction;
use wcf\system\exception\PermissionDeniedException;
+use wcf\system\user\notification\object\UserTrophyNotificationObject;
+use wcf\system\user\notification\UserNotificationHandler;
/**
* Provides user trophy actions.
]
]))->executeAction();
+ UserNotificationHandler::getInstance()->fireEvent('received', 'com.woltlab.wcf.userTrophy.notification', new UserTrophyNotificationObject($returnValues), [
+ $returnValues->userID
+ ]);
+
return $returnValues;
}
--- /dev/null
+<?php
+namespace wcf\system\user\notification\event;
+
+/**
+ * Notification event for receiving a user trophy.
+ *
+ * @author Joshua Ruesweg
+ * @copyright 2001-2017 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\User\Notification\Object\Type
+ */
+class UserTrophyReceivedNotificationEvent extends AbstractUserNotificationEvent {
+ /**
+ * @inheritDoc
+ */
+ public function getTitle() {
+ return $this->getLanguage()->get('wcf.user.notification.com.woltlab.wcf.userTrophy.notification.received');
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getMessage() {
+ return $this->getLanguage()->getDynamicVariable('wcf.user.notification.trophy.received.message', [
+ 'userTrophy' => $this->userNotificationObject,
+ 'author' => $this->author
+ ]);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function supportsEmailNotification() {
+ return false;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getLink() {
+ return $this->userNotificationObject->getTrophy()->getLink();
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function checkAccess() {
+ return $this->userNotificationObject->getDecoratedObject()->canSee();
+ }
+}
use wcf\data\DatabaseObjectDecorator;
/**
- * Represents a following user as a notification object.
+ * Represents a user trophy notification object.
*
* @author Joshua Ruesweg
* @copyright 2001-2017 WoltLab GmbH
*/
class UserTrophyNotificationObject extends DatabaseObjectDecorator implements IUserNotificationObject {
/**
- * @inheritdoc
+ * @inheritDoc
*/
protected static $baseClass = UserTrophy::class;
/**
- * @inheritdoc
+ * @inheritDoc
*/
public function getTitle() {
return $this->getDecoratedObject()->getTrophy()->getTitle();
}
/**
- * @inheritdoc
+ * @inheritDoc
*/
public function getURL() {
return $this->getDecoratedObject()->getTrophy()->getLink();
}
/**
- * @inheritdoc
+ * @inheritDoc
*/
public function getAuthorID() {
return $this->getDecoratedObject()->userID;
*/
class UserTrophyNotificationObjectType extends AbstractUserNotificationObjectType {
/**
- * @inheritdoc
+ * @inheritDoc
*/
protected static $decoratorClassName = UserTrophyNotificationObject::class;
/**
- * @inheritdoc
+ * @inheritDoc
*/
protected static $objectClassName = UserTrophy::class;
/**
- * @inheritdoc
+ * @inheritDoc
*/
protected static $objectListClassName = UserTrophyList::class;
}
<item name="wcf.user.notification.com.woltlab.wcf.user.profileComment.like.notification.like"><![CDATA[Jemandem gefällt {if LANGUAGE_USE_INFORMAL_VARIANT}dein{else}Ihr{/if} Kommentar]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.user.profileComment.response.like.notification.like"><![CDATA[Jemandem gefällt {if LANGUAGE_USE_INFORMAL_VARIANT}deine{else}Ihre{/if} Antwort auf einen Kommentar]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.paidSubscription.user.expiring"><![CDATA[Eine {if LANGUAGE_USE_INFORMAL_VARIANT}deiner{else}Ihrer{/if} Mitgliedschaft läuft bald ab]]></item>
+ <item name="wcf.user.notification.com.woltlab.wcf.userTrophy.notification.received"><![CDATA[Trophäe erhalten]]></item>
+ <item name="wcf.user.notification.trophy.received.message"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} die Trophäe „<a href="{$userTrophy->getTrophy()->getLink()}">{$userTrophy->getTrophy()->getTitle()}</a>“ erhalten.]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.moderation"><![CDATA[Moderation]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.moderation.queue.notification.comment"><![CDATA[Neuer Kommentar in der Moderation]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.user.profileComment.like.notification.like"><![CDATA[Notify me when my comments are liked]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.user.profileComment.response.like.notification.like"><![CDATA[Notify me when replies to my comments are liked]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.paidSubscription.user.expiring"><![CDATA[Notify me before a subscription will expire]]></item>
+ <item name="wcf.user.notification.com.woltlab.wcf.userTrophy.notification.received"><![CDATA[Trophy received]]></item>
+ <item name="wcf.user.notification.trophy.received.message"><![CDATA[You got the trophy “<a href="{$userTrophy->getTrophy()->getLink()}">{$userTrophy->getTrophy()->getTitle()}</a>“.]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.moderation"><![CDATA[Moderation]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.moderation.queue.notification.comment"><![CDATA[Notify me when new comments are written in moderation]]></item>