</header>
{/capture}
+{capture assign='headContent'}
+ <link rel="alternate" type="application/rss+xml" title="{lang}wcf.global.button.rss{/lang}" href="{link controller='NotificationFeed' appendSession=false}at={@$__wcf->getUser()->userID}-{@$__wcf->getUser()->accessToken}{/link}" />
+{/capture}
+
+{capture assign='headerNavigation'}
+ <li><a rel="alternate" href="{link controller='NotificationFeed' appendSession=false}at={@$__wcf->getUser()->userID}-{@$__wcf->getUser()->accessToken}{/link}" title="{lang}wcf.global.button.rss{/lang}" class="jsTooltip"><span class="icon icon16 fa-rss"></span> <span class="invisible">{lang}wcf.global.button.rss{/lang}</span></a></li>
+{/capture}
+
{include file='userMenuSidebar'}
{include file='header'}
--- /dev/null
+<?php
+namespace wcf\page;
+use wcf\system\exception\IllegalLinkException;
+use wcf\system\user\notification\UserNotificationHandler;
+use wcf\system\WCF;
+
+/**
+ * Shows a list of own user notifications in feed.
+ *
+ * @author Joshua Ruesweg
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage page
+ * @category Community Framework
+ * @since 2.2
+ */
+class NotificationFeedPage extends AbstractFeedPage {
+ /**
+ * @inheritDoc
+ */
+ public function readParameters() {
+ parent::readParameters();
+
+ if (!WCF::getUser()->userID) {
+ throw new IllegalLinkException();
+ }
+
+ $this->title = WCF::getLanguage()->get('wcf.user.menu.community.notification');
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function readData() {
+ parent::readData();
+
+ $this->items = new \ArrayIterator();
+
+ $notifications = UserNotificationHandler::getInstance()->getNotifications(20);
+
+ foreach ($notifications['notifications'] as $notification) {
+ $this->items->append($notification['event']);
+ }
+ }
+}
use wcf\data\user\notification\UserNotification;
use wcf\data\user\UserProfile;
use wcf\data\DatabaseObjectDecorator;
+use wcf\data\IFeedEntry;
use wcf\system\user\notification\object\IUserNotificationObject;
use wcf\system\WCF;
use wcf\util\DateUtil;
+use wcf\util\StringUtil;
/**
* Provides a default implementation for user notification events.
*
- * @author Marcel Werk, Oliver Kliebisch
+ * @author Joshua Ruesweg, Marcel Werk, Oliver Kliebisch
* @copyright 2001-2016 WoltLab GmbH, Oliver Kliebisch
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @method UserNotificationEvent getDecoratedObject()
* @mixin UserNotificationEvent
*/
-abstract class AbstractUserNotificationEvent extends DatabaseObjectDecorator implements IUserNotificationEvent {
+abstract class AbstractUserNotificationEvent extends DatabaseObjectDecorator implements IUserNotificationEvent, IFeedEntry {
/**
* @inheritDoc
*/
public function getUserNotificationObject() {
return $this->userNotificationObject;
}
+
+ /**
+ * @inheritdoc
+ */
+ public function getComments() {
+ return 0;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getCategories() {
+ return [
+ $this->notification->objectType
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getExcerpt($maxLength = 255) {
+ return StringUtil::truncateHTML($this->getFormattedMessage(), $maxLength);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getFormattedMessage() {
+ return $this->getMessage();
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function __toString() {
+ return $this->getFormattedMessage();
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getTime() {
+ return $this->getNotification()->time;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getUserID() {
+ return $this->getAuthorID();
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getUsername() {
+ return $this->getAuthor()->username;
+ }
}