2013-01-31 15:02:14 +00:00
|
|
|
<?php
|
|
|
|
namespace chat\system\dashboard\box;
|
|
|
|
use chat\data;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dashboard box that shows chatters.
|
|
|
|
*
|
|
|
|
* @author Tim Düsterhus
|
|
|
|
* @copyright 2010-2013 Tim Düsterhus
|
|
|
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
|
|
|
* @package be.bastelstu.chat
|
|
|
|
* @subpackage system.dashboard.box
|
|
|
|
*/
|
|
|
|
class OnlineListDashboardBox extends \wcf\system\dashboard\box\AbstractContentDashboardBox {
|
|
|
|
/**
|
|
|
|
* all rooms in the current installation
|
|
|
|
* @var array<\chat\data\room\Room>
|
|
|
|
*/
|
|
|
|
public $rooms = array();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see wcf\system\dashboard\box\IDashboardBox::init()
|
|
|
|
*/
|
|
|
|
public function init(\wcf\data\dashboard\box\DashboardBox $box, \wcf\page\IPage $page) {
|
|
|
|
parent::init($box, $page);
|
|
|
|
|
2013-05-23 20:14:07 +00:00
|
|
|
if (!MODULE_CHAT) return;
|
2013-04-24 12:33:47 +00:00
|
|
|
if (!\wcf\system\WCF::getUser()->userID) return;
|
|
|
|
|
2013-05-24 00:21:49 +00:00
|
|
|
$this->rooms = data\room\RoomCache::getInstance()->getRooms();
|
2013-01-31 15:02:14 +00:00
|
|
|
|
|
|
|
foreach ($this->rooms as $key => $room) {
|
|
|
|
if (!$room->canEnter()) unset($this->rooms[$key]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see wcf\system\dashboard\box\AbstractContentDashboardBox::render()
|
|
|
|
*/
|
|
|
|
protected function render() {
|
2013-04-26 18:47:40 +00:00
|
|
|
\wcf\system\WCF::getTPL()->assign(array(
|
|
|
|
'rooms' => $this->rooms
|
|
|
|
));
|
|
|
|
|
|
|
|
return \wcf\system\WCF::getTPL()->fetch('dashboardBoxOnlineList', 'chat');
|
2013-01-31 15:02:14 +00:00
|
|
|
}
|
|
|
|
}
|