diff --git a/acptemplate/suspensionList.tpl b/acptemplate/suspensionList.tpl
index 4732fe6..fa559e7 100644
--- a/acptemplate/suspensionList.tpl
+++ b/acptemplate/suspensionList.tpl
@@ -13,11 +13,11 @@
{else}
- {lang}chat.acp.suspension.noItems{/lang}
+ {lang}chat.acp.suspension.noItems{/lang}
{/if}
diff --git a/file/lib/acp/page/SuspensionListPage.class.php b/file/lib/acp/page/SuspensionListPage.class.php
index 11c59d1..e00161d 100644
--- a/file/lib/acp/page/SuspensionListPage.class.php
+++ b/file/lib/acp/page/SuspensionListPage.class.php
@@ -6,12 +6,12 @@
* Lists chat suspensions.
*
* @author Maximilian Mader
- * @copyright 2010-2013 Tim Düsterhus
+ * @copyright 2010-2013 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike
* @package be.bastelstu.chat
* @subpackage acp.page
*/
-class SuspensionListPage extends \wcf\page\SortablePage {
+class ChatSuspensionListPage extends \wcf\page\SortablePage {
/**
* @see \wcf\page\AbstractPage::$activeMenuItem
*/
@@ -20,37 +20,87 @@ class SuspensionListPage extends \wcf\page\SortablePage {
/**
* @see \wcf\page\AbstractPage::$neededPermissions
*/
+ // TODO: Permissions
public $neededPermissions = array();
/**
- * @see wcf\page\SortablePage::$defaultSortField
+ * @see \wcf\page\SortablePage::$defaultSortField
*/
- public $defaultSortField = 'username';
+ public $defaultSortField = 'expires';
/**
- * @see wcf\page\MultipleLinkPage::$itemsPerPage
+ * @see \wcf\page\MultipleLinkPage::$itemsPerPage
*/
- public $itemsPerPage = 50;
+ public $itemsPerPage = 30;
/**
- * @see wcf\page\SortablePage::$validSortFields
+ * @see \wcf\page\SortablePage::$validSortFields
*/
public $validSortFields = array('suspensionID', 'userID', 'username', 'roomID', 'type', 'expires');
/**
- * @see wcf\page\MultipleLinkPage::$objectListClassName
+ * @see \wcf\page\MultipleLinkPage::$objectListClassName
*/
public $objectListClassName = 'chat\data\suspension\SuspensionList';
/**
- * @see wcf\page\MultipleLinkPage::readObjects()
+ * type filter
+ *
+ * @var integer
+ */
+ public $filterType = null;
+
+ /**
+ * user filter
+ *
+ * @var integer
+ */
+ public $filterUserID = null;
+
+ /**
+ * room filter
+ *
+ * @var integer
+ */
+ public $filterRoomID = null;
+
+ /**
+ * @see \wcf\page\IPage::readParameters()
+ */
+ public function readParameters() {
+ parent::readParameters();
+
+ if (isset($_REQUEST['type'])) $this->filterType = intval($_REQUEST['type']);
+ if (isset($_REQUEST['userID'])) $this->filterUserID = intval($_REQUEST['userID']);
+ if (isset($_REQUEST['roomID'])) $this->filterRoomID = intval($_REQUEST['roomID']);
+ }
+
+ /**
+ * @see \wcf\page\MultipleLinkPage::readObjects()
*/
protected function initObjectList() {
parent::initObjectList();
- $this->objectList->sqlSelects .= "user_table.username";
- $this->objectList->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user user_table
+ $this->objectList->sqlSelects .= "user_table.username, room_table.title AS roomTitle";
+ $this->objectList->sqlJoins .= "
+ LEFT JOIN wcf".WCF_N."_user user_table
ON suspension.userID = user_table.userID";
+ $conditionJoins = " LEFT JOIN chat".WCF_N."_room room_table
+ ON suspension.roomID = room_table.roomID";
+ $this->objectList->sqlConditionJoins .= $conditionJoins;
+ $this->objectList->sqlJoins .= $conditionJoins;
+
$this->objectList->getConditionBuilder()->add('expires >= ?', array(TIME_NOW));
+ $this->objectList->getConditionBuilder()->add('room_table.permanent = ?', 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->filterRoomID !== null) {
+ if ($this->filterRoomID === 0) {
+ $this->objectList->getConditionBuilder()->add('suspension.roomID IS NULL', array());
+ }
+ else {
+ $this->objectList->getConditionBuilder()->add('suspension.roomID = ?', array($this->filterRoomID));
+ }
+ }
}
}