mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Display messages in their appropriate tab.
This commit is contained in:
parent
3a44dbe850
commit
cc73d89672
@ -57,33 +57,63 @@
|
||||
<nav class="tabMenu">
|
||||
<ul>
|
||||
{section name=tabLoop loop=24 step=3}
|
||||
<li>
|
||||
{assign var=anchor value='timeTab-'|concat:$tabLoop}
|
||||
<a href="{@$__wcf->getAnchor($anchor)}">{if $tabLoop < 10}0{/if}{$tabLoop}:00 - {if $tabLoop + 2 < 10}0{/if}{$tabLoop + 2}:59</a>
|
||||
</li>
|
||||
{if $messages[$tabLoop * 2]|isset || $messages[$tabLoop * 2 + 1]|isset || $messages[$tabLoop * 2 + 2]|isset || $messages[$tabLoop * 2 + 3]|isset || $messages[$tabLoop * 2 + 4]|isset || $messages[$tabLoop * 2 + 5]|isset}
|
||||
<li>
|
||||
{assign var=anchor value='timeTab-'|concat:$tabLoop}
|
||||
<a href="{@$__wcf->getAnchor($anchor)}">{if $tabLoop < 10}0{/if}{$tabLoop}:00 - {if $tabLoop + 2 < 10}0{/if}{$tabLoop + 2}:59</a>
|
||||
</li>
|
||||
{/if}
|
||||
{/section}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{section name=contentLoop loop=24 step=3}
|
||||
<div id="timeTab-{$contentLoop}" class="container containerPadding tabMenuContainer tabMenuContent">
|
||||
<nav class="menu">
|
||||
<ul>
|
||||
{section name=subTabLoop loop=6}
|
||||
{if $messages[$contentLoop * 2]|isset || $messages[$contentLoop * 2 + 1]|isset || $messages[$contentLoop * 2 + 2]|isset || $messages[$contentLoop * 2 + 3]|isset || $messages[$contentLoop * 2 + 4]|isset || $messages[$contentLoop * 2 + 5]|isset}
|
||||
<div id="timeTab-{$contentLoop}" class="container containerPadding tabMenuContainer tabMenuContent">
|
||||
<nav class="menu">
|
||||
<ul>
|
||||
{section name=subTabLoop loop=6}
|
||||
{if $messages[$contentLoop * 2 + $subTabLoop]|isset}
|
||||
{assign var=subAnchor value='timeTab-'|concat:$contentLoop|concat:'-subTab-'|concat:$subTabLoop}
|
||||
<li>
|
||||
<a href="{@$__wcf->getAnchor($subAnchor)}">{if $contentLoop + $subTabLoop / 2 < 10}0{/if}{$contentLoop + $subTabLoop / 2|floor}:{if $subTabLoop % 2 == 0}0{/if}{($subTabLoop % 2) * 30} - {if $contentLoop + $subTabLoop / 2 < 10}0{/if}{$contentLoop + $subTabLoop / 2|floor}:{($subTabLoop % 2) * 30 + 29}</a>
|
||||
</li>
|
||||
{/if}
|
||||
{/section}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{section name=subTabLoop loop=6}
|
||||
{if $messages[$contentLoop * 2 + $subTabLoop]|isset}
|
||||
{assign var=subAnchor value='timeTab-'|concat:$contentLoop|concat:'-subTab-'|concat:$subTabLoop}
|
||||
<li><a href="{@$__wcf->getAnchor($subAnchor)}">{if $contentLoop + $subTabLoop / 2 < 10}0{/if}{$contentLoop + $subTabLoop / 2|floor}:{if $subTabLoop % 2 == 0}0{/if}{($subTabLoop % 2) * 30} - {if $contentLoop + $subTabLoop / 2 < 10}0{/if}{$contentLoop + $subTabLoop / 2|floor}:{($subTabLoop % 2) * 30 + 29}</a>
|
||||
</li>
|
||||
{/section}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{section name=subTabLoop loop=6}
|
||||
{assign var=subAnchor value='timeTab-'|concat:$contentLoop|concat:'-subTab-'|concat:$subTabLoop}
|
||||
<div id="{$subAnchor}" class="hidden">
|
||||
{#$contentLoop / 3} - {#$subTabLoop}
|
||||
</div>
|
||||
{/section}
|
||||
</div>
|
||||
<div id="{$subAnchor}" class="hidden tabularBox">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{lang}wcf.global.objectID{/lang}</th>
|
||||
<th>{lang}chat.general.time{/lang}</th>
|
||||
<th colspan="2">{lang}wcf.user.username{/lang}</th>
|
||||
<th>{lang}chat.acp.log.message{/lang}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{foreach from=$messages[$contentLoop * 2 + $subTabLoop] item='message'}
|
||||
<tr>
|
||||
<td class="columnID">{$message->messageID}</td>
|
||||
<td style="width: 1px !important;">{$message->time|date:'H:i:s'}</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>{@$message->getFormattedMessage('text/simplified-html')}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
{/section}
|
||||
</div>
|
||||
{/if}
|
||||
{/section}
|
||||
</div>
|
||||
{/if}
|
||||
|
@ -78,26 +78,39 @@ public function readData() {
|
||||
parent::readData();
|
||||
|
||||
try {
|
||||
if($this->date > TIME_NOW) {
|
||||
if ($this->date > TIME_NOW) {
|
||||
throw new \wcf\system\exception\UserInputException('date', 'inFuture');
|
||||
}
|
||||
} catch(\wcf\system\exception\UserInputException $e) {
|
||||
} catch (\wcf\system\exception\UserInputException $e) {
|
||||
$this->errorField = $e->getField();
|
||||
$this->errorType = $e->getType();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if($this->date < strtotime('today 00:00:00 -'.ceil(CHAT_LOG_ARCHIVETIME / 1440).'day')) {
|
||||
if ($this->date < strtotime('today 00:00:00 -'.ceil(CHAT_LOG_ARCHIVETIME / 1440).'day')) {
|
||||
throw new \wcf\system\exception\UserInputException('date', 'tooLongAgo');
|
||||
}
|
||||
} catch(\wcf\system\exception\UserInputException $e) {
|
||||
} catch (\wcf\system\exception\UserInputException $e) {
|
||||
$this->errorField = $e->getField();
|
||||
$this->errorType = $e->getType();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->messages = \chat\data\message\ViewableMessageList::getMessagesBetween($this->room, $this->date, $this->date + 86399);
|
||||
$messages = \chat\data\message\ViewableMessageList::getMessagesBetween($this->room, $this->date, $this->date + 86399);
|
||||
|
||||
foreach ($messages as $message) {
|
||||
$hour = ((int) date('H', $message->time)) * 2;
|
||||
$minutes = (int) date('i', $message->time);
|
||||
|
||||
if ($minutes >= 30) {
|
||||
$hour += 1;
|
||||
}
|
||||
|
||||
$this->messages[$hour][] = $message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +121,7 @@ public function readParameters() {
|
||||
|
||||
$this->rooms = \chat\data\room\RoomCache::getInstance()->getRooms();
|
||||
|
||||
foreach($this->rooms as $id => $room) {
|
||||
foreach ($this->rooms as $id => $room) {
|
||||
if (!$room->permanent)
|
||||
unset($this->rooms[$key]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user