diff --git a/dashboardBox.xml b/dashboardBox.xml new file mode 100644 index 0000000..c7523cd --- /dev/null +++ b/dashboardBox.xml @@ -0,0 +1,9 @@ + + + + + + content + + + diff --git a/file/lib/system/dashboard/box/OnlineListDashboardBox.class.php b/file/lib/system/dashboard/box/OnlineListDashboardBox.class.php new file mode 100644 index 0000000..4027391 --- /dev/null +++ b/file/lib/system/dashboard/box/OnlineListDashboardBox.class.php @@ -0,0 +1,46 @@ + + * @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); + + $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() { + if (count($this->rooms)) { + \wcf\system\WCF::getTPL()->assign(array( + 'rooms' => $this->rooms + )); + + return \wcf\system\WCF::getTPL()->fetch('dashboardBoxOnlineList', 'chat'); + } + } +} diff --git a/package.xml b/package.xml index 1818c26..b36815a 100644 --- a/package.xml +++ b/package.xml @@ -36,7 +36,8 @@ acpMenu.xml userGroupOption.xml cronjob.xml - acp/be.bastelstu.chat.install.php + dashboardBox.xml + acp/be.bastelstu.chat.install.php @@ -53,6 +54,7 @@ acpMenu.xml userGroupOption.xml cronjob.xml - acp/be.bastelstu.chat.update.php + dashboardBox.xml + acp/be.bastelstu.chat.update.php diff --git a/template/dashboardBoxOnlineList.tpl b/template/dashboardBoxOnlineList.tpl new file mode 100644 index 0000000..c968165 --- /dev/null +++ b/template/dashboardBoxOnlineList.tpl @@ -0,0 +1,13 @@ +
+
+

{lang}chat.header.menu.chat{/lang}

+
+
+ +
+ +
\ No newline at end of file