1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-11-14 16:10:08 +00:00
Tims-Chat/files/lib/system/condition/room/RoomFilledCondition.class.php

47 lines
1.3 KiB
PHP
Raw Normal View History

2018-08-16 22:30:59 +00:00
<?php
/*
* Copyright (c) 2010-2018 Tim Düsterhus.
*
* Use of this software is governed by the Business Source License
* included in the LICENSE file.
*
2020-10-20 16:01:58 +00:00
* Change Date: 2024-10-20
2018-08-16 22:30:59 +00:00
*
* On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2
* or later of the General Public License.
*/
namespace chat\system\condition\room;
use \chat\data\room\RoomList;
use \wcf\data\DatabaseObject;
use \wcf\data\DatabaseObjectList;
use \wcf\system\exception\SystemException;
/**
* Condition implementation for rooms to only include non-empty rooms in lists.
*/
class RoomFilledCondition extends \wcf\system\condition\AbstractCheckboxCondition implements \wcf\system\condition\IObjectListCondition {
/**
* @inheritDoc
*/
protected $fieldName = 'chatRoomIsFilled';
/**
* @inheritDoc
*/
protected $label = 'chat.room.condition.isFilled';
/**
* @inheritDoc
*/
public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
if (!($objectList instanceof RoomList)) {
throw new \wcf\system\exception\ParentClassException(get_class($objectList), RoomList::class);
}
$objectList->getConditionBuilder()->add("EXISTS (SELECT 1 FROM chat".WCF_N."_room_to_user r2u WHERE r2u.roomID = room.roomID AND active = ?)", [ 1 ]);
}
}