mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Add date to message if they are from a previous day
This commit is contained in:
parent
979fe68fc2
commit
80db5cf3c9
@ -13,7 +13,7 @@
|
|||||||
{foreach from=$messages item="message"}
|
{foreach from=$messages item="message"}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="columnID">{$message->messageID}</td>
|
<td class="columnID">{$message->messageID}</td>
|
||||||
<td style="width: 1px !important;">{$message->time|date:"H:i:s"}</td>
|
<td style="width: 1px !important;">{$message->time|date:"chat.global.timeFormat"}</td>
|
||||||
<td class="columnIcon"><p class="framed">{@$message->getUserProfile()->getAvatar()->getImageTag(24)}</p></td>
|
<td class="columnIcon"><p class="framed">{@$message->getUserProfile()->getAvatar()->getImageTag(24)}</p></td>
|
||||||
<td class="columnTitle columnUsername right" style="width: 1px !important;">{$message->username}</td>
|
<td class="columnTitle columnUsername right" style="width: 1px !important;">{$message->username}</td>
|
||||||
<td>{@$message->getFormattedMessage("text/simplified-html")}</td>
|
<td>{@$message->getFormattedMessage("text/simplified-html")}</td>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{foreach from=$messages item=$rawMessage}{*
|
{foreach from=$messages item=$rawMessage}{*
|
||||||
*}{assign var=message value=$rawMessage->jsonify(true)}{*
|
*}{assign var=message value=$rawMessage->jsonify(true)}{*
|
||||||
*}({$message['time']|date:'H:i:s'}) {$message[username]|str_pad:15:' ':STR_PAD_LEFT}{$message[separator]} {$message[message]}
|
*}({$message['time']|date:'chat.global.timeFormat'}) {$message[username]|str_pad:15:' ':STR_PAD_LEFT}{$message[separator]} {$message[message]}
|
||||||
|
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
@ -153,10 +153,12 @@ public function jsonify($raw = false) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$time = \wcf\util\DateUtil::getDateTimeByTimestamp($this->time);
|
||||||
|
$startOfDay = new \DateTime('today', WCF::getUser()->getTimezone());
|
||||||
$array = array(
|
$array = array(
|
||||||
'formattedUsername' => $this->getUsername(true),
|
'formattedUsername' => $this->getUsername(true),
|
||||||
'formattedMessage' => $this->getFormattedMessage('text/html'),
|
'formattedMessage' => $this->getFormattedMessage('text/html'),
|
||||||
'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'),
|
'formattedTime' => ($time->getTimestamp() < $startOfDay->getTimestamp() ? \wcf\util\DateUtil::format($time, 'chat.global.dateFormat').' ' : '').\wcf\util\DateUtil::format($time, 'chat.global.timeFormat'),
|
||||||
'separator' => $separator,
|
'separator' => $separator,
|
||||||
'message' => $this->getFormattedMessage('text/plain'),
|
'message' => $this->getFormattedMessage('text/plain'),
|
||||||
'sender' => (int) $this->sender,
|
'sender' => (int) $this->sender,
|
||||||
|
@ -193,6 +193,9 @@ Probieren Sie, den Chat neu zu laden<!-- , bei Risiken und Nebenwirkungen fragen
|
|||||||
<item name="chat.global.privateChannelTopic"><![CDATA[{literal}Sie befinden sich in einem privaten Kanal mit „{$username}“.{/literal}]]></item>
|
<item name="chat.global.privateChannelTopic"><![CDATA[{literal}Sie befinden sich in einem privaten Kanal mit „{$username}“.{/literal}]]></item>
|
||||||
<item name="chat.global.closePrivateChannel"><![CDATA[Privaten Kanal schließen]]></item>
|
<item name="chat.global.closePrivateChannel"><![CDATA[Privaten Kanal schließen]]></item>
|
||||||
<item name="chat.global.closeTopic"><![CDATA[Thema ausblenden]]></item>
|
<item name="chat.global.closeTopic"><![CDATA[Thema ausblenden]]></item>
|
||||||
|
|
||||||
|
<item name="chat.global.timeFormat"><![CDATA[H:i:s]]></item>
|
||||||
|
<item name="chat.global.dateFormat"><![CDATA[Y-m-d]]></item>
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category name="chat.header">
|
<category name="chat.header">
|
||||||
|
@ -193,6 +193,9 @@ Please try to reload the chat.]]></item>
|
|||||||
<item name="chat.global.privateChannelTopic"><![CDATA[{literal}You are in a private conversation with “{$username}”{/literal}]]></item>
|
<item name="chat.global.privateChannelTopic"><![CDATA[{literal}You are in a private conversation with “{$username}”{/literal}]]></item>
|
||||||
<item name="chat.global.closePrivateChannel"><![CDATA[Close Private Conversation]]></item>
|
<item name="chat.global.closePrivateChannel"><![CDATA[Close Private Conversation]]></item>
|
||||||
<item name="chat.global.closeTopic"><![CDATA[Hide Topic]]></item>
|
<item name="chat.global.closeTopic"><![CDATA[Hide Topic]]></item>
|
||||||
|
|
||||||
|
<item name="chat.global.timeFormat"><![CDATA[g:i:sa]]></item>
|
||||||
|
<item name="chat.global.dateFormat"><![CDATA[Y-m-d]]></item>
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category name="chat.header">
|
<category name="chat.header">
|
||||||
|
Loading…
Reference in New Issue
Block a user