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

Improve suspension list

This commit is contained in:
Maximilian Mader 2013-06-12 22:49:25 +02:00
parent 2c0e0e3796
commit 1b8801629b
2 changed files with 19 additions and 4 deletions

View File

@ -17,7 +17,9 @@
<th class="columnUsername{if $sortField == 'username'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}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='ChatSuspensionList'}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='ChatSuspensionList'}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="columnTime{if $sortField == 'time'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=time&sortOrder={if $sortField == 'time' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.chat.time{/lang}</a></th>
<th class="columnExpires{if $sortField == 'expires'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=expires&sortOrder={if $sortField == 'expires' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.chat.expires{/lang}</a></th>
<th class="columnIssuer{if $sortField == 'issuer'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=issuer&sortOrder={if $sortField == 'issuer' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.chat.issuer{/lang}</a></th>
</tr>
</thead>
@ -28,7 +30,9 @@
<td id="columnUsername"><a href="{link application='chat' controller='ChatSuspensionList'}userID={$suspension->userID}{/link}">{$suspension->username}</a></td>
<td id="columnRoomID"><a href="{link application='chat' controller='ChatSuspensionList'}roomID={if $suspension->roomID}{$suspension->roomID}{else}0{/if}{/link}">{if $suspension->roomID}{@$suspension->roomTitle|language}{else}{lang}chat.room.global{/lang}{/if}</a></td>
<td id="columnType"><a href="{link application='chat' controller='ChatSuspensionList'}type={$suspension->type}{/link}">{lang}chat.suspension.{@$suspension->type}{/lang}</a></td>
<td id="columnExpires">{@$suspension->expires|time} ({@$suspension->expires|dateDiff})</td>
<td id="columnTime">{@$suspension->time|plainTime}</td>
<td id="columnExpires">{@$suspension->expires|plainTime} ({$suspension->expires|dateDiff})</td>
<td id="columnIssuer"><a href="{link application='chat' controller='ChatSuspensionList'}issuerUserID={$suspension->issuer}{/link}">{$suspension->issuerUsername}</a></td>
</tr>
{/foreach}
</tbody>

View File

@ -36,7 +36,7 @@ class ChatSuspensionListPage extends \wcf\page\SortablePage {
/**
* @see \wcf\page\SortablePage::$validSortFields
*/
public $validSortFields = array('suspensionID', 'userID', 'username', 'roomID', 'type', 'expires');
public $validSortFields = array('suspensionID', 'userID', 'username', 'roomID', 'type', 'expires', 'issuer', 'time');
/**
* @see \wcf\page\MultipleLinkPage::$objectListClassName
@ -57,6 +57,13 @@ class ChatSuspensionListPage extends \wcf\page\SortablePage {
*/
public $filterUserID = null;
/**
* issuer filter
*
* @var integer
*/
public $filterIssuerUserID = null;
/**
* room filter
*
@ -72,6 +79,7 @@ public function readParameters() {
if (isset($_REQUEST['type'])) $this->filterType = intval($_REQUEST['type']);
if (isset($_REQUEST['userID'])) $this->filterUserID = intval($_REQUEST['userID']);
if (isset($_REQUEST['issuerUserID'])) $this->filterIssuerUserID = intval($_REQUEST['issuerUserID']);
if (isset($_REQUEST['roomID'])) $this->filterRoomID = intval($_REQUEST['roomID']);
}
@ -81,10 +89,12 @@ public function readParameters() {
protected function initObjectList() {
parent::initObjectList();
$this->objectList->sqlSelects .= "user_table.username, room_table.title AS roomTitle";
$this->objectList->sqlSelects .= "user_table.username, user_table2.username as issuerUsername, room_table.title AS roomTitle";
$this->objectList->sqlJoins .= "
LEFT JOIN wcf".WCF_N."_user user_table
ON suspension.userID = user_table.userID";
ON suspension.userID = user_table.userID
LEFT JOIN wcf".WCF_N."_user user_table2
ON suspension.issuer = user_table2.userID";
$conditionJoins = " LEFT JOIN chat".WCF_N."_room room_table
ON suspension.roomID = room_table.roomID";
$this->objectList->sqlConditionJoins .= $conditionJoins;
@ -94,6 +104,7 @@ protected function initObjectList() {
$this->objectList->getConditionBuilder()->add('(room_table.permanent = ? OR suspension.roomID IS NULL)', array(1));
if ($this->filterType !== null) $this->objectList->getConditionBuilder()->add('suspension.type = ?', array($this->filterType));
if ($this->filterUserID !== null) $this->objectList->getConditionBuilder()->add('suspension.userID = ?', array($this->filterUserID));
if ($this->filterIssuerUserID !== null) $this->objectList->getConditionBuilder()->add('suspension.issuer = ?', array($this->filterIssuerUserID));
if ($this->filterRoomID !== null) {
if ($this->filterRoomID === 0) {
$this->objectList->getConditionBuilder()->add('suspension.roomID IS NULL', array());