* @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); if (!CHAT_ACTIVE) return; if (!\wcf\system\WCF::getUser()->userID) return; $this->rooms = data\room\Room::getCache(); foreach ($this->rooms as $key => $room) { if (!$room->canEnter()) unset($this->rooms[$key]); } } /** * @see wcf\system\dashboard\box\AbstractContentDashboardBox::render() */ protected function render() { \wcf\system\WCF::getTPL()->assign(array( 'rooms' => $this->rooms )); return \wcf\system\WCF::getTPL()->fetch('dashboardBoxOnlineList', 'chat'); } }