From 5a5a2c9ad17598ac6ab28b20d6716cff510dd3d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 31 Jan 2013 16:02:14 +0100 Subject: [PATCH] Add dashboard box with online-list --- dashboardBox.xml | 9 ++++ .../box/OnlineListDashboardBox.class.php | 46 +++++++++++++++++++ package.xml | 6 ++- template/dashboardBoxOnlineList.tpl | 13 ++++++ 4 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 dashboardBox.xml create mode 100644 file/lib/system/dashboard/box/OnlineListDashboardBox.class.php create mode 100644 template/dashboardBoxOnlineList.tpl 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