From 762bc813cefee7ad150cf481594525e946bce3e9 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 6 Jun 2014 23:07:04 +0200 Subject: [PATCH] Added 4 new dashboard boxes --- com.woltlab.wcf/dashboardBox.xml | 20 ++++++ .../dashboardBoxFollowingsOnlineSidebar.tpl | 12 ++++ .../templates/dashboardBoxSidebar.tpl | 2 +- .../dashboardBoxStaffOnlineSidebar.tpl | 12 ++++ .../templates/dashboardBoxTodaysBirthdays.tpl | 4 +- .../dashboardBoxTodaysFollowingBirthdays.tpl | 12 ++++ .../dashboardBoxUsersOnlineSidebar.tpl | 7 ++ .../box/AbstractSidebarDashboardBox.class.php | 25 +++++++ ...lowingsOnlineSidebarDashboardBox.class.php | 53 +++++++++++++++ .../StaffOnlineSidebarDashboardBox.class.php | 53 +++++++++++++++ ...ysFollowingBirthdaysDashboardBox.class.php | 68 +++++++++++++++++++ .../UsersOnlineSidebarDashboardBox.class.php | 57 ++++++++++++++++ wcfsetup/install/files/style/user.less | 4 ++ wcfsetup/install/lang/de.xml | 4 ++ wcfsetup/install/lang/en.xml | 4 ++ 15 files changed, 334 insertions(+), 3 deletions(-) create mode 100644 com.woltlab.wcf/templates/dashboardBoxFollowingsOnlineSidebar.tpl create mode 100644 com.woltlab.wcf/templates/dashboardBoxStaffOnlineSidebar.tpl create mode 100644 com.woltlab.wcf/templates/dashboardBoxTodaysFollowingBirthdays.tpl create mode 100644 com.woltlab.wcf/templates/dashboardBoxUsersOnlineSidebar.tpl create mode 100644 wcfsetup/install/files/lib/system/dashboard/box/FollowingsOnlineSidebarDashboardBox.class.php create mode 100644 wcfsetup/install/files/lib/system/dashboard/box/StaffOnlineSidebarDashboardBox.class.php create mode 100644 wcfsetup/install/files/lib/system/dashboard/box/TodaysFollowingBirthdaysDashboardBox.class.php create mode 100644 wcfsetup/install/files/lib/system/dashboard/box/UsersOnlineSidebarDashboardBox.class.php diff --git a/com.woltlab.wcf/dashboardBox.xml b/com.woltlab.wcf/dashboardBox.xml index da9f502f00..fede92f786 100644 --- a/com.woltlab.wcf/dashboardBox.xml +++ b/com.woltlab.wcf/dashboardBox.xml @@ -45,5 +45,25 @@ sidebar + + + + sidebar + + + + + sidebar + + + + + sidebar + + + + + sidebar + diff --git a/com.woltlab.wcf/templates/dashboardBoxFollowingsOnlineSidebar.tpl b/com.woltlab.wcf/templates/dashboardBoxFollowingsOnlineSidebar.tpl new file mode 100644 index 0000000000..72224deb88 --- /dev/null +++ b/com.woltlab.wcf/templates/dashboardBoxFollowingsOnlineSidebar.tpl @@ -0,0 +1,12 @@ + diff --git a/com.woltlab.wcf/templates/dashboardBoxSidebar.tpl b/com.woltlab.wcf/templates/dashboardBoxSidebar.tpl index f219f0814c..0e497b9a28 100644 --- a/com.woltlab.wcf/templates/dashboardBoxSidebar.tpl +++ b/com.woltlab.wcf/templates/dashboardBoxSidebar.tpl @@ -1,5 +1,5 @@
- {lang}wcf.dashboard.box.{$box->boxName}{/lang} + {if $titleLink}{lang}wcf.dashboard.box.{$box->boxName}{/lang}{else}{lang}wcf.dashboard.box.{$box->boxName}{/lang}{/if}
{@$template} diff --git a/com.woltlab.wcf/templates/dashboardBoxStaffOnlineSidebar.tpl b/com.woltlab.wcf/templates/dashboardBoxStaffOnlineSidebar.tpl new file mode 100644 index 0000000000..ecaa9c76fb --- /dev/null +++ b/com.woltlab.wcf/templates/dashboardBoxStaffOnlineSidebar.tpl @@ -0,0 +1,12 @@ + diff --git a/com.woltlab.wcf/templates/dashboardBoxTodaysBirthdays.tpl b/com.woltlab.wcf/templates/dashboardBoxTodaysBirthdays.tpl index 9058f93a00..d472162a01 100644 --- a/com.woltlab.wcf/templates/dashboardBoxTodaysBirthdays.tpl +++ b/com.woltlab.wcf/templates/dashboardBoxTodaysBirthdays.tpl @@ -1,7 +1,7 @@
    {foreach from=$birthdayUserProfiles item=birthdayUserProfile} -
  • - {@$birthdayUserProfile->getAvatar()->getImageTag(24)} +
  • + {@$birthdayUserProfile->getAvatar()->getImageTag(32)}

    {$birthdayUserProfile->username}

    diff --git a/com.woltlab.wcf/templates/dashboardBoxTodaysFollowingBirthdays.tpl b/com.woltlab.wcf/templates/dashboardBoxTodaysFollowingBirthdays.tpl new file mode 100644 index 0000000000..61cedf5f60 --- /dev/null +++ b/com.woltlab.wcf/templates/dashboardBoxTodaysFollowingBirthdays.tpl @@ -0,0 +1,12 @@ + diff --git a/com.woltlab.wcf/templates/dashboardBoxUsersOnlineSidebar.tpl b/com.woltlab.wcf/templates/dashboardBoxUsersOnlineSidebar.tpl new file mode 100644 index 0000000000..de03bcc23a --- /dev/null +++ b/com.woltlab.wcf/templates/dashboardBoxUsersOnlineSidebar.tpl @@ -0,0 +1,7 @@ + + +

    {lang}wcf.user.usersOnline.detail{/lang}{if USERS_ONLINE_RECORD} - {lang}wcf.user.usersOnline.record{/lang}{/if}

    \ No newline at end of file diff --git a/wcfsetup/install/files/lib/system/dashboard/box/AbstractSidebarDashboardBox.class.php b/wcfsetup/install/files/lib/system/dashboard/box/AbstractSidebarDashboardBox.class.php index 947e375e91..dd365e0e32 100644 --- a/wcfsetup/install/files/lib/system/dashboard/box/AbstractSidebarDashboardBox.class.php +++ b/wcfsetup/install/files/lib/system/dashboard/box/AbstractSidebarDashboardBox.class.php @@ -1,5 +1,6 @@ render(); + if (empty($template)) { + return ''; + } + + WCF::getTPL()->assign(array( + 'box' => $this->box, + 'template' => $template, + 'titleLink' => $this->titleLink + )); + + return WCF::getTPL()->fetch($this->templateName); + } } diff --git a/wcfsetup/install/files/lib/system/dashboard/box/FollowingsOnlineSidebarDashboardBox.class.php b/wcfsetup/install/files/lib/system/dashboard/box/FollowingsOnlineSidebarDashboardBox.class.php new file mode 100644 index 0000000000..bb91805eca --- /dev/null +++ b/wcfsetup/install/files/lib/system/dashboard/box/FollowingsOnlineSidebarDashboardBox.class.php @@ -0,0 +1,53 @@ + + * @package com.woltlab.wcf + * @subpackage system.dashboard.box + * @category Community Framework + */ +class FollowingsOnlineSidebarDashboardBox extends AbstractSidebarDashboardBox { + /** + * users online list + * @var \wcf\data\user\online\UsersOnlineList + */ + public $usersOnlineList = null; + + /** + * @see \wcf\system\dashboard\box\IDashboardBox::init() + */ + public function init(DashboardBox $box, IPage $page) { + parent::init($box, $page); + + if (MODULE_USERS_ONLINE && count(WCF::getUserProfileHandler()->getFollowingUsers())) { + $this->usersOnlineList = new UsersOnlineList(); + $this->usersOnlineList->getConditionBuilder()->add('session.userID IN (?)', array(WCF::getUserProfileHandler()->getFollowingUsers())); + $this->usersOnlineList->readObjects(); + } + + $this->fetched(); + } + + /** + * @see \wcf\system\dashboard\box\AbstractContentDashboardBox::render() + */ + protected function render() { + if (empty($this->usersOnlineList) || !count($this->usersOnlineList->getObjects())) { + return ''; + } + + WCF::getTPL()->assign(array( + 'usersOnlineList' => $this->usersOnlineList + )); + return WCF::getTPL()->fetch('dashboardBoxFollowingsOnlineSidebar'); + } +} diff --git a/wcfsetup/install/files/lib/system/dashboard/box/StaffOnlineSidebarDashboardBox.class.php b/wcfsetup/install/files/lib/system/dashboard/box/StaffOnlineSidebarDashboardBox.class.php new file mode 100644 index 0000000000..c1e1668672 --- /dev/null +++ b/wcfsetup/install/files/lib/system/dashboard/box/StaffOnlineSidebarDashboardBox.class.php @@ -0,0 +1,53 @@ + + * @package com.woltlab.wcf + * @subpackage system.dashboard.box + * @category Community Framework + */ +class StaffOnlineSidebarDashboardBox extends AbstractSidebarDashboardBox { + /** + * users online list + * @var \wcf\data\user\online\UsersOnlineList + */ + public $usersOnlineList = null; + + /** + * @see \wcf\system\dashboard\box\IDashboardBox::init() + */ + public function init(DashboardBox $box, IPage $page) { + parent::init($box, $page); + + if (MODULE_USERS_ONLINE) { + $this->usersOnlineList = new UsersOnlineList(); + $this->usersOnlineList->getConditionBuilder()->add('session.userID IN (SELECT userID FROM wcf'.WCF_N.'_user_to_group WHERE groupID IN (SELECT groupID FROM wcf'.WCF_N.'_user_group WHERE showOnTeamPage = ?))', array(1)); + $this->usersOnlineList->readObjects(); + } + + $this->fetched(); + } + + /** + * @see \wcf\system\dashboard\box\AbstractContentDashboardBox::render() + */ + protected function render() { + if (empty($this->usersOnlineList) || !count($this->usersOnlineList->getObjects())) { + return ''; + } + + WCF::getTPL()->assign(array( + 'usersOnlineList' => $this->usersOnlineList + )); + return WCF::getTPL()->fetch('dashboardBoxStaffOnlineSidebar'); + } +} diff --git a/wcfsetup/install/files/lib/system/dashboard/box/TodaysFollowingBirthdaysDashboardBox.class.php b/wcfsetup/install/files/lib/system/dashboard/box/TodaysFollowingBirthdaysDashboardBox.class.php new file mode 100644 index 0000000000..2880b9f1bf --- /dev/null +++ b/wcfsetup/install/files/lib/system/dashboard/box/TodaysFollowingBirthdaysDashboardBox.class.php @@ -0,0 +1,68 @@ + + * @package com.woltlab.wcf + * @subpackage system.dashboard.box + * @category Community Framework + */ +class TodaysFollowingBirthdaysDashboardBox extends AbstractSidebarDashboardBox { + /** + * user profiles + * @var arra<\wcf\data\user\UserProfile> + */ + public $userProfiles = array(); + + /** + * @see \wcf\system\dashboard\box\IDashboardBox::init() + */ + public function init(DashboardBox $box, IPage $page) { + parent::init($box, $page); + + // get current date + $currentDay = DateUtil::format(null, 'm-d'); + $date = explode('-', DateUtil::format(null, 'Y-n-j')); + + // get user ids + $userIDs = UserBirthdayCache::getInstance()->getBirthdays($date[1], $date[2]); + $userIDs = array_intersect($userIDs, WCF::getUserProfileHandler()->getFollowingUsers()); + + if (!empty($userIDs)) { + $userProfileList = new UserProfileList(); + $userProfileList->setObjectIDs($userIDs); + $userProfileList->readObjects(); + foreach ($userProfileList as $userProfile) { + if (!$userProfile->isProtected() && substr($userProfile->birthday, 5) == $currentDay) { + $this->userProfiles[] = $userProfile; + } + } + } + + $this->fetched(); + } + + /** + * @see \wcf\system\dashboard\box\AbstractContentDashboardBox::render() + */ + protected function render() { + if (empty($this->userProfiles)) { + return ''; + } + + WCF::getTPL()->assign(array( + 'birthdayUserProfiles' => $this->userProfiles + )); + return WCF::getTPL()->fetch('dashboardBoxTodaysFollowingBirthdays'); + } +} diff --git a/wcfsetup/install/files/lib/system/dashboard/box/UsersOnlineSidebarDashboardBox.class.php b/wcfsetup/install/files/lib/system/dashboard/box/UsersOnlineSidebarDashboardBox.class.php new file mode 100644 index 0000000000..bc682c0f58 --- /dev/null +++ b/wcfsetup/install/files/lib/system/dashboard/box/UsersOnlineSidebarDashboardBox.class.php @@ -0,0 +1,57 @@ + + * @package com.woltlab.wcf + * @subpackage system.dashboard.box + * @category Community Framework + */ +class UsersOnlineSidebarDashboardBox extends AbstractSidebarDashboardBox { + /** + * users online list + * @var \wcf\data\user\online\UsersOnlineList + */ + public $usersOnlineList = null; + + /** + * @see \wcf\system\dashboard\box\IDashboardBox::init() + */ + public function init(DashboardBox $box, IPage $page) { + parent::init($box, $page); + + if (MODULE_USERS_ONLINE) { + $this->usersOnlineList = new UsersOnlineList(); + $this->usersOnlineList->readStats(); + $this->usersOnlineList->checkRecord(); + $this->usersOnlineList->getConditionBuilder()->add('session.userID IS NOT NULL'); + $this->usersOnlineList->readObjects(); + } + + $this->fetched(); + } + + /** + * @see \wcf\system\dashboard\box\AbstractContentDashboardBox::render() + */ + protected function render() { + if (empty($this->usersOnlineList) || !count($this->usersOnlineList->getObjects())) { + return ''; + } + + $this->titleLink = LinkHandler::getInstance()->getLink('UsersOnlineList'); + WCF::getTPL()->assign(array( + 'usersOnlineList' => $this->usersOnlineList + )); + return WCF::getTPL()->fetch('dashboardBoxUsersOnlineSidebar'); + } +} diff --git a/wcfsetup/install/files/style/user.less b/wcfsetup/install/files/style/user.less index 66b2e80a2c..259859c009 100644 --- a/wcfsetup/install/files/style/user.less +++ b/wcfsetup/install/files/style/user.less @@ -8,6 +8,10 @@ display: block; } } + + .userList > li > a { + font-size: @wcfSmallFontSize; + } } .framedIconList { diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index adce4a87a9..9473ed7797 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -1667,6 +1667,10 @@ Fehler sind beispielsweise: likesReceived} Like{if $likedMember->likesReceived != 1}s{/if}]]> + + + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index d5a504b96b..276fa48f6b 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -1608,6 +1608,10 @@ Errors are: likesReceived} Like{if $likedMember->likesReceived != 1}s{/if}]]> + + + + -- 2.20.1