1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-23 21:50:09 +00:00
Tims-Chat/file/lib/acp/page/ChatSuspensionListPage.class.php

107 lines
3.0 KiB
PHP
Raw Normal View History

2013-06-04 20:54:11 +00:00
<?php
namespace chat\acp\page;
use \wcf\system\WCF;
/**
* Lists chat suspensions.
*
* @author Maximilian Mader
2013-06-06 14:46:27 +00:00
* @copyright 2010-2013 Tim Düsterhus
2013-06-04 20:54:11 +00:00
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package be.bastelstu.chat
* @subpackage acp.page
*/
2013-06-06 14:46:27 +00:00
class ChatSuspensionListPage extends \wcf\page\SortablePage {
2013-06-04 20:54:11 +00:00
/**
* @see \wcf\page\AbstractPage::$activeMenuItem
*/
public $activeMenuItem = 'chat.acp.menu.link.suspension.list';
/**
* @see \wcf\page\AbstractPage::$neededPermissions
*/
2013-06-06 14:46:27 +00:00
// TODO: Permissions
2013-06-04 20:54:11 +00:00
public $neededPermissions = array();
/**
2013-06-06 14:56:13 +00:00
* @see \wcf\page\SortablePage::$defaultSortField
*/
2013-06-06 14:46:27 +00:00
public $defaultSortField = 'expires';
2013-06-04 20:54:11 +00:00
/**
2013-06-06 14:56:13 +00:00
* @see \wcf\page\MultipleLinkPage::$itemsPerPage
*/
2013-06-06 14:46:27 +00:00
public $itemsPerPage = 30;
2013-06-04 20:54:11 +00:00
/**
2013-06-06 14:56:13 +00:00
* @see \wcf\page\SortablePage::$validSortFields
*/
2013-06-04 20:54:11 +00:00
public $validSortFields = array('suspensionID', 'userID', 'username', 'roomID', 'type', 'expires');
/**
2013-06-06 14:56:13 +00:00
* @see \wcf\page\MultipleLinkPage::$objectListClassName
*/
2013-06-04 20:54:11 +00:00
public $objectListClassName = 'chat\data\suspension\SuspensionList';
/**
2013-06-06 14:46:27 +00:00
* 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()
2013-06-04 20:54:11 +00:00
*/
protected function initObjectList() {
parent::initObjectList();
2013-06-06 14:46:27 +00:00
$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";
2013-06-06 14:46:27 +00:00
$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));
2013-06-06 14:46:27 +00:00
$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));
}
}
2013-06-04 20:54:11 +00:00
}
}