</type>
<!-- /activity points -->
+ <!-- comments -->
<type>
<name>com.woltlab.wcf.user.profileComment</name>
<definitionname>com.woltlab.wcf.comment.commentableContent</definitionname>
<classname><![CDATA[wcf\system\user\notification\object\type\UserProfileCommentResponseUserNotificationObjectType]]></classname>
<category>com.woltlab.wcf.user</category>
</type>
+ <!-- /comments -->
<!-- moderation -->
<type>
</div>
{if $notifications[notifications]}
- <div class="container marginTop">
- <ul class="containerList" id="userNotificationItemList">
- {foreach from=$notifications[notifications] item=$notification}
+ {assign var=lastPeriod value=''}
+
+ {foreach from=$notifications[notifications] item=$notification}
+ {if $notification[event]->getPeriod() != $lastPeriod}
+ {if $lastPeriod}
+ </ul>
+ </div>
+ {/if}
+ {assign var=lastPeriod value=$notification[event]->getPeriod()}
+
+ <header class="boxHeadline boxSubHeadline">
+ <h2>{$lastPeriod}</h2>
+ </header>
+
+ <div class="container marginTop">
+ <ul class="containerList"{* id="userNotificationItemList"*}>
+ {/if}
<li class="jsNotificationItem{if $notification[authors] > 1} groupedNotificationItem{/if}" data-notification-id="{@$notification[notificationID]}" data-link="{$notification[event]->getLink()}" data-is-grouped="{if $notification[authors] > 1}true{else}false{/if}">
<div class="box48">
{if $notification[authors] < 2}
{/if}
</div>
</li>
- {/foreach}
+ {/foreach}
</ul>
</div>
use wcf\data\DatabaseObjectDecorator;
use wcf\system\user\notification\object\IUserNotificationObject;
use wcf\system\WCF;
+use wcf\util\DateUtil;
/**
* Provides default a implementation for user notification events.
*/
protected $language = null;
+ /**
+ * list of point of times for each period's end
+ * @var array<string>
+ */
+ protected static $periods = array();
+
/**
* notification trigger count
* @var integer
public function isStackable() {
return $this->stackable;
}
+
+ /**
+ * Returns the readable period matching this notification.
+ *
+ * @return string
+ */
+ public function getPeriod() {
+ if (empty(self::$periods)) {
+ $date = DateUtil::getDateTimeByTimestamp(TIME_NOW);
+ $date->setTimezone(WCF::getUser()->getTimeZone());
+ $date->setTime(0, 0, 0);
+
+ self::$periods[$date->getTimestamp()] = WCF::getLanguage()->get('wcf.date.period.today');
+
+ // 1 day back
+ $date->modify('-1 day');
+ self::$periods[$date->getTimestamp()] = WCF::getLanguage()->get('wcf.date.period.yesterday');
+
+ // 2-6 days back
+ for ($i = 0; $i < 6; $i++) {
+ $date->modify('-1 day');
+ self::$periods[$date->getTimestamp()] = DateUtil::format($date, 'l');
+ }
+ }
+
+ foreach (self::$periods as $time => $period) {
+ if ($this->notification->time >= $time) {
+ return $period;
+ }
+ }
+
+ return WCF::getLanguage()->get('wcf.date.period.older');
+ }
}
<item name="wcf.date.interval.weeks.future"><![CDATA[In {if $weeks > 1}{#$weeks} Wochen{else}einer Woche{/if}]]></item>
<item name="wcf.date.interval.years.future"><![CDATA[In {if $years > 1}{#$years} Jahren{else}einem Jahr{/if}]]></item>
+ <!-- variables for time periods -->
+ <item name="wcf.date.period.older"><![CDATA[Älter]]></item>
+ <item name="wcf.date.period.today"><![CDATA[Heute]]></item>
+ <item name="wcf.date.period.yesterday"><![CDATA[Gestern]]></item>
+
<!-- variables for dynamic javascript datetime -->
<item name="wcf.date.relative.now"><![CDATA[Vor einem Moment]]></item>
<item name="wcf.date.relative.minutes"><![CDATA[{literal}Vor {if $minutes > 1}{#$minutes} Minuten{else}einer Minute{/if}{/literal}]]></item>
<item name="wcf.date.interval.weeks.future"><![CDATA[In {if $weeks > 1}{#$weeks} weeks{else}A week{/if}]]></item>
<item name="wcf.date.interval.years.future"><![CDATA[In {if $years > 1}{#$years} years{else}A year{/if}]]></item>
+ <!-- variables for time periods -->
+ <item name="wcf.date.period.older"><![CDATA[Older]]></item>
+ <item name="wcf.date.period.today"><![CDATA[Today]]></item>
+ <item name="wcf.date.period.yesterday"><![CDATA[Yesterday]]></item>
+
<!-- variables for dynamic javascript datetime -->
<item name="wcf.date.relative.now"><![CDATA[A moment ago]]></item>
<item name="wcf.date.relative.minutes"><![CDATA[{literal}{if $minutes > 1}{#$minutes} minutes{else}A minute{/if} ago{/literal}]]></item>