1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Improve template of suspensionList and add condition

This commit is contained in:
Tim Düsterhus 2013-06-04 23:39:42 +02:00
parent 92d2be2b28
commit 63399908f1
2 changed files with 12 additions and 17 deletions

View File

@ -10,17 +10,12 @@
<h2>{lang}wcf.acp.suspension.list{/lang} <span class="badge badgeInverse">{#$items}</span></h2>
</header>
<!--
'suspensionID', 'userID', 'username', 'roomID', 'type', 'expires'
-->
<table class="table">
<thead>
<tr>
<th class="columnID{if $sortField == 'suspensionID'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='SuspensionList'}pageNo={@$pageNo}&sortField=suspensionID&sortOrder={if $sortField == 'suspensionID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
<th class="columnUserID{if $sortField == 'userID'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='SuspensionList'}pageNo={@$pageNo}&sortField=userID&sortOrder={if $sortField == 'userID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.chat.userID{/lang}</a></th>
<th class="columnUsername{if $sortField == 'username'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='SuspensionList'}pageNo={@$pageNo}&sortField=username&sortOrder={if $sortField == 'username' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.chat.username{/lang}</a></th>
<th class="columnRoomID{if $sortField == 'roomID'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='SuspensionList'}pageNo={@$pageNo}&sortField=roomID&sortOrder={if $sortField == 'roomID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.chat.roomID{/lang}</a></th>
<th class="columnUsername{if $sortField == 'username'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='SuspensionList'}pageNo={@$pageNo}&sortField=username&sortOrder={if $sortField == 'username' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.user.username{/lang}</a></th>
<th class="columnRoomID{if $sortField == 'roomID'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='SuspensionList'}pageNo={@$pageNo}&sortField=roomID&sortOrder={if $sortField == 'roomID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}chat.general.room{/lang}</a></th>
<th class="columnType{if $sortField == 'type'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='SuspensionList'}pageNo={@$pageNo}&sortField=type&sortOrder={if $sortField == 'type' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.chat.type{/lang}</a></th>
<th class="columnExpires{if $sortField == 'expires'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='SuspensionList'}pageNo={@$pageNo}&sortField=expires&sortOrder={if $sortField == 'expires' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.chat.expires{/lang}</a></th>
</tr>
@ -30,17 +25,17 @@
{foreach from=$objects item=$suspension}
<tr>
<td id="columnID">{@$suspension->suspensionID}</td>
<td id="columnUserID">{@$suspension->userID}</td>
<td id="columnUsername">{@$suspension->username}</td>
<td id="columnRoomID">{@$suspension->roomID}</td>
<td id="columnType">{@$suspension->type}</td>
<td id="columnExpires">{@$suspension->expires|date}</td>
<td id="columnUsername">{$suspension->username}</td>
<td id="columnRoomID">{if $suspension->roomID}{@$suspension->roomID}{else}{lang}chat.room.global{/lang}{/if}</td>
<td id="columnType">{lang}chat.suspension.{@$suspension->type}{/lang}</td>
<td id="columnExpires">{@$suspension->expires|time} ({@$suspension->expires|dateDiff})</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{else}
<p class="warning">{lang}chat.acp.suspension.noItems{/lang}</p>
{/if}

View File

@ -48,9 +48,9 @@ class SuspensionListPage extends \wcf\page\SortablePage {
protected function initObjectList() {
parent::initObjectList();
$this->objectList->sqlSelects .= "user.username";
$this->objectList->sqlJoins .= "LEFT JOIN
wcf".WCF_N."_user AS user
ON suspension.userID = user.userID";
$this->objectList->sqlSelects .= "user_table.username";
$this->objectList->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user user_table
ON suspension.userID = user_table.userID";
$this->objectList->getConditionBuilder()->add('expires >= ?', array(TIME_NOW));
}
}