Added 4 new dashboard boxes
authorMarcel Werk <burntime@woltlab.com>
Fri, 6 Jun 2014 21:07:04 +0000 (23:07 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 6 Jun 2014 21:07:04 +0000 (23:07 +0200)
15 files changed:
com.woltlab.wcf/dashboardBox.xml
com.woltlab.wcf/templates/dashboardBoxFollowingsOnlineSidebar.tpl [new file with mode: 0644]
com.woltlab.wcf/templates/dashboardBoxSidebar.tpl
com.woltlab.wcf/templates/dashboardBoxStaffOnlineSidebar.tpl [new file with mode: 0644]
com.woltlab.wcf/templates/dashboardBoxTodaysBirthdays.tpl
com.woltlab.wcf/templates/dashboardBoxTodaysFollowingBirthdays.tpl [new file with mode: 0644]
com.woltlab.wcf/templates/dashboardBoxUsersOnlineSidebar.tpl [new file with mode: 0644]
wcfsetup/install/files/lib/system/dashboard/box/AbstractSidebarDashboardBox.class.php
wcfsetup/install/files/lib/system/dashboard/box/FollowingsOnlineSidebarDashboardBox.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/dashboard/box/StaffOnlineSidebarDashboardBox.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/dashboard/box/TodaysFollowingBirthdaysDashboardBox.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/dashboard/box/UsersOnlineSidebarDashboardBox.class.php [new file with mode: 0644]
wcfsetup/install/files/style/user.less
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index da9f502f00d22ecc6812c32b602a3e652370986f..fede92f78613a49d9da57cb3aa3dba9edf4d95a7 100644 (file)
                        <classname><![CDATA[wcf\system\dashboard\box\TodaysBirthdaysDashboardBox]]></classname>
                        <boxtype>sidebar</boxtype>
                </dashboardbox>
+               
+               <dashboardbox name="com.woltlab.wcf.user.todaysFollowingBirthdays">
+                       <classname><![CDATA[wcf\system\dashboard\box\TodaysFollowingBirthdaysDashboardBox]]></classname>
+                       <boxtype>sidebar</boxtype>
+               </dashboardbox>
+               
+               <dashboardbox name="com.woltlab.wcf.user.usersOnlineSidebar">
+                       <classname><![CDATA[wcf\system\dashboard\box\UsersOnlineSidebarDashboardBox]]></classname>
+                       <boxtype>sidebar</boxtype>
+               </dashboardbox>
+               
+               <dashboardbox name="com.woltlab.wcf.user.followingsOnlineSidebar">
+                       <classname><![CDATA[wcf\system\dashboard\box\FollowingsOnlineSidebarDashboardBox]]></classname>
+                       <boxtype>sidebar</boxtype>
+               </dashboardbox>
+               
+               <dashboardbox name="com.woltlab.wcf.user.staffOnlineSidebar">
+                       <classname><![CDATA[wcf\system\dashboard\box\StaffOnlineSidebarDashboardBox]]></classname>
+                       <boxtype>sidebar</boxtype>
+               </dashboardbox>
        </import>
 </data>
diff --git a/com.woltlab.wcf/templates/dashboardBoxFollowingsOnlineSidebar.tpl b/com.woltlab.wcf/templates/dashboardBoxFollowingsOnlineSidebar.tpl
new file mode 100644 (file)
index 0000000..72224de
--- /dev/null
@@ -0,0 +1,12 @@
+<ul class="sidebarBoxList">
+       {foreach from=$usersOnlineList item=userOnline}
+               <li class="box32">
+                       <a href="{link controller='User' object=$userOnline}{/link}" class="framed">{@$userOnline->getAvatar()->getImageTag(32)}</a>
+                       
+                       <div class="sidebarBoxHeadline">
+                               <h3><a href="{link controller='User' object=$userOnline}{/link}" class="userLink" data-user-id="{@$userOnline->userID}">{$userOnline->username}</a></h3>
+                               <small>{@$userOnline->lastActivityTime|time}</small>
+                       </div>
+               </li>
+       {/foreach}
+</ul>
index f219f0814c821de83796646b07984fcc8f470ff1..0e497b9a2875ddc080379c6cd186de73773cb05e 100644 (file)
@@ -1,5 +1,5 @@
 <fieldset class="dashboardBox">
-       <legend>{lang}wcf.dashboard.box.{$box->boxName}{/lang}</legend>
+       <legend>{if $titleLink}<a href="{$titleLink}">{lang}wcf.dashboard.box.{$box->boxName}{/lang}</a>{else}{lang}wcf.dashboard.box.{$box->boxName}{/lang}{/if}</legend>
        
        <div>
                {@$template}
diff --git a/com.woltlab.wcf/templates/dashboardBoxStaffOnlineSidebar.tpl b/com.woltlab.wcf/templates/dashboardBoxStaffOnlineSidebar.tpl
new file mode 100644 (file)
index 0000000..ecaa9c7
--- /dev/null
@@ -0,0 +1,12 @@
+<ul class="sidebarBoxList">
+       {foreach from=$usersOnlineList item=userOnline}
+               <li class="box32">
+                       <a href="{link controller='User' object=$userOnline}{/link}" class="framed">{@$userOnline->getAvatar()->getImageTag(32)}</a>
+                       
+                       <div class="sidebarBoxHeadline">
+                               <h3><a href="{link controller='User' object=$userOnline}{/link}" class="userLink" data-user-id="{@$userOnline->userID}">{$userOnline->username}</a></h3>
+                               <small>{if MODULE_USER_RANK && $userOnline->getUserTitle()} <span class="badge userTitleBadge{if $userOnline->getRank() && $userOnline->getRank()->cssClassName} {@$userOnline->getRank()->cssClassName}{/if}">{$userOnline->getUserTitle()}</span>{/if}</small>
+                       </div>
+               </li>
+       {/foreach}
+</ul>
index 9058f93a006504bcdb7bdd893deeaeb36aa28a8d..d472162a016520dcd9305acacc93cef528c5bea7 100644 (file)
@@ -1,7 +1,7 @@
 <ul class="sidebarBoxList">
        {foreach from=$birthdayUserProfiles item=birthdayUserProfile}
-               <li class="box24">
-                       <a href="{link controller='User' object=$birthdayUserProfile}{/link}" class="framed">{@$birthdayUserProfile->getAvatar()->getImageTag(24)}</a>
+               <li class="box32">
+                       <a href="{link controller='User' object=$birthdayUserProfile}{/link}" class="framed">{@$birthdayUserProfile->getAvatar()->getImageTag(32)}</a>
                        
                        <div class="sidebarBoxHeadline">
                                <h3><a href="{link controller='User' object=$birthdayUserProfile}{/link}" class="userLink" data-user-id="{@$birthdayUserProfile->userID}">{$birthdayUserProfile->username}</a></h3>
diff --git a/com.woltlab.wcf/templates/dashboardBoxTodaysFollowingBirthdays.tpl b/com.woltlab.wcf/templates/dashboardBoxTodaysFollowingBirthdays.tpl
new file mode 100644 (file)
index 0000000..61cedf5
--- /dev/null
@@ -0,0 +1,12 @@
+<ul class="sidebarBoxList">
+       {foreach from=$birthdayUserProfiles item=birthdayUserProfile}
+               <li class="box32">
+                       <a href="{link controller='User' object=$birthdayUserProfile}{/link}" class="framed">{@$birthdayUserProfile->getAvatar()->getImageTag(32)}</a>
+                       
+                       <div class="sidebarBoxHeadline">
+                               <h3><a href="{link controller='User' object=$birthdayUserProfile}{/link}" class="userLink" data-user-id="{@$birthdayUserProfile->userID}">{$birthdayUserProfile->username}</a></h3>
+                               <small>{$birthdayUserProfile->getBirthday()}</small>
+                       </div>
+               </li>
+       {/foreach}
+</ul>
diff --git a/com.woltlab.wcf/templates/dashboardBoxUsersOnlineSidebar.tpl b/com.woltlab.wcf/templates/dashboardBoxUsersOnlineSidebar.tpl
new file mode 100644 (file)
index 0000000..de03bcc
--- /dev/null
@@ -0,0 +1,7 @@
+<ul class="dataList userList">
+       {foreach from=$usersOnlineList->getObjects() item=userOnline}
+               <li><a href="{link controller='User' object=$userOnline->getDecoratedObject()}{/link}" class="userLink" data-user-id="{@$userOnline->userID}">{@$userOnline->getFormattedUsername()}</a></li>
+       {/foreach}
+</ul>
+
+<p class="marginTopTiny"><small>{lang}wcf.user.usersOnline.detail{/lang}{if USERS_ONLINE_RECORD} - {lang}wcf.user.usersOnline.record{/lang}{/if}</small></p>
\ No newline at end of file
index 947e375e91894b6306a00f179332517bb0da2d45..dd365e0e32bb1298f2bd65518ab28124e0854af0 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\dashboard\box;
+use wcf\system\WCF;
 
 /**
  * Default implementation for dashboard boxes displayed within the sidebar container.
@@ -16,4 +17,28 @@ abstract class AbstractSidebarDashboardBox extends AbstractContentDashboardBox {
         * @see \wcf\system\dashboard\box\AbstractDashboardBoxContent::$templateName
         */
        public $templateName = 'dashboardBoxSidebar';
+       
+       /**
+        * title link
+        * @var string
+        */
+       public $titleLink = '';
+       
+       /**
+        * @see \wcf\system\dashboard\box\IDashboardBox::getTemplate()
+        */
+       public function getTemplate() {
+               $template = $this->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 (file)
index 0000000..bb91805
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+namespace wcf\system\dashboard\box;
+use wcf\data\dashboard\box\DashboardBox; 
+use wcf\data\user\online\UsersOnlineList;
+use wcf\page\IPage; 
+use wcf\system\WCF;
+
+/**
+ * Lists online users the active user is following.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..c1e1668
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+namespace wcf\system\dashboard\box;
+use wcf\data\dashboard\box\DashboardBox; 
+use wcf\data\user\online\UsersOnlineList;
+use wcf\page\IPage; 
+use wcf\system\WCF;
+
+/**
+ * Lists staff members who are online.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..2880b9f
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+namespace wcf\system\dashboard\box;
+use wcf\data\dashboard\box\DashboardBox; 
+use wcf\data\user\UserProfileList;
+use wcf\page\IPage; 
+use wcf\system\user\UserBirthdayCache;
+use wcf\system\WCF;
+use wcf\util\DateUtil;
+
+/**
+ * Shows today's birthdays of users the active user is following.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..bc682c0
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+namespace wcf\system\dashboard\box;
+use wcf\data\dashboard\box\DashboardBox; 
+use wcf\data\user\online\UsersOnlineList;
+use wcf\page\IPage; 
+use wcf\system\WCF;
+use wcf\system\request\LinkHandler;
+
+/**
+ * Lists all users who are online.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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');
+       }
+}
index 66b2e80a2c17aff77e6596c019d0fcc720738098..259859c0091352a01c127e14cf8b4a941fdf3b52 100644 (file)
@@ -8,6 +8,10 @@
                        display: block;
                }
        }
+       
+       .userList > li > a {
+               font-size: @wcfSmallFontSize;
+       }
 }
 
 .framedIconList {
index adce4a87a9da23a9ea98ee59b18a6549771370cd..9473ed779781cb9297456988e4439c4cb86fc527 100644 (file)
@@ -1667,6 +1667,10 @@ Fehler sind beispielsweise:
                <item name="wcf.dashboard.box.com.woltlab.wcf.like.mostLikedMembers"><![CDATA[Mitglieder mit den meisten Likes]]></item>
                <item name="wcf.dashboard.box.mostLikedMembers.likes"><![CDATA[{#$likedMember->likesReceived} Like{if $likedMember->likesReceived != 1}s{/if}]]></item>
                <item name="wcf.dashboard.box.com.woltlab.wcf.user.todaysBirthdays"><![CDATA[Heutige Geburtstage]]></item>
+               <item name="wcf.dashboard.box.com.woltlab.wcf.user.todaysFollowingBirthdays"><![CDATA[Heutige Geburtstage von Nutzern, denen Sie folgen]]></item>
+               <item name="wcf.dashboard.box.com.woltlab.wcf.user.usersOnlineSidebar"><![CDATA[Benutzer online]]></item>
+               <item name="wcf.dashboard.box.com.woltlab.wcf.user.followingsOnlineSidebar"><![CDATA[Benutzer online, denen Sie folgen]]></item>
+               <item name="wcf.dashboard.box.com.woltlab.wcf.user.staffOnlineSidebar"><![CDATA[Team-Mitglieder online]]></item>
        </category>
        
        <category name="wcf.date">
index d5a504b96befd24bc9f45a19132d353a601ed0b5..276fa48f6bcda9d31a38d6300bfd7395dbb0f40a 100644 (file)
@@ -1608,6 +1608,10 @@ Errors are:
                <item name="wcf.dashboard.box.com.woltlab.wcf.like.mostLikedMembers"><![CDATA[Most Liked Members]]></item>
                <item name="wcf.dashboard.box.mostLikedMembers.likes"><![CDATA[{#$likedMember->likesReceived} Like{if $likedMember->likesReceived != 1}s{/if}]]></item>
                <item name="wcf.dashboard.box.com.woltlab.wcf.user.todaysBirthdays"><![CDATA[Today’s Birthdays]]></item>
+               <item name="wcf.dashboard.box.com.woltlab.wcf.user.todaysFollowingBirthdays"><![CDATA[TODO: Heutige Geburtstage von Nutzern, denen Sie folgen]]></item>
+               <item name="wcf.dashboard.box.com.woltlab.wcf.user.usersOnlineSidebar"><![CDATA[Users Online]]></item>
+               <item name="wcf.dashboard.box.com.woltlab.wcf.user.followingsOnlineSidebar"><![CDATA[TODO: Benutzer online, denen Sie folgen]]></item>
+               <item name="wcf.dashboard.box.com.woltlab.wcf.user.staffOnlineSidebar"><![CDATA[TODO: Team-Mitglieder online]]></item>
        </category>
        
        <category name="wcf.date">